9

I am trying to run an autotools configure script for the bson-cpp project, and it fails because it cannot determine what flags it needs to compile with boost_filesystem. A quick look at confg.log shows:

g++ -o conftest -g -O2   -pthread  -L/usr/local/lib -R/usr/local/lib -L/usr/local/libexec conftest.o -lboost_filesystem-mt  -lboost_system-mt >&5
g++: error: unrecognized option '-R'

So, naturally, I tried to find out what the R option does, but I can't seem to find it documented anywhere. I've checked here and here to no avail. What does the option do and how do I tell autotools not to use it?

ctrlc-root
  • 1,049
  • 1
  • 15
  • 22
  • It's not necessarily a problem, `configure` tries different methods to find out what works on the actual platform. Option `-R dir` is gone now, it has been replaced with simpler (albeit platform-specific) options, like `-Wl,-rpath,dir` – Lorinczy Zsigmond Nov 21 '20 at 06:29

3 Answers3

9

-R does not seem to be an option for g++ or gcc anywhere. -R may be a linker option on some platforms that is equivalent of -rpath to gnu ld, ... This seems to be a known bug in boost builds ... have a look at Use -Wl to pass arguments to the linker.

It actually has the patch available there

I am re-posting it for convenience, however PLEASE PLEASE look at the original URL linked above for official patch!

--- ../gnote/m4/boost.m4    2011-01-25 14:30:18.000000000 +0200
+++ m4/boost.m4 2011-02-27 20:57:11.686221539 +0200
@@ -403,7 +403,7 @@
       LDFLAGS=$boost_save_LDFLAGS
       LIBS=$boost_save_LIBS
       if test x"$Boost_lib" = xyes; then
-        Boost_lib_LDFLAGS="-L$boost_ldpath -R$boost_ldpath"
+        Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-R$boost_ldpath"
         Boost_lib_LDPATH="$boost_ldpath"
         break 6
       else
Ahmed Masud
  • 21,655
  • 3
  • 33
  • 58
1

It's an option similar to -rpath, but available only on some platforms. The script is maybe failing detecting your platform ?

Marc Plano-Lesay
  • 6,808
  • 10
  • 44
  • 75
0

It is not a valid option for GCC, so it does not do anything.

It is possibly a valid option for other compilers though, which could be why autoconf gives it a shot.

Not all errors in the config.log files are a problem. autoconf figures out a lot of things by "guessing", i.e. trying something and keeping that if it worked.

Mat
  • 202,337
  • 40
  • 393
  • 406
  • see my edit, but valid option or not, do you know how I can disable it? – ctrlc-root Oct 22 '11 at 14:03
  • your edit doesn't mean it's a valid option. (Try with all the other capital letters.) My point is: that error in config.log is _probably_ not a problem. A config.log from a successful configure run is always full of errors. – Mat Oct 22 '11 at 14:06
  • oh whoops, you are correct, made an assumption there haha (it doesn't work if I do -R/usr for example). – ctrlc-root Oct 22 '11 at 14:08
  • 2
    BTW, `-R` is an option for `ld`. Some versions of GCC might pass it on directly to the linker on some implementations. – Mat Oct 22 '11 at 14:09