On Thu, 4 Mar 2021, RVP wrote:
On Wed, 3 Mar 2021, Christos Zoulas wrote:
If you compile with -Bstatic -lc_g -Bdynamic explicitly I think it works.
So perhaps there is a libc issue.
Err -Bstatic -lc_p -Bdynamic
If this is the command you meant, then it doesn't work either:
$ cc -g -pg t.c -Bstatic -lc_p -Bdynamic -lcurses
ld: /usr/lib/libc.so.12: warning: warning: __findenv is an internal obsolete
function.
$ ./a.out
Segmentation fault (core dumped)
$
However, this works:
$ cc -g -pg t.c -Bstatic -lc -Bdynamic -lcurses
$ ldd a.out
a.out:
-lc.12 => /usr/lib/libc.so.12
-lcurses.8 => /usr/lib/libcurses.so.8
-lterminfo.1 => /usr/lib/libterminfo.so.1
$ ./a.out
hello world
$ ls -l gmon.out
-rw------- 1 rvp wheel 584 Mar 4 09:12 gmon.out
$ gprof a.out gmon.out
...
Index by function name
[1] main
$
No segfault; but, no profiling data either ;)
-RVP