未识别的命令行选项“-rdynamic”在GCC v4.9.2中。

时间:2022-07-07 23:17:00

I'm using GCC v4.9.2 under Cygwin on Windows 7 64-bit, but running into an issue trying to compile uWSGI.

我在Windows 7 64位的Cygwin中使用GCC v4.9.2,但是遇到了试图编译uWSGI的问题。

The error I'm receiving is -

我收到的错误是-。

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

GCC version output -

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)

I'm invoking the build with CFLAGS="-Wno-error" make.

我用CFLAGS="-Wno-error"来调用构建。

I'm not sure why I'm getting this error as I can see in the documentation from here that flag -rdynamic exists.

我不知道为什么会出现这个错误,因为我在这里的文档中看到标记-rdynamic存在。

What am I missing?

我缺少什么?

2 个解决方案

#1


3  

I think I've got it...

我想我明白了……

Here's what happens on my laptop (Cygwin 2.831 x86 on W7 x64):

下面是我的笔记本电脑(w7x64上Cygwin 2.831 x86):

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)

When I pass -rdynamic:

当我通过-rdynamic:

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

Compared to -rdynamic1:

-rdynamic1相比:

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

The man page of my gcc mentions it (I'm not sure how relevant is that), but gcc -v --help doesn't display it under the linker specific options. I thought that maybe something is different about how the gccs are configured but I didn't see any difference that would matter (both have --with-gnu-ld - which seems related - specified).

我的gcc的手册页提到了它(我不确定它有多重要),但是gcc -v——帮助不会在链接器的特定选项下显示它。我认为也许有些东西与gccs的配置不同,但我没有看到任何有意义的区别(两者都有- gnuld -ld似乎是相关的)。

Then I downloaded 4.8.2 and 4.9.2 sources and start searching and comparing but again I couldn't find anything (it's true the search could be widely extended :) ).

然后我下载了4.8.2和4.9.2的源代码,开始搜索和比较,但我还是找不到任何东西(这是真的,搜索可以被广泛地扩展:)。

But while browsing the configure file I noticed something that could be related, then I checked the ld command line options and I think I have an alternative:

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

Instead of -rdynamic you could pass -Wl,--export-all-symbols. That works for me (that's not very relevant since -rdynamic also works for me, unlike in your case :))

而不是-rdynamic,你可以通过-Wl,-- -- -- -- -- -- -- -- -- -- -- -- --。这对我来说很有用(这不是很重要,因为-rdynamic对我来说也很有用,不像你的例子:))

#2


2  

The link you give says:

你给出的链接是:

-rdynamic

-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.

将标志-export-dynamic传递给ELF链接器,以支持它的目标。这指示链接器将所有符号,不仅仅是使用的符号,添加到动态符号表中。这个选项对于dlopen的某些用途来说是必需的,或者允许从程序中获取回溯。

(Emphasis added.)

(强调)。

Is Cygwin using ELF format object files? It seems unlikely.

Cygwin使用ELF格式对象文件吗?它似乎是不可能的。

#1


3  

I think I've got it...

我想我明白了……

Here's what happens on my laptop (Cygwin 2.831 x86 on W7 x64):

下面是我的笔记本电脑(w7x64上Cygwin 2.831 x86):

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)

When I pass -rdynamic:

当我通过-rdynamic:

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

Compared to -rdynamic1:

-rdynamic1相比:

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

The man page of my gcc mentions it (I'm not sure how relevant is that), but gcc -v --help doesn't display it under the linker specific options. I thought that maybe something is different about how the gccs are configured but I didn't see any difference that would matter (both have --with-gnu-ld - which seems related - specified).

我的gcc的手册页提到了它(我不确定它有多重要),但是gcc -v——帮助不会在链接器的特定选项下显示它。我认为也许有些东西与gccs的配置不同,但我没有看到任何有意义的区别(两者都有- gnuld -ld似乎是相关的)。

Then I downloaded 4.8.2 and 4.9.2 sources and start searching and comparing but again I couldn't find anything (it's true the search could be widely extended :) ).

然后我下载了4.8.2和4.9.2的源代码,开始搜索和比较,但我还是找不到任何东西(这是真的,搜索可以被广泛地扩展:)。

But while browsing the configure file I noticed something that could be related, then I checked the ld command line options and I think I have an alternative:

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

Instead of -rdynamic you could pass -Wl,--export-all-symbols. That works for me (that's not very relevant since -rdynamic also works for me, unlike in your case :))

而不是-rdynamic,你可以通过-Wl,-- -- -- -- -- -- -- -- -- -- -- -- --。这对我来说很有用(这不是很重要,因为-rdynamic对我来说也很有用,不像你的例子:))

#2


2  

The link you give says:

你给出的链接是:

-rdynamic

-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.

将标志-export-dynamic传递给ELF链接器,以支持它的目标。这指示链接器将所有符号,不仅仅是使用的符号,添加到动态符号表中。这个选项对于dlopen的某些用途来说是必需的,或者允许从程序中获取回溯。

(Emphasis added.)

(强调)。

Is Cygwin using ELF format object files? It seems unlikely.

Cygwin使用ELF格式对象文件吗?它似乎是不可能的。