building lmbench

Hey folks,

I’m trying to build lmbench and it bombs out. Looks to me like it is either
not picking up libc, or perhaps there are some functions missing from QNX
(getpagesize, among others)

make results

cd src && make results
make[1]: Entering directory /root/lmbench-3.0-a3/src' make[2]: Entering directory /root/lmbench-3.0-a3/src’
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_file_rd bw_file_rd
…c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
…/bin/x86-pc-nto-qnx/lmbench.a(lib_timing.o): In function touch': lib_timing.o(.text+0x3ba8): undefined reference to getpagesize’
collect2: ld returned 1 exit status
make[2]: *** […/bin/x86-pc-nto-qnx/bw_file_rd] Error 1
make[2]: Leaving directory /root/lmbench-3.0-a3/src' make[1]: *** [lmbench] Error 2 make[1]: Leaving directory /root/lmbench-3.0-a3/src’
make: *** [results] Error 2

You can implement getpagesize() as sysconf(_SC_PAGE_SIZE)

dB


“Alan McKay” wrote, ca. Wed, 9 Apr 2003 09:23:42 -0400:

Hey folks,

I’m trying to build lmbench and it bombs out. Looks to me like it is either
not picking up libc, or perhaps there are some functions missing from QNX
(getpagesize, among others)

make results

cd src && make results
make[1]: Entering directory /root/lmbench-3.0-a3/src' make[2]: Entering directory /root/lmbench-3.0-a3/src’
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_file_rd bw_file_rd
…c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
…/bin/x86-pc-nto-qnx/lmbench.a(lib_timing.o): In function touch': lib_timing.o(.text+0x3ba8): undefined reference to getpagesize’
collect2: ld returned 1 exit status
make[2]: *** […/bin/x86-pc-nto-qnx/bw_file_rd] Error 1
make[2]: Leaving directory /root/lmbench-3.0-a3/src' make[1]: *** [lmbench] Error 2 make[1]: Leaving directory /root/lmbench-3.0-a3/src’
make: *** [results] Error 2

You can implement getpagesize() as sysconf(_SC_PAGE_SIZE)

Thanks, but then a few other functions are missing (I tried implementing it to
just return 4096 just to see if I could build it). I’ll do this and then get back
to you with details on where it fails next.

cheers,
-Alan

OK, it gets further and here is where it now bombs :

gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_file_rd bw_file_rd
…c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_mem bw_mem.c …/bi
n/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_mmap_rd bw_mmap_rd
…c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_pipe bw_pipe.c …/
bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_tcp bw_tcp.c …/bi
n/x86-pc-nto-qnx/lmbench.a -lm -lsocket
…/bin/x86-pc-nto-qnx/lmbench.a(lib_tcp.o): In function tcp_server': lib_tcp.o(.text+0xef): undefined reference to pmap_unset’
lib_tcp.o(.text+0x108): undefined reference to pmap_set' .../bin/x86-pc-nto-qnx/lmbench.a(lib_tcp.o): In function tcp_done’:
lib_tcp.o(.text+0x14c): undefined reference to pmap_unset' .../bin/x86-pc-nto-qnx/lmbench.a(lib_tcp.o): In function tcp_connect’:
lib_tcp.o(.text+0x34f): undefined reference to pmap_getport' collect2: ld returned 1 exit status make[1]: *** [../bin/x86-pc-nto-qnx/bw_tcp] Error 1 make[1]: Leaving directory /root/lmbench-3.0-a3/src’
make: *** [lmbench] Error 2

Try adding -lrpc

dB


“Alan McKay” wrote, ca. Wed, 9 Apr 2003 10:00:47 -0400:

OK, it gets further and here is where it now bombs :

gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_file_rd bw_file_rd
…c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_mem bw_mem.c …/bi
n/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_mmap_rd bw_mmap_rd
…c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_pipe bw_pipe.c …/
bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -o …/bin/x86-pc-nto-qnx/bw_tcp bw_tcp.c …/bi
n/x86-pc-nto-qnx/lmbench.a -lm -lsocket
…/bin/x86-pc-nto-qnx/lmbench.a(lib_tcp.o): In function tcp_server': lib_tcp.o(.text+0xef): undefined reference to pmap_unset’
lib_tcp.o(.text+0x108): undefined reference to pmap_set' .../bin/x86-pc-nto-qnx/lmbench.a(lib_tcp.o): In function tcp_done’:
lib_tcp.o(.text+0x14c): undefined reference to pmap_unset' .../bin/x86-pc-nto-qnx/lmbench.a(lib_tcp.o): In function tcp_connect’:
lib_tcp.o(.text+0x34f): undefined reference to pmap_getport' collect2: ld returned 1 exit status make[1]: *** [../bin/x86-pc-nto-qnx/bw_tcp] Error 1 make[1]: Leaving directory /root/lmbench-3.0-a3/src’
make: *** [lmbench] Error 2

Try adding -lrpc

OK, now we’re a bit further along. I guess this would be obvious if I knew more about QNX
but please bear with me as I’m quite new to this. Looks like I need to include another lib.
Something for semaphores?

thanks,
-Alan

gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_ctx lat_ct
x.c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_sem lat_se
m.c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
/tmp/ccEqtKpE.o: In function initialize': /tmp/ccEqtKpE.o(.text+0x153): undefined reference to semget’
/tmp/ccEqtKpE.o(.text+0x162): undefined reference to semctl' /tmp/ccEqtKpE.o(.text+0x173): undefined reference to semctl’
/tmp/ccEqtKpE.o: In function cleanup': /tmp/ccEqtKpE.o(.text+0x1f4): undefined reference to semctl’
/tmp/ccEqtKpE.o: In function doit': /tmp/ccEqtKpE.o(.text+0x241): undefined reference to semop’
/tmp/ccEqtKpE.o: In function writer': /tmp/ccEqtKpE.o(.text+0x29c): undefined reference to semop’
/tmp/ccEqtKpE.o(.text+0x2f0): undefined reference to semop' collect2: ld returned 1 exit status make[1]: *** [../bin/x86-pc-nto-qnx/lat_sem] Error 1 make[1]: Leaving directory /root/lmbench-3.0-a3/src’
make: *** [lmbench] Error 2

Hmmm…for those, I’m guessing you may have to switch over to
the use of POSIX semaphores - see the descriptios of sem_init(),
sem_open() et al.

Perhaps someone else can comment on why semctl(), semget(), and
semop() are declared in /usr/include/sys/sem.h but not defined in
any of the standard QNX libraries.

dB


“Alan McKay” wrote, ca. Wed, 9 Apr 2003 11:25:48 -0400:


Try adding -lrpc

OK, now we’re a bit further along. I guess this would be obvious if I knew more about QNX
but please bear with me as I’m quite new to this. Looks like I need to include another lib.
Something for semaphores?

thanks,
-Alan

gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_ctx lat_ct
x.c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
gcc -O -DRUSAGE -DHAVE_DRAND48 -DHAVE_RAND -DHAVE_RANDOM -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_sem lat_se
m.c …/bin/x86-pc-nto-qnx/lmbench.a -lm -lsocket
/tmp/ccEqtKpE.o: In function initialize': /tmp/ccEqtKpE.o(.text+0x153): undefined reference to semget’
/tmp/ccEqtKpE.o(.text+0x162): undefined reference to semctl' /tmp/ccEqtKpE.o(.text+0x173): undefined reference to semctl’
/tmp/ccEqtKpE.o: In function cleanup': /tmp/ccEqtKpE.o(.text+0x1f4): undefined reference to semctl’
/tmp/ccEqtKpE.o: In function doit': /tmp/ccEqtKpE.o(.text+0x241): undefined reference to semop’
/tmp/ccEqtKpE.o: In function writer': /tmp/ccEqtKpE.o(.text+0x29c): undefined reference to semop’
/tmp/ccEqtKpE.o(.text+0x2f0): undefined reference to semop' collect2: ld returned 1 exit status make[1]: *** [../bin/x86-pc-nto-qnx/lat_sem] Error 1 make[1]: Leaving directory /root/lmbench-3.0-a3/src’
make: *** [lmbench] Error 2

Alan McKay <zymurgy_nukethis@nukethistoo_nortelnetworks.com> wrote:

Hey folks,

I’m trying to build lmbench and it bombs out. Looks to me like it is either
not picking up libc, or perhaps there are some functions missing from QNX
(getpagesize, among others)

Just an FYI on lmbench. It has MANY assumptions about running on a monolithic
kernel. For example, that getpid() is a system call (simple) and can be used
for testing system call overhead. This is not the case on QNX. So you will
get some numbers that will appear to be out-of-whack and that is becaue they
are! :slight_smile:

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

So up til now that was lmbench v 3.0 (alpha). Both 2.0.4 and 3.0 showed the same ‘getpagesize’
problem, but based on the current roadblock I went back to 2.0.4 and implemented your fix
for that, and also included -lrpc, and it builds quite far but then blows up in a different manner
than 3.0 did :

gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/timing_o timing_o.c …/bin/x86-pc-nto-qnx/lmbench.a -l
socket
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/enough enough.c …/bin/x86-pc-nto-qnx/lmbench.a -lsock
et
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/msleep msleep.c
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/loop_o loop_o.c …/bin/x86-pc-nto-qnx/lmbench.a -lsock
et
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_fifo lat_fifo.c …/bin/x86-pc-nto-qnx/lmbench.a -l
socket
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lmhttp lmhttp.c …/bin/x86-pc-nto-qnx/lmbench.a -lsock
et
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_http lat_http.c …/bin/x86-pc-nto-qnx/lmbench.a -l
socket
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_unix_connect lat_unix_connect.c …/bin/x86-pc-nto-
qnx/lmbench.a -lsocket
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_fcntl lat_fcntl.c …/bin/x86-pc-nto-qnx/lmbench.a
-lsocket
lat_fcntl.c:16: lock' redeclared as different kind of symbol /usr/include/unistd.h:449: previous declaration of lock’
lat_fcntl.c:16: unlock' redeclared as different kind of symbol /usr/include/unistd.h:464: previous declaration of unlock’
make[1]: *** […/bin/x86-pc-nto-qnx/lat_fcntl] Error 1
make[1]: Leaving directory `/root/lmbench-2.0.4/src’
make: *** [lmbench] Error 2

You’ll just want to rename the local definitions of ‘lock’ and
‘unlock’ in lat_fnctl.c that are conflicting with the ones in
/usr/include/unistd.h, preferably by using a single #define for
each.

dB


“Alan McKay” wrote, ca. Wed, 9 Apr 2003 13:57:35 -0400:


So up til now that was lmbench v 3.0 (alpha). Both 2.0.4 and 3.0 showed the same ‘getpagesize’
problem, but based on the current roadblock I went back to 2.0.4 and implemented your fix
for that, and also included -lrpc, and it builds quite far but then blows up in a different manner
than 3.0 did :

gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/timing_o timing_o.c …/bin/x86-pc-nto-qnx/lmbench.a -l
socket
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/enough enough.c …/bin/x86-pc-nto-qnx/lmbench.a -lsock
et
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/msleep msleep.c
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/loop_o loop_o.c …/bin/x86-pc-nto-qnx/lmbench.a -lsock
et
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_fifo lat_fifo.c …/bin/x86-pc-nto-qnx/lmbench.a -l
socket
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lmhttp lmhttp.c …/bin/x86-pc-nto-qnx/lmbench.a -lsock
et
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_http lat_http.c …/bin/x86-pc-nto-qnx/lmbench.a -l
socket
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_unix_connect lat_unix_connect.c …/bin/x86-pc-nto-
qnx/lmbench.a -lsocket
gcc -O -DRUSAGE -lc -lrpc -o …/bin/x86-pc-nto-qnx/lat_fcntl lat_fcntl.c …/bin/x86-pc-nto-qnx/lmbench.a
-lsocket
lat_fcntl.c:16: lock' redeclared as different kind of symbol /usr/include/unistd.h:449: previous declaration of lock’
lat_fcntl.c:16: unlock' redeclared as different kind of symbol /usr/include/unistd.h:464: previous declaration of unlock’
make[1]: *** […/bin/x86-pc-nto-qnx/lat_fcntl] Error 1
make[1]: Leaving directory `/root/lmbench-2.0.4/src’
make: *** [lmbench] Error 2