Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "unrecognized option '-plugin`" when using gdc to compile D program?

Tags:

d

gdc

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

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

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!

like image 493
Nan Xiao Avatar asked Jan 07 '15 06:01

Nan Xiao


1 Answers

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.

Sometimes is possible to install missing plugin or install different gcc. Or you can use

-fno-use-linker-plugin

as jpf suggest

like image 70
Kozzi11 Avatar answered Oct 29 '22 15:10

Kozzi11