[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems when linking against the profiled libc



On Sun, Dec 02, 2001, Shlomi Fish wrote about "Problems when linking against the profiled libc":
> 
> When invoking the following command:
> 
> gcc -Wall -o mptest -L. test_multi_parallel.o -lfcs -lm -pg -lc_p
> 
> I get the following error:
> 
> gcc -Wall -o mptest -L. test_multi_parallel.o -lfcs -lm -pg -lc_p
> /usr/bin/ld-real: /lib/ld-linux.so.2: indirect symbol
>...

I saw an error similar to this on my Redhat 7.2. Apparently the
glibc-profile-2.2.4-19 only contains a non-shared library (/usr/lib/libc_p.a)
and for some reason -lc_p works, but incorrectly, when ld is looking for
shared libraries (I never bothered to look for why this error is happening -
you might want to report it to Redhat's bugzilla).

Anyway, adding "-static" to the linking line fixed the problem (it also
generated a huge static executable, but that shouldn't be a problem for an
executable that was only meant for profiling).

> I checked that the problem persists with the command:
> gcc test.c -pg -lc_p

By the way, when profiling, you should also use "-g". Without debugging
information, some of the information gprof gives you (namely, in which file
each routine lives) will be wrong - and this is especially annoying when
you're profiling something with "static" functions (where a function by the
same name can come from several files).

-- 
Nadav Har'El                        |      Sunday, Dec  2 2001, 17 Kislev 5762
nyh@math.technion.ac.il             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |A Nobel Peace Prize? I would KILL for one
http://nadav.harel.org.il           |of those.

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il