public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* undefined references to `__libc_csu_fini/init when copying glibc files to /usr/lib32
@ 2023-05-29  0:25 alexandre schenberg
  2023-05-30  6:38 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: alexandre schenberg @ 2023-05-29  0:25 UTC (permalink / raw)
  To: libc-help

Hi. I installed Glibc using the prefix=/usr and DESTDIR=/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/.
Then I proceeded to create symbolic links to some of its files in /usr/lib32. They are: 
crt1.o, crti.o, crtn.o, ld-linux.so.2, libc.a, libc.so, libm.a and libc.so.

After that, I tried to cross compile a simple test program with:

 g++ -m32 -o test-32bit test-32bit.cpp

that returned:

/usr/lib/../lib32/crt1.o: In function `_start':
/media/34GB/Arquivos-de-Programas-Linux-32bit/glibc-2.17/csu/../sysdeps/i386/start.S:107: undefined reference to `__libc_csu_fini'
/media/34GB/Arquivos-de-Programas-Linux-32bit/glibc-2.17/csu/../sysdeps/i386/start.S:108: undefined reference to `__libc_csu_init'
collect2: error: ld returned 1 exit status

I then created another symbolic link in /usr/lib32 to libc_nonshared.a

However, it didn't solve the problem.

I then did a test, tried to compile the test program passing the dir where libc_nonshared.a is located with:

g++ -m32 -o test-32bit test-32bit.cpp -L/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/usr/lib/

and it returned:

/usr/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
/usr/bin/ld: cannot find /lib/libc.so.6
collect2: error: ld returned 1 exit status

I found very weird that it is looking for libc.so.6 in a directory different than the ones mentioned in prefix and DESTDIR.

Anyway, I am not sure if this is related to the __libc_csu_fini/init error messages and I am open to suggestions about how to make these symbols to be located during compilation.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: undefined references to `__libc_csu_fini/init when copying glibc files to /usr/lib32
  2023-05-29  0:25 undefined references to `__libc_csu_fini/init when copying glibc files to /usr/lib32 alexandre schenberg
@ 2023-05-30  6:38 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2023-05-30  6:38 UTC (permalink / raw)
  To: alexandre schenberg via Libc-help; +Cc: alexandre schenberg

* alexandre schenberg via Libc-help:

> I then did a test, tried to compile the test program passing the dir where libc_nonshared.a is located with:
>
> g++ -m32 -o test-32bit test-32bit.cpp -L/media/34GB/Arquivos-de-Programas-Linux-32bit/Glibc-2.17/usr/lib/
>
> and it returned:
>
> /usr/bin/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
> /usr/bin/ld: cannot find /lib/libc.so.6
> collect2: error: ld returned 1 exit status

You need to create a complete sysroot with all the startup files.  Using
-L is not enough.  You should use one of the ready-made cross-tools
scripts.

Without a proper sysroot, something like this will be required:

  Building with completely new files
  <https://sourceware.org/glibc/wiki/Testing/Builds#Build100PctNew>

Thanks,
Florian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-30  6:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29  0:25 undefined references to `__libc_csu_fini/init when copying glibc files to /usr/lib32 alexandre schenberg
2023-05-30  6:38 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).