SUMMARY: Code Profiling

From: Jesús Cea Avión (jcea@argo.es)
Date: Tue Oct 13 1998 - 13:08:06 CDT


Thanks to:

Nicolas De Rico <derico@exmast.drea.dnd.ca>
Ian Collins <itc@orl.co.uk>
Russ Poffenberger <poffen@san-jose.tt.slb.com>

Russ said:

Try adding "-ldl" to the end of the command, ie..

gcc -Wall -pg conexiones.c -o conexiones -ldl

The explanation is that normally you link in the dynamic libc (libc.so) which automatically references the
dynamic loader library (libdl.so). When profiling, you link in the static libc (libc.a) which cannot automatically
grab the dynamic loader (libdl.so) so you have to specify it manually.

Mi original question, was:
 
> I'm trying to profile a CPU-intensive program written in C. Compiling
> as usual (gcc -Wall conexiones.c -o conexiones) is fine, but if I try
> to compile it using the "profiling" options, it fails:
>
> # gcc -Wall -pg conexiones.c -o conexiones
> /usr/lib/libp/libc.a(nss_deffinder.o): In function `SO_per_src_lookup':
> nss_deffinder.o(.text+0x80): undefined reference to `dlopen'
> nss_deffinder.o(.text+0xb0): undefined reference to `dlsym'
> nss_deffinder.o(.text+0xc4): undefined reference to `dlclose'
> /usr/lib/libp/libc.a(nss_deffinder.o): In function `SO_per_src_delete':
> nss_deffinder.o(.text+0x10c): undefined reference to `dlclose'
>
> # gcc -Wall -p conexiones.c -o conexiones
> /usr/local/sparc-sun-solaris2.5.1/bin/ld: cannot open mcrt1.o: No such file or directory
>
> Solaris 2.5.1, with all patches applied.
>
> Any idea?.

-- 
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea@argo.es http://www.argo.es/~jcea/ _/_/    _/_/  _/_/    _/_/  _/_/
                                      _/_/    _/_/          _/_/_/_/_/
PGP Key Available at KeyServ   _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibnitz



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:50 CDT