Search code examples
cboostbuildautotoolslibtool

g++-4.6.real: error: unrecognized option '-R'


I am trying to compile phpcompiler from source using this configure command.

./configure  --prefix=/opt/phc-0.3.0.1/    --with-php=/opt/php-5.3.17/

The configure error was,

checking for exit in -lboost_regex-mt... no
checking for exit in -lboost_regex-mt... (cached) no
checking for exit in -lboost_regex... no
checking for exit in -lboost_regex... (cached) no
checking for exit in -lboost_regex... (cached) no
configure: error: Could not link against boost_regex 

Thats completely wrong as I have both boost and boost_regex packages installed. Both libs and header files. Then I dug this in the config.log file

configure:17053: g++ -o conftest -g -O2    -L/lib/php5 -L/usr/lib/php5 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'

So, for this unrecognized option '-R' error, many -lboost_regex checks were failed!

How can I fix this? is there any file that I can edit to fix it? And why -R is used? I think it would be -L flag.


Solution

  • As your comment indicates that this -R option comes from configure, the following line in m4/php-embed.m4 appears to be the most likely source:

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

    If you look at configure, all other occurrences of -R will write that as ${wl}-R, where ${wl} will most likely expand to -Wl,. So one way to fix this would be adding the ${wl} before -R in the above line and running autogen.sh to recreate configure.

    You may whish to file a bug for this, after checking existing ones.