问题描述
我为 Linux
下载,并尝试建立一个简单的 D
程序。执行 gdc hello.d -o hello
后,输出:
I download the GDC for Linux
, and try to build a simple D
Program. After executing "gdc hello.d -o hello
", it outputs:
[root@localhost nan]# gdc hello.d -o hello
/usr/bin/ld: unrecognized option '-plugin'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
然后我使用 gdc -v hello.d -o hello
命令,然后尝试查找根本原因。它显示:
Then I use "gdc -v hello.d -o hello
" command, and try to find the root cause. It displays:
......
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/home/nan/x86_64-gdcproject-linux-gnu/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/collect2 -plugin /home/nan/x86_64-gdcproject-linux-gnu/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/liblto_plugin.so -plugin-opt=/home/nan/x86_64-gdcproject-linux-gnu/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccWgsSJO.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o hello /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /home/nan/x86_64-gdcproject-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/crtbegin.o -L/home/nan/x86_64-gdcproject-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0 -L/home/nan/x86_64-gdcproject-linux-gnu/bin/../lib/gcc -L/lib/../lib64 -L/usr/lib/../lib64 -L/home/nan/x86_64-gdcproject-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../.. /tmp/ccEygjf5.o -lgphobos2 -lm -lpthread -lrt -lgcc_s -lgcc -lc -lgcc_s -lgcc /home/nan/x86_64-gdcproject-linux-gnu/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/crtend.o /usr/lib/../lib64/crtn.o
似乎 collect2
无法识别 -插件
选项。我尝试 google
它,但是找不到任何有价值的信息。有人可以提出一些建议吗?
It seems that collect2
doesn't recognize "-plugin
" option. I try to google
it, but can't find any valuable information. Could anyone give some suggestions? Thanks very much in advance!
推荐答案
这很可能是因为gdc wac针对不同的GCC(相同的版本但具有不同的编译标志)进行了编译(某些插件可能会丢失))。
This is probabbly cause because gdc wac compiled against differnt GCC (same version but with different compile flags (some plugins may missing)) than yours distro gcc.
有时可以安装缺少的插件或安装其他gcc。或者您可以使用
Sometimes is possible to install missing plugin or install different gcc. Or you can use
-fno-use-linker-plugin
作为建议
这篇关于如何修复“无法识别的选项-plugin”?什么时候用gdc编译D程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!