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

为君一笑 提交于 2019-12-06 04:57:02
MvG

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.

You can see a similar error (and resolution) in Git 2.23 (Q2 2019) where -R has been removed.
The way of specifying the path to find dynamic libraries at runtime has been simplified.
The old default to pass -R/path/to/dir has been replaced with the new default to pass -Wl,-rpath,/path/to/dir, which is the more recent GCC uses.

See commit 0f50c8e (17 May 2019) by Ævar Arnfjörð Bjarmason (avar).
(Merged by Junio C Hamano -- gitster -- in commit 51d6c0f, 13 Jun 2019)

Makefile: remove the NO_R_TO_GCC_LINKER flag

Change our default CC_LD_DYNPATH invocation to something GCC likes these days.
Since the GCC 4.6 release unknown flags haven't been passed through to ld(1). Thus our previous default of CC_LD_DYNPATH=-R would cause an error on modern GCC unless NO_R_TO_GCC_LINKER was set.

Our use of "-R" dates back to 455a7f3 ("More portability.", 2005-09-30, Git v0.99.8a).
Soon after that in bbfc63d ("gcc does not necessarily pass runtime libpath with -R", 2006-12-27, Git v1.5.0-rc1) the NO_R_TO_GCC flag was added, allowing optional use of "-Wl,-rpath=".

Then in f5b904d ("Makefile: Allow CC_LD_DYNPATH to be overriden", 2008-08-16, Git v1.6.1-rc1) the ability to override this flag to something else entirely was added, as some linkers use neither "-Wl,-rpath," nor "-R".

From what I can tell we should, with the benefit of hindsight, have made this change back in 2006.
GCC & ld supported this type of invocation back then, or since at least binutils-gdb.git's. a1ad915dc4 ("[...]Add support for -rpath[...]", 1994-07-20).

Further reading and prior art can be found at:

Making a plain "-R" an error seems from reading those reports to have been introduced in GCC 4.6 released on March 25, 2011, but I couldn't confirm this with absolute certainty, its release notes are ambiguous on the subject, and I couldn't be bothered to try to build & bisect it against GCC 4.5.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!