Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP extension] qconf.so: undefined symbol: qconf_init #16

Closed
lycboy opened this issue Sep 27, 2015 · 5 comments
Closed

[PHP extension] qconf.so: undefined symbol: qconf_init #16

lycboy opened this issue Sep 27, 2015 · 5 comments

Comments

@lycboy
Copy link

lycboy commented Sep 27, 2015

PHP and QConf are all installed on non-default path.

When QConf PHP extension installed, run php -m, it reported:

php: symbol lookup error: /path/to/php/lib/php/extensions/no-debug-non-zts-20131226/qconf.so: undefined symbol: qconf_init

I modified the config.m4 file to:

PHP_ARG_ENABLE(qconf, whether to enable qconf support,
[  --enable-qconf               Enable qconf support])

PHP_ARG_WITH(libqconf-dir,  for libqconf,
[  --with-libqconf-dir[=DIR]   Set the path to libqconf prefix.], yes)

if test -z "$PHP_DEBUG"
then
  AC_ARG_ENABLE(debug,
  [  --enable-debug          compile with debugging symbols],[
    PHP_DEBUG=$enableval
  ],[    PHP_DEBUG=no
  ])
fi

if test "$PHP_QCONF" != "no"
then
  if test "$PHP_LIBQCONF_DIR" != "no" && test "$PHP_LIBQCONF_DIR" != "yes"
  then
    PHP_LIBQCONF_DIR=$PHP_LIBQCONF_DIR
  else
    PHP_LIBQCONF_DIR="/usr/local/include/qconf"
  fi

  PHP_LIBQCONF_INC=$PHP_LIBQCONF_DIR/include
  PHP_LIBQCONF_LIB=$PHP_LIBQCONF_DIR/lib

  if test ! -r "$PHP_LIBQCONF_INC/qconf.h"
    then
      AC_MSG_ERROR([Can't find qconf headers under "$PHP_LIBQCONF_DIR"])
  fi

  PHP_REQUIRE_CXX()
  PHP_ADD_INCLUDE($PHP_LIBQCONF_INC)
  PHP_ADD_LIBRARY(stdc++, "", EXTRA_LDFLAGS)
  PHP_ADD_LIBRARY_WITH_PATH(qconf, "$PHP_LIBQCONF_LIB", QCONF_SHARED_LIBADD)
  PHP_NEW_EXTENSION(qconf, php_qconf.c $SESSION_EXTRA_FILES, $ext_shared)
  PHP_SUBST(QCONF_SHARED_LIBADD)
fi

I use --with-libqconf-dir to specify the libqconf PREFIX(not the include directory) to solve the problem.

Hope to help you improve QConf :)

@CatKang
Copy link
Contributor

CatKang commented Sep 30, 2015

Greate job

Thank you for your advice!

But I'm still confused with the error message.

Have you specify the location of qconf library with the follow command.
" --enable-static LDFLAGS=/usr/local/qconf/lib/libqconf.a"
as described in https://github.com/Qihoo360/QConf/wiki/QConf-PHP-Doc

@lycboy
Copy link
Author

lycboy commented Sep 30, 2015

Sorry my fault, I didn't carefully read the document...

I think it's a best practice to set the library installed prefix instead of the include path, and no LDFLAGS set manually. Maybe it's still an alternative configure. :)

Thank you very much!

@CatKang
Copy link
Contributor

CatKang commented Sep 30, 2015

Yeah, I think your solution is much more elegant.

But I found it may not work properly on MacOS with information:
"Library not loaded: libqconf.dylib"

Do you know what's the matter?

Thanks very much

@lycboy
Copy link
Author

lycboy commented Dec 8, 2015

Sorry missed your reply...
I didn't test QConf on OSX. I guess the shared lib of libqconf use .so as it's extension, not the normal extension of OSX shared lib(*.dylib).

@mark-lauq
Copy link

See this How to install QConf on OSX ^_^

@gaodq gaodq closed this as completed Dec 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants