NUMA-STREAM
NUMA-STREAM copied to clipboard
getting undefined reference for `pthread_*` and `numa_*`
Enviroment: OS: Ubuntu 7.5.0-3ubuntu1~18.04 gcc: 7.5.0 Packages: libnuma & libpthread are present
Logs:
/tmp/ccvrxJvo.o: In function `readProc':
stream-pthreads.c:(.text+0x7): undefined reference to `numa_run_on_node'
/tmp/ccvrxJvo.o: In function `copyProc':
stream-pthreads.c:(.text+0x77): undefined reference to `numa_run_on_node'
/tmp/ccvrxJvo.o: In function `scaleProc':
stream-pthreads.c:(.text+0xe7): undefined reference to `numa_run_on_node'
/tmp/ccvrxJvo.o: In function `addProc':
stream-pthreads.c:(.text+0x167): undefined reference to `numa_run_on_node'
/tmp/ccvrxJvo.o: In function `triadProc':
stream-pthreads.c:(.text+0x1e7): undefined reference to `numa_run_on_node'
/tmp/ccvrxJvo.o: In function `main':
stream-pthreads.c:(.text.startup+0x128): undefined reference to `numa_available'
stream-pthreads.c:(.text.startup+0x135): undefined reference to `numa_max_node'
stream-pthreads.c:(.text.startup+0x1fb): undefined reference to `numa_alloc_onnode'
stream-pthreads.c:(.text.startup+0x216): undefined reference to `numa_alloc_onnode'
stream-pthreads.c:(.text.startup+0x231): undefined reference to `numa_alloc_onnode'
stream-pthreads.c:(.text.startup+0x37b): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x391): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x39b): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x3a6): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x438): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x44e): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x458): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x463): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x4e2): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x4f8): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x502): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x50d): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x593): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x5a9): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x5b3): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x5be): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x640): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x656): undefined reference to `pthread_create'
stream-pthreads.c:(.text.startup+0x660): undefined reference to `pthread_join'
stream-pthreads.c:(.text.startup+0x66b): undefined reference to `pthread_join'
I am able to work this error around by modifying the build to gcc -O2 -std=c99 -DNUM_THREADS=$i -DMEM_OFF=0 stream-pthreads.c -lpthread -lnuma
Can you please check?
$ diff run-stream.sh-org run-stream.sh-mod
5c5
< gcc -O2 -std=c99 -lpthread -lnuma -DNUM_THREADS=$i -DMEM_OFF=0 stream-pthreads.c
---
> gcc -O2 -std=c99 -DNUM_THREADS=$i -DMEM_OFF=0 stream-pthreads.c -lpthread -lnuma
13c13
< gcc -O2 -std=c99 -lpthread -lnuma -L ../numactl-2.0.7-rc2 -DNUM_THREADS=$i -DMEM_OFF=1 stream-pthreads.c
---
> gcc -O2 -std=c99 -L ../numactl-2.0.7-rc2 -DNUM_THREADS=$i -DMEM_OFF=1 stream-pthreads.c -lpthread -lnuma
20c20
< gcc -O2 -std=c99 -lpthread -lnuma -L ../numactl-2.0.7-rc2 -DNUM_THREADS=$i -DMEM_OFF=0 -DSTRIDE=1 stream-pthreads.c
---
> gcc -O2 -std=c99 -L ../numactl-2.0.7-rc2 -DNUM_THREADS=$i -DMEM_OFF=0 -DSTRIDE=1 stream-pthreads.c -lpthread -lnuma
28c28
< gcc -O2 -std=c99 -lpthread -lnuma -L ../numactl-2.0.7-rc2 -DNUM_THREADS=$i -DMEM_OFF=1 -DSTRIDE=1 stream-pthreads.c
---
> gcc -O2 -std=c99 -L ../numactl-2.0.7-rc2 -DNUM_THREADS=$i -DMEM_OFF=1 -DSTRIDE=1 stream-pthreads.c -lpthread -lnuma
I had this same problem, thanks for posting. It seems like this should be merged.
Also, the link to libnuma provided in the README appears to be dead.
I used the code in the repo below, which is working for me.
https://github.com/numactl/numactl