Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Dec 2010
compilation error while building simple stack backtrace program on freebsd
I am trying to build a sample stackback trace program for knowing the backtrace of a function flow.
please let me know am i missing anything here.
since i am new to FreeBSD, i am not able to find the error cause for this compilation error.
your help will me much appreciated .
here is my code and gcc commands i have used
/* Obtain a backtrace and print it to stdout. */
size = backtrace (array, 10);
strings = backtrace_symbols (array, size);
printf ("Obtained %zd stack frames.\n", size);
for (i = 0; i < size; i++)
printf ("%s\n", strings[i]);
/* A dummy function to make the backtrace more interesting. */
if i use below gcc command i am getting the error as below
#gcc back_trace.c -o bt -g -lexecinfo -I /usr/local/include
/usr/bin/ld: cannot find -lexecinfo
if i use this gcc the error is different.
#gcc back_trace.c -o bt -g -I /usr/local/include
/var/tmp//cc2E2nn3.o(.text+0x10): In function `print_trace':
/var/krnaidu/my_sample/back_trace.c:15: undefined reference to `backtrace'
/var/tmp//cc2E2nn3.o(.text+0x25):/var/krnaidu/my_sample/back_trace.c:16: undefined reference to `backtrace_symbols'
please let me know which command is correct and how to solve this issue.
Thanks in advance.
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
Ok. First, this is a LINUX kernel forum - BSD kernels are NOT Linux kernels. So, try going to a BSD support forum for this information. It will likely be very different from what you need to do in Linux.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!