Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2006 11:44:54 -0300
From:      "Alexandre Biancalana" <biancalana@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   gprof
Message-ID:  <8e10486b0604190744q124cf7c7j54524d2e4f0368d8@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi list,

  I'm trying to compile my C application with gprof but it is not working.
This is a multithreaded program that use mysql and openssl libraries.
  Reading the man page I see that is need add -pg to the compile command
line, but when a do this the following error occurs at linking time

$ gcc -L/usr/local/lib/mysql -Wall -I. -I.. -I/usr/local/include/mysql -o
serverd ../log.o ../mem.o ../misc.o ../threads_wrapper.o ../openssl.o db.o
main.o request.o ssl_server.o ssl_socket.o threads.o threads_control.o
-pthread -lmysqlclient_r -lssl -pg
/lib/libcrypto.so.4: undefined reference to `sysconf'
/lib/libcrypto.so.4: undefined reference to `times'
/lib/libz.so.3: undefined reference to `feof'
/lib/libm.so.4: undefined reference to `ldexp'
/lib/libcrypto.so.4: undefined reference to `chmod'
/lib/libz.so.3: undefined reference to `clearerr'
/lib/libm.so.4: undefined reference to `isnan'
*** Error code 1

Stop in /usr/home/ale/personal/ale_projects/works/program/server.

I tried to substitute the -pg compiler flag by -lc_p, with this flag the
program compile but is not linked with libc_p and don't generate the gprof
output file...

$ gcc -L/usr/local/lib/mysql -Wall -I. -I.. -I/usr/local/include/mysql -lc_=
p
-o serverd ../log.o ../mem.o ../misc.o ../threads_wrapper.o ../openssl.o
db.o main.o request.o ssl_server.o ssl_socket.o threads.o threads_control.o
-pthread -lmysqlclient_r -lssl
/usr/lib/libc.so: warning: warning: this program uses f_prealloc(), which i=
s
not recommended.

$ ldd serverd
serverd:
        libmysqlclient_r.so.14 =3D>
/usr/local/lib/mysql/libmysqlclient_r.so.14 (0x28099000)
        libssl.so.4 =3D> /usr/lib/libssl.so.4 (0x280ed000)
        libpthread.so.2 =3D> /usr/lib/libpthread.so.2 (0x2811b000)
        libc.so.6 =3D> /lib/libc.so.6 (0x28140000)
        libcrypto.so.4 =3D> /lib/libcrypto.so.4 (0x28217000)
        libcrypt.so.3 =3D> /lib/libcrypt.so.3 (0x28309000)
        libm.so.4 =3D> /lib/libm.so.4 (0x28321000)
        libz.so.3 =3D> /lib/libz.so.3 (0x28337000)


This is my system:
FreeBSD Cruel 6.0-STABLE FreeBSD 6.0-STABLE #0: Tue Jan  3 15:40:07 UTC
2006     root@Cruel:/usr/src/sys/i386/compile/CRUEL  i386

  Any ideas ?


 Best Regards,
Alexandre Biancalana



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8e10486b0604190744q124cf7c7j54524d2e4f0368d8>