Skip to main content

ld: unrecognized option '--hash-style=both'

gcc -Wl,-Map=contiki.map,-export-dynamic testv6.co obj_linux-native/socketdev_listener.o \
contiki-linux-native.a -o testv6.linux-native
/usr/local/bin/ld: unrecognized option '--hash-style=both'
/usr/local/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status


If you look closely, the error is something related to the local gcc not using the host's linker (ld).

$ which gcc
/usr/bin/gcc


$ which ld
/usr/local/bin/ld


For some reason, I messed my compiler path. To synchronized gcc to use the host's dynamic linker (i.e. /usr/bin/ld), set the environment variable COMPILER_PATH to /usr/bin.

$ export COMPILER_PATH=/usr/bin
$ echo $COMPILER_PATH
/usr/bin

$ gcc -print-prog-name=ld
/usr/bin/ld

Comments

Anonymous said…
it worked for me
Thanks
Anonymous said…
Thanks. It worked, but I have to do it every time I open a new terminal. Otherwise, the old error just kicks in. Is there a way to fix that?
Prem said…
Just do the assignment of COMPILER_PATH in your bash profile or system-wide /etc/profile
Anonymous said…
Thank you. I did what you said. After that, whenever I enter the command $gcc -print-prog-name=ld, the output become "ld" instead of "/usr/bin/ld", and I still get the same error message when I use the GCC compiler.

I'm running a Linux Redhat 2.6.
Prem said…
What is the output of `echo $COMPILER_PATH`?
Anonymous said…
The output is /usr/bin.
Anonymous said…
Also, I just found two problems with my system.

First, my error message is actually different from yours:

/usr/local/bin/ld: unrecognized option '--hash-style=gnu'
/usr/local/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status

Second, changing bashrc or profile in my computer doesn't seem to have any effect at all. I appended a new directory to PATH. The echo output shows the correct PATH (the changed one), but when I'm executing a command, bash will not search the appended directory.
Anonymous said…
Also, I just found two problems with my system.

First, my error message is actually different from yours:

/usr/local/bin/ld: unrecognized option '--hash-style=gnu'
/usr/local/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status

Second, changing bashrc or profile in my computer doesn't seem to have any effect at all. I appended a new directory to PATH. The echo output shows the correct PATH (the changed one), but when I'm executing a command, bash will not search the appended directory.
Anonymous said…
Sorry my bad. Changing path works.

But the first problem still exists.

Popular posts from this blog

Ubuntu on Intel D945GCLF (with Intel Atom)

The rig: D945GCLF board Intel Atom @ 1.6GHZ w/HT It looks like it's a linux kernel bug: http://www.gossamer-threads.com/lists/linux/kernel/982159 The ethernet controller is: Realtek Semiconductor Co., Ltd. RTL8101E PCI Express Fast Ethernet controller (rev ff) does not seem to work in any of the Ubuntu versions. Fix: recompile the kernel with patch You can download my patched packages here (currently uploading, let me know if something is missing): http://mirakulo.com/pub/linux-image-2.6.24-21-patched/ NOTE: I got the .udeb packages because of this warning: dpkg-gencontrol: warning: deb package with udeb specific field Kernel-Version or you can do the following steps if you don't trust me: apt-get source linux-source-2.6.24 apt-get build-dep linux-source-2.6.24 aptitude install install devscripts build-essential fakeroot cd linux-2.6.24/ Get this patch: http://bugzilla.kernel.org/attachment.cgi?id=17604&action=view patch -p 1 debuild -us -uc -b Install the kernel that...

Resetting admin password in IBM System p5 510 Express ASMI

These are the steps in resetting the admin password: 0. Re-route stored static in your body via an ESD wrist strap to a metallic element. 1. Look for the 2 toggle switches and service processor batt. The batt should be in front of the Power Supply 1 and Power Supply 2 (codes: E1 and E2, see Rear Location Codes on the cover plate). The "very tiny" toggle switches should be in the area of P1-C14 slot. I forgot the exact sequence but it should be a combination of the ff. step (2): 2. Remove the battery, toggle the switches to the opposite direction. Allows some time for the caps to discharge. 3. Move back the toggle switches and put back the batt in its place. 4. Assign your PC to Class C subnet (i.e. masked 255.255.255.0 ): IPaddr: 192.168.2.x for HMC1 or IPaddr: 192.168.3.x for HMC2 5. Ping HMC1 or HMC2. Access the web interface using the default address: http://192.168.2.147 (for HMC1) or http://192.168.3.147 (for HMC2) Note: Sometimes you have to force the https protocol: ...