linker errors when compiling and linking with a new glibc

Daniel De La Zerda ddelazerda007@yahoo.com
Wed Mar 18 17:34:00 GMT 2009


Right before you responded I was looking at how new functions would be exported as an external symbol. I didn't know that Versions file did that job. Thanks for the the help! I have another problem now. I have a test program that uses "pthread_foo_init()", now that I got rid of the "undefined reference error" it compiles fine, but when I run the executable with testrun.sh I get the error "libgcc_s.so.1 must be installed for pthread_cancel to work", I haven't installed my new glibc yet and I wouldn't wanna do it just yet until I fully test my change. 

I have another question...How do I make sure that when I install this new glibc on my system, "foo.h" will be in "/usr/include/foo.h"? 

Thanks again for the help!

Daniel



----- Original Message ----
From: Ryan Arnold <ryan.arnold@gmail.com>
To: Daniel De La Zerda <danieldelazerda@gmail.com>
Cc: libc-help@sourceware.org
Sent: Wednesday, March 18, 2009 12:51:47 PM
Subject: Re: linker errors when compiling and linking with a new glibc

On Mon, Mar 16, 2009 at 6:16 PM, Daniel De La Zerda
<ddelazerda007@yahoo.com> wrote:
>
> I'm new to this so please be patient. I added a function pthread_foo_init() in foo.c with it's respective foo.h under the nptl directory. Then edited the Makefile inside the same directory to reflect these changes. After this I ran make and my new glibc built with no errors at all. I have the libc.so under the main directory of the glibc tree and libpthread.so under nptl. If I do a "nm libpthread.so | grep pthread_mutex_init" I see that the pthread_mutex_init symbol is global and not static - indicated by the "T" right before the function name. When I do "nm libpthread.so | grep pthread_foo_init" I see that it has a "t", and if I'm not mistaken, this means that it is local and static and that it cannot be seen by the outside world. Hence that's why I think I get linker errors when I try to compile a test program that uses my "pthread_foo_init()" saying that I have an "undefined reference to `pthread_foo_init`". Does anyone have any idea how I can solve
>  this problem?

Daniel,

Did you add pthread_foo_init to the export list in the nptl Versions file?

If not, then you won't get an external symbol for it.

Regards,
Ryan S. Arnold



      



More information about the Libc-help mailing list