GCC v4.9.2 上无法识别的命令行选项“-rdynamic”

unrecognized command line option ‘-rdynamic’ on GCC v4.9.2

我在 Windows 7 64 位上使用 Cygwin 下的 GCC v4.9.2,但 运行 在尝试编译 uWSGI.

时遇到问题

我收到的错误是 -

gcc: error: unrecognized command line option ‘-rdynamic’

GCC 版本输出 -

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-3.x86_64/src/gcc-4.9.2/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-3.x86_64/src/gcc-4.9.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id
Thread model: posix
gcc version 4.9.2 (GCC)

我正在使用 CFLAGS="-Wno-error" make 调用构建。

我不确定为什么会收到此错误,正如我在 here 的文档中看到的那样,标志 -rdynamic 存在。

我错过了什么?

你给的link说:

-rdynamic

Pass the flag -export-dynamic to the ELF linker, on targets that support it. This instructs the linker to add all symbols, not only used ones, to the dynamic symbol table. This option is needed for some uses of dlopen or to allow obtaining backtraces from within a program.

(已强调。)

Cygwin 是否使用 ELF 格式目标文件?好像不太可能。

我想我明白了...

这是我的笔记本电脑 (Cygwin 2.831 (pc032) 在 Win7 ( pc064)):

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-cygwin/4.8.2/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2/configure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --disable-__cxa_atexit --with-dwarf2 --with-arch=i686 --with-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libjava --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib
Thread model: posix
gcc version 4.8.2 (GCC)

当我通过 -rdynamic:

gcc -rdynamic
gcc: fatal error: no input files
compilation terminated.

-rdynamic1相比:

gcc -rdynamic1
gcc: error: unrecognized command line option ‘-rdynamic1’
gcc: fatal error: no input files
compilation terminated.

[Man7]: GCC(1) 提到了它(我不确定它有多相关),但是 gcc -v --help 没有在链接器特定选项下显示它。 我认为 GCC 的配置方式可能有所不同,但我没有看到任何重要的区别(两者都有 - -with-gnu-ld - 似乎相关 - 指定)。

然后我下载了 v4.8.2v4.9.2 源并开始搜索和比较,但我还是找不到任何东西(是的,搜索可以广泛扩展)。

但是在浏览 configure 文件时,我注意到一些可能相关的东西,然后我检查了 ld 命令行选项,然后我我想我还有一个选择:

而不是-rdynamic,你可以通过-Wl,--export-所有符号。这对我有用(这不是很相关,因为 -rdynamic 也对我有用,不像你的情况:))。