intel / lmbench

GNU General Public License v2.0
281 stars 124 forks source link

build fail undefined reference to PMAP #21

Open jrgruher opened 1 year ago

jrgruher commented 1 year ago

Testing on Ubuntu 22.04 with GCC12. Cloned git, cd src, make (or 'make results').

First I hit this issue, followed these steps to work around: https://github.com/intel/lmbench/issues/16

Now I get this failure:

root@ce-2-jrgruher:~/lmbench/src# make results LDFLAGS=-ltirpc
gmake[1]: Entering directory '/root/lmbench/src'
cc -O -DRUSAGE -DHAVE_uint=1 -DHAVE_int64_t=1 -DHAVE_DRAND48 -DHAVE_SCHED_SETAFFINITY=1  -ltirpc -o ../bin/x86_64-linux-gnu/bw_tcp bw_tcp.c ../bin/x86_64-linux-gnu/lmbench.a -lm
bw_tcp.c: In function ‘main’:
bw_tcp.c:74:44: warning: implicit declaration of function ‘lmbench_usage’ [-Wimplicit-function-declaration]
   74 |                         if (parallel <= 0) lmbench_usage(ac, av, usage);
      |                                            ^~~~~~~~~~~~~
bw_tcp.c: In function ‘initialize’:
bw_tcp.c:142:25: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘int’ [-Wformat=]
  142 |         sprintf(buf, "%lu", state->msize);
      |                       ~~^   ~~~~~~~~~~~~
      |                         |        |
      |                         |        int
      |                         long unsigned int
      |                       %u
bw_tcp.c: In function ‘main’:
bw_tcp.c:63:25: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   63 |                         write(conn, "0", 1);
      |                         ^~~~~~~~~~~~~~~~~~~
/usr/bin/ld: ../bin/x86_64-linux-gnu/lmbench.a(lib_tcp.o): in function `tcp_done':
lib_tcp.c:(.text+0x1b): undefined reference to `pmap_unset'
/usr/bin/ld: ../bin/x86_64-linux-gnu/lmbench.a(lib_tcp.o): in function `tcp_connect':
lib_tcp.c:(.text+0x3bd): undefined reference to `pmap_getport'
/usr/bin/ld: ../bin/x86_64-linux-gnu/lmbench.a(lib_tcp.o): in function `tcp_server':
lib_tcp.c:(.text+0x5cd): undefined reference to `pmap_unset'
/usr/bin/ld: lib_tcp.c:(.text+0x5e9): undefined reference to `pmap_set'
collect2: error: ld returned 1 exit status
gmake[1]: *** [Makefile:311: ../bin/x86_64-linux-gnu/bw_tcp] Error 1
gmake[1]: Leaving directory '/root/lmbench/src'
make: *** [Makefile:114: lmbench] Error 2
root@ce-2-jrgruher:~/lmbench/src# 
gipi commented 1 year ago

Probably is sufficient to indicate such library in the build script

diff --git a/scripts/build b/scripts/build
index 16a6600..561cdb3 100755
--- a/scripts/build
+++ b/scripts/build
@@ -18,7 +18,7 @@ done

 trap 'rm -f ${BASE}$$.s ${BASE}$$.c ${BASE}$$.o ${BASE}$$; exit 1' 1 2 15

-LDLIBS=-lm
+LDLIBS="-lm -ltirpc"

 # check for HP-UX's ANSI compiler
 echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
rajesh-s commented 2 months ago

@jrgruher were you able to get around thsi?

jrgruher commented 2 months ago

@rajesh-s No, not as far as I can recall