g++-4.6: error: unrecognized option '-R' #8

Open
shiplu opened this Issue Sep 27, 2012 · 5 comments

3 participants

@shiplu

after I build it using ./configure --prefix=/opt/phc-0.3.0.1/ --with-php=/opt/php-5.3.17/ --with-boost I get following error in the config.log file.

configure:16928: g++ -o conftest -g -O2   conftest.cpp /usr/lib/libCrun.so.1 -lphp5 -L/opt/php-5.3.17//lib -R/opt/php-5.3.17//lib -ldl  >&5
g++-4.6.real: error: /usr/lib/libCrun.so.1: No such file or directory
g++-4.6.real: error: unrecognized option '-R'

This is the configure error I get.

checking for sapi/embed/php_embed.h... yes
checking whether compiler supports covariant returns... yes
checking for /usr/lib/libCrun.so.1... no
checking for boostlib >= 1.35.0... yes
checking whether the Boost::Regex library is available... yes
configure: error: Could not link against  !
@shiplu

Could you tell me how to fix it? Is there any workaround?
Also if you could provide a sample manual Makefile that works, it'd be greatly appreciated.

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.1 LTS"


$ uname -a
Linux KubuntuD 3.2.0-30-generic #48-Ubuntu SMP Fri Aug 24 16:52:48 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ locate libboost_regex
/usr/lib/libboost_regex-mt.a
/usr/lib/libboost_regex-mt.so
/usr/lib/libboost_regex.a
/usr/lib/libboost_regex.so
/usr/lib/libboost_regex.so.1.46.1
@shiplu

Also see this answer on stackoverflow. It seems the problem is with m4/php-embed.m4

@gagern

To quote my answer from Stack Overflow, you probably should adjust php-embed.m4 like this:

LIBS="-lphp5 -L${PHP_INSTALL_PATH}/lib ${wl}-R${PHP_INSTALL_PATH}/lib $LIBS"
                                       ^^^^^

For gcc this should translate to -Wl,-R…, thus passing the flag to the linker where it belongs.

@ahamid

I ran into the same error with Fedora's PHP 5.3.20 package. The above solution did not fix the problem for me. I was still left with:

configure:16669: checking for zend_eval_string in -lphp5
1555 configure:16695: gcc -o conftest -isystemyes/include/php -isystemyes/include/php/main -isystemyes/include/php/TSRM -isystemyes/include/php/Zend -g -O2  -Lyes/lib
       conftest.c -lphp5
1556                  -ldl  >&5
/usr/local/lib/libphp5.so: undefined reference to `ap_hook_child_init'
/usr/local/lib/libphp5.so: undefined reference to `ap_*lots of other functions*`

in config.log and same configure: error: Could not link against ! error. Apparently PHP has to be built differently? (http://www.linuxquestions.org/questions/programming-9/where-are-apache-symbols-947465/) Is that right? Has anybody built PHC against a recent PHP? (is -isystemyes correct, that looks bogus...)

@ahamid

Perhaps it's a permanent bug in the PHP 5.3.x line... https://bugs.php.net/bug.php?id=52419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment