LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   undefined reference to `__libc_csu_fini' (https://www.linuxquestions.org/questions/linux-general-1/undefined-reference-to-%60__libc_csu_fini-849247/)

akonchada 12-09-2010 06:03 AM

undefined reference to `__libc_csu_fini'
 
Hello,

I am getting the bellow linker error with GCC 4.4 and GLIBC 2.12.

1. /usr/lib/../lib64/crt1.o: In function `_start': (.text+0x12): undefined reference to `__libc_csu_fini'
2. /usr/lib/../lib64/crt1.o: In function `_start': (.text+0x19): undefined reference to `__libc_csu_init'

Any help on what is wrong here? Did I miss some package?

Best Regards,
Ananth

ozanbaba 12-09-2010 07:23 AM

Miscompiled glibc
Too much striped glibc
Wrong LDFLAGS

That's what coming to my mind right way.

My system's crt1.o is not striped at all (SLackware64 13.1 Multilib) by the way.

akonchada 12-09-2010 08:14 AM

Can you please elaborate on miscompiled glibc and too much striped glibc and what should I do for right glibc?
I have installed GLIBC 2.12 version and all libraries from there are taken.

Best Regards,
Ananth

ozanbaba 12-09-2010 12:03 PM

Looking my system crt1.o with objdump and __libc_csu_fini and __libc_csu_init are there.

Check out the crt1.o yourself with objdump and see if it's there.
If it's there, Check your LDFLAGS. IT might be the problem.

akonchada 12-09-2010 11:46 PM

Thanks for your support,

Here is my objdump of crt1.o (for simplicity i am pasting only the problematic area)

0000000000000000 *UND* 0000000000000000 __libc_csu_fini
0000000000000000 g F .text 0000000000000000 _start
0000000000000000 *UND* 0000000000000000 __libc_csu_init
0000000000000000 *UND* 0000000000000000 main
0000000000000000 w .data 0000000000000000 data_start
0000000000000000 g O .rodata.cst4 0000000000000004 _IO_stdin_used
0000000000000000 *UND* 0000000000000000 __libc_start_main
0000000000000000 g .data 0000000000000000 __data_start

Symbols (__libc_csu_fini and __libc_start_main) with which I am facing issue are marked as UND (undefined), does this mean that my crt1.0 is wrong?
If so my GLIBC is installation is wrong? I am new to Linux and trying to debug these system errors for first time.

Best Regards,
Anant

Valery Reznic 12-10-2010 02:02 AM

Quote:

Originally Posted by akonchada (Post 4185739)
Hello,

I am getting the bellow linker error with GCC 4.4 and GLIBC 2.12.

1. /usr/lib/../lib64/crt1.o: In function `_start': (.text+0x12): undefined reference to `__libc_csu_fini'
2. /usr/lib/../lib64/crt1.o: In function `_start': (.text+0x19): undefined reference to `__libc_csu_init'

Any help on what is wrong here? Did I miss some package?

Best Regards,
Ananth

What command do you use for link?

akonchada 12-10-2010 02:34 AM

Hello,

I am using g++ as bellow,

g++ -o XXX -lstdc++ -rdynamic -mt -L/usr/lib/x86_64-redhat-linux5E/lib64 -L/usr/lib64 -L-m64 -lpthread -lrt -lssl -lcrypto -lappllib -lnsl -lpthread -lresolv -lrt -lm -ldl -lmp

it is from gcc 4.4 version and i am getting bellow linker errors.

/usr/lib/../lib64/crt1.o: In function `_start': (.text+0x12): undefined reference to `__libc_csu_fini'
/usr/lib/../lib64/crt1.o: In function `_start': (.text+0x19): undefined reference to `__libc_csu_init'

Best Regards,
Ananth

akonchada 12-10-2010 10:47 AM

Hello,

My problem is solved, I missed /lib64 path in my linker LD_LIBRARY_PATH and that is the reason why these symbols are not visible.
Another issue is libc.so and libpthread.so for lib64 are not binary files instead they are ASCII file. There is a pointer in thes files
to pick the binary file ffom /lib64 where I have different content than expected.

Solution is, as I don't have /lib64 in my system (I have separate tool set where I place all lib64 libraries) I gave right file path in both ASCII file (libc.so and libpthread.so).

Best Regards,
Ananth

DGPickett 01-18-2012 01:58 PM

I got burnt when I was moving libraries around, as the missing objects are in libc_nonshared.a, linked in by this cute bit, a text *.so:

Code:

$ cat /usr/lib64/libc.so
/* GNU ld script
  Use the shared library, but some functions are only in
  the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a  AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )



All times are GMT -5. The time now is 04:41 AM.