ld cannot find 32bit libc during building

Hi, I am currently trying to compile a 32bit freetype example code, however when I try to do so I receive:

/usr/bin/ld: cannot find /media/34GB/Arquivos-de-Programas-Linux/Glibc-2.17-32bit/lib/libc.so.6

ld cannot find because I moved and renamed it from /media/34GB/Arquivos-de-Programas-Linux/Glibc-2.17-32bit/lib/libc.so.6 to

/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/

However, I have absolute no idea as to why ld is looking for libc.so.6 in this dir, since I am not passing it to g++. My compile command it is:

g++ -m32 -o freetype -I/media/34GB/Arquivos-de-Programas-Linux/Freetype-2.2.1/include/ -I/media/34GB/Arquivos-de-Programas-Linux/Freetype-2.2.1/include/freetype2/ example2.cpp

Another weird thing is that it should be finding libc.so.6 on /usr/lib32, since I created symbolic links from everything on ]/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/

Adding -L/usr/lib32 or -L/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib does not changet he output.

So its ignoring both directories that I am passing to g++ neither is looking by default on -L/usr/lib32, which I thought it would do, since I added it to ld.conf.so and then called ldconfig

So. any clue about what is happening?
Last edited on
Just add the -v option to your g++ command line to get visibility of all the paths and libraries that the linker is presently searching through.

> because I moved and renamed it
Does it work if you put it back to where it started?
Your original compile command doesn't specify the new directory.

You say you added -L..., but you don't show the new compile command.

We can't really help if we have to infer what you did, we need to see what you actually did.
Last edited on
Does it work if you put it back to where it started?


No. However, if I do so, also rename it to the old name and fix a now broken symbolic link to the file stubs-32bit that was on /usr/include/gnu, it changes the error message to:
1
2
3
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/bin/ld: cannot find -lm


Your original compile command doesn't specify the new directory.

You say you added -L..., but you don't show the new compile command.

We can't really help if we have to infer what you did, we need to see what you actually did.


Well none of these three works: g++ -m32 -o freetype -I/media/34GB/Arquivos-de-Programas-Linux-32bit/Freetype-2.2.1/include/ -I/media/34GB/Arquivos-de-Programas-Linux-32bit/Freetype-2.2.1/include/freetype2/ example2.cpp

or g++ -m32 -o freetype -I/media/34GB/Arquivos-de-Programas-Linux-32bit/Freetype-2.2.1/include/ -I/media/34GB/Arquivos-de-Programas-Linux-32bit/Freetype-2.2.1/include/freetype2/ -L/usr/lib32 example2.cpp

g++ -m32 -o freetype -I/media/34GB/Arquivos-de-Programas-Linux-32bit/Freetype-2.2.1/include/ -I/media/34GB/Arquivos-de-Programas-Linux-32bit/Freetype-2.2.1/include/freetype2/ -L/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib example2.cpp
When you say, "none of these three works", what error messages do you get?
This:
1
2
/usr/bin/ld: cannot find /media/34GB/Arquivos-de-Programas-Linux/Glibc-2.17-32bit/lib/libc.so.6
collect2: error: ld returned 1 exit status


Still looking for libc on the old Arquivos-de-Programas-Linux/Glibc-2.17-32bit instead the new Arquivos-de-Programas-Linux-32bit/Glibc-2.17
This libc.so.6 that you're trying to use, what directory is it in?
On /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17

On a side note, I seen to be facing a similar error when running a configure test while trying to configure mesa to do a 32bit build of it:

1
2
3
4
configure:2811: checking for C compiler default output file name
configure:2833: gcc -m32 -m32 -I/media/34GB/Arquivos-de-Programas-Linux-32bit/xorg//X11-1.4.4/include/ -I/media/34GB/Arquivos-de-Programas-Linux/xorg/Xorgproto-2018.1/include/ -m32 -L/media/34GB/Arquivos-de-Programas-Linux-32bit/xorg/X11-1.4.4/lib/ conftest.c  >&5
/usr/bin/ld: cannot find /media/34GB/Arquivos-de-Programas-Linux/Glibc-2.17-32bit/lib/libc.so.6
collect2: error: ld returned 1 exit status


Once more, looking for libc on the old dir...
What does ldconfig tell you?
1
2
3
4
5
6
$ ldconfig -p
963 libs found in cache `/etc/ld.so.cache'
	libzstd.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libzstd.so.1
	libz.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libz.so.1
	libz.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libz.so
<<snipped>> 
It printed so many things that they did not fit on the screen, nonetheless :P

The Libc info it is:

libc.so.6 (libc6,x86-64, OS ABI: Linux 2.6.15) => /lib/libc.so.6
libc.so.6 (ELF, OS ABI: Linux 2.6.16) => /usr/lib32/libc.so.6


remembering that the libc.so.6 on /usr/lib32 is just a sym link to: /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/lib/libc.so.6

I think I will just try the brute force approach and rebuild it, this time to install it on /media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17 instead: /media/34GB/Arquivos-de-Programas-Linux/Glibc-2.17-32bit

While I think it will work, I will not learn anything from it, so if anyone has an idea, that's a good moment to speak :)
Topic archived. No new replies allowed.