gprof
Alexandre Biancalana
biancalana at gmail.com
Wed Apr 19 14:44:56 UTC 2006
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 is
not recommended.
$ ldd serverd
serverd:
libmysqlclient_r.so.14 =>
/usr/local/lib/mysql/libmysqlclient_r.so.14 (0x28099000)
libssl.so.4 => /usr/lib/libssl.so.4 (0x280ed000)
libpthread.so.2 => /usr/lib/libpthread.so.2 (0x2811b000)
libc.so.6 => /lib/libc.so.6 (0x28140000)
libcrypto.so.4 => /lib/libcrypto.so.4 (0x28217000)
libcrypt.so.3 => /lib/libcrypt.so.3 (0x28309000)
libm.so.4 => /lib/libm.so.4 (0x28321000)
libz.so.3 => /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 at Cruel:/usr/src/sys/i386/compile/CRUEL i386
Any ideas ?
Best Regards,
Alexandre Biancalana
More information about the freebsd-questions
mailing list