You are not logged in.

#1 2022-08-07 10:56:09

1Jo1
Member
Registered: 2021-04-11
Posts: 3

[SOLVED] cant create C/C++ dynamic libraries anymore

Hi

since yesterday i have this issue that i can't build C/C++ libraries anymore on my machine

when I run

gcc -shared -W -o libshared.so hello1.o hello2.o

it seems its a glibc issue or linker issue? these files /usr/lib/libc.so.6  and  /usr/lib/ld-linux-x86-64.so.2 actually exist, its probably incompatible

/usr/local/bin/ld: /usr/lib/libc.so.6: unknown type [0x13] section `.relr.dyn'
/usr/local/bin/ld: skipping incompatible /usr/lib/libc.so.6 when searching for /usr/lib/libc.so.6
/usr/local/bin/ld: cannot find /usr/lib/libc.so.6
/usr/local/bin/ld: /usr/lib/libc.so.6: unknown type [0x13] section `.relr.dyn'
/usr/local/bin/ld: skipping incompatible /usr/lib/libc.so.6 when searching for /usr/lib/libc.so.6
/usr/local/bin/ld: /usr/lib/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
/usr/local/bin/ld: skipping incompatible /usr/lib/ld-linux-x86-64.so.2 when searching for /usr/lib/ld-linux-x86-64.so.2
/usr/local/bin/ld: cannot find /usr/lib/ld-linux-x86-64.so.2
/usr/local/bin/ld: /usr/lib/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
/usr/local/bin/ld: skipping incompatible /usr/lib/ld-linux-x86-64.so.2 when searching for /usr/lib/ld-linux-x86-64.so.2
collect2: error: ld returned 1 exit status
make: *** [Makefile:5: hello] Error 1

here is a small example to test it
https://gitlab.com/1Jo1/gcc-dynamic-library-example

does anyone have the same problem?
I couldn't reproduce this issue on a virtual machine/laptop
I noticed  that usr/local/bin/ld version on my machine is GNU ld (GNU Binutils) 2.37.50  but on my virtual machine/laptop its GNU ld (GNU Binutils) 2.38 and both systems are up to date which is really weird, glibc version, gcc version and binutils version is the same
or is ld in a different package?

Last edited by 1Jo1 (2022-08-07 14:49:00)

Offline

#2 2022-08-07 11:08:42

a821
Member
Registered: 2012-10-31
Posts: 381

Re: [SOLVED] cant create C/C++ dynamic libraries anymore

why do you have `ld` in /usr/local/bin ?

Offline

#3 2022-08-07 14:48:06

1Jo1
Member
Registered: 2021-04-11
Posts: 3

Re: [SOLVED] cant create C/C++ dynamic libraries anymore

a821 wrote:

why do you have `ld` in /usr/local/bin ?

oh yeah you right that was the issue, thank you so much smile

Offline

#4 2022-12-21 18:06:23

QuarterOfCinnamonStick
Member
Registered: 2022-12-21
Posts: 2

Re: [SOLVED] cant create C/C++ dynamic libraries anymore

1Jo1 wrote:
a821 wrote:

why do you have `ld` in /usr/local/bin ?

oh yeah you right that was the issue, thank you so much smile

How exactly did you fix if? where should 'ld' be? I dont get whats the issue

Offline

#5 2022-12-21 19:19:17

1Jo1
Member
Registered: 2021-04-11
Posts: 3

Re: [SOLVED] cant create C/C++ dynamic libraries anymore

I removed /usr/local/bin/ld as I noticed when I did 'which ld' it actually used /usr/local/bin/ld, however it should be /usr/bin/ld on Arch LInux
it seems to be that I build ld manuelly I dont know haha

Offline

#6 2022-12-21 20:33:28

QuarterOfCinnamonStick
Member
Registered: 2022-12-21
Posts: 2

Re: [SOLVED] cant create C/C++ dynamic libraries anymore

1Jo1 wrote:

I removed /usr/local/bin/ld as I noticed when I did 'which ld' it actually used /usr/local/bin/ld, however it should be /usr/bin/ld on Arch LInux
it seems to be that I build ld manuelly I dont know haha


Aha, all right thank you so much! i was kinda scared to remove it but its working now, thank you <3

Last edited by QuarterOfCinnamonStick (2022-12-21 20:33:57)

Offline

Board footer

Powered by FluxBB