RRZE-HPC / likwid

Performance monitoring and benchmarking suite
https://hpc.fau.de/research/tools/likwid/
GNU General Public License v3.0
1.65k stars 226 forks source link

Failed building likwid-bench #120

Closed stefanos1316 closed 6 years ago

stefanos1316 commented 6 years ago

Hello there,

I am using trying to install your software on my HP elitebook (CPU family Skylake) and upon running make command I received the following error:

===> CREATE SHARED LIB liblikwid.so ===> ENTER bench ===> LINKING likwid-bench gcc -O2 -std=c99 -Wno-format -fPIC -fPIC -DPAGE_ALIGNMENT=4096 -DLIKWID_MONITOR_LOCK -DDEBUGLEV=0 -DVERSION=4 -DRELEASE=2 -DCFGFILE=/etc/likwid.cfg -DTOPOFILE=/etc/likwid_topo.cfg -DINSTALL_PREFIX=/usr/local -DMAX_NUM_THREADS=263 -DMAX_NUM_NODES=64 -DACCESSDAEMON=/usr/local/sbin/likwid-accessD -DGROUPPATH=/usr/local/share/likwid/perfgroups -DLIKWIDLOCK=/var/run/likwid.lock -DLIKWIDSOCKETBASE=/tmp/likwid -D_GNU_SOURCE -DCOLOR=BLUE -DHAS_MEMPOLICY -DHAS_SCHEDAFFINITY -DLIKWID_USE_HWLOC -DACCESSMODE=1 -I./includes -I./GCC -I../src/includes -pthread likwid-bench.c ./GCC/update_avx.o ./GCC/stream_sp.o ./GCC/triad_sp_mem_sse_fma.o ./GCC/stream_sp_avx_fma.o ./GCC/daxpy_sp_sse.o ./GCC/stream_mem_sse.o ./GCC/clstore.o ./GCC/stream_sp_avx.o ./GCC/triad_sse_fma.o ./GCC/daxpy_avx_fma.o ./GCC/store.o ./GCC/store_mem_sse.o ./GCC/triad_sp_avx_fma.o ./GCC/triad_mem_avx.o ./GCC/clload.o ./GCC/daxpy_sp_mem_sse.o ./GCC/stream_sp_mem_avx.o ./GCC/stream.o ./GCC/triad_mem_sse_fma.o ./GCC/daxpy_mem_avx_fma.o ./GCC/stream_avx512.o ./GCC/stream_avx.o ./GCC/load.o ./GCC/sum_sp_sse.o ./GCC/stream_sp_mem_sse_fma.o ./GCC/store_avx512.o ./GCC/store_avx.o ./GCC/load_avx512.o ./GCC/sum_avx512.o ./GCC/daxpy_sp.o ./GCC/stream_mem.o ./GCC/stream_sse_fma.o ./GCC/ddot_sp_sse.o ./GCC/triad_sp_mem_avx_fma.o ./GCC/stream_sp_mem_avx_fma.o ./GCC/triad_sp_sse.o ./GCC/daxpy_mem_sse.o ./GCC/store_mem.o ./GCC/daxpy_sp_avx.o ./GCC/stream_mem_avx.o ./GCC/load_mem.o ./GCC/copy_avx512.o ./GCC/sum_sse.o ./GCC/daxpy_sp_mem_avx_fma.o ./GCC/clcopy.o ./GCC/store_mem_avx.o ./GCC/triad_sp_sse_fma.o ./GCC/triad_sp_mem_sse.o ./GCC/daxpy_sse.o ./GCC/stream_mem_sse_fma.o ./GCC/stream_sp_sse_fma.o ./GCC/daxpy_sse_fma.o ./GCC/daxpy_sp_mem_avx.o ./GCC/daxpy.o ./GCC/ddot_sse.o ./GCC/triad_mem_avx_fma.o ./GCC/triad_avx_fma.o ./GCC/sum_sp.o ./GCC/copy_sse.o ./GCC/update_sse.o ./GCC/triad_sse.o ./GCC/daxpy_sp_sse_fma.o ./GCC/daxpy_avx512.o ./GCC/daxpy_avx.o ./GCC/daxpy_sp_mem_sse_fma.o ./GCC/sum_sp_avx.o ./GCC/ddot_sp.o ./GCC/load_avx.o ./GCC/copy.o ./GCC/stream_sp_sse.o ./GCC/update_avx512.o ./GCC/triad_sp.o ./GCC/stream_avx_fma.o ./GCC/ddot_sp_avx.o ./GCC/triad_avx.o ./GCC/copy_avx.o ./GCC/triad_mem_sse.o ./GCC/triad_sp_avx.o ./GCC/daxpy_mem_avx.o ./GCC/sum.o ./GCC/triad.o ./GCC/copy_mem.o ./GCC/stream_sp_mem_sse.o ./GCC/daxpy_mem_sse_fma.o ./GCC/sum_avx.o ./GCC/daxpy_sp_avx_fma.o ./GCC/stream_mem_avx_fma.o ./GCC/ddot.o ./GCC/copy_mem_avx.o ./GCC/stream_sse.o ./GCC/update.o ./GCC/triad_sp_mem_avx.o ./GCC/triad_avx512.o ./GCC/ddot_avx512.o ./GCC/ddot_avx.o ./GCC/store_sse.o ./GCC/copy_mem_sse.o ./GCC/load_sse.o ./GCC/strUtil.o ./GCC/allocator.o ./GCC/threads.o ./GCC/barrier.o ./GCC/bstrlib.o ./GCC/bench.o -o likwid-bench -L.. -L../ext/hwloc/ -L/home/sgeorgiou/GitHub/likwid-stable/likwid-4.2.1/bench/ext/lua -llikwid -llikwid-hwloc -llikwid-lua -lm -lrt -L. -pthread -lm -ldl -Wl,-rpath=/usr/local/lib /bin/ld: cannot find -llikwid-lua collect2: error: ld returned 1 exit status Makefile:95: recipe for target 'likwid-bench' failed make[1]: [likwid-bench] Error 1 Makefile:184: recipe for target 'bench/likwid-bench' failed make: [bench/likwid-bench] Error 2

Any idea how can I work around this issue?

Kind Regards, Stefanos Geogriou

TomTheBear commented 6 years ago

Are you doing an initial build, so no LIKWID already installed on the system? Or is there an older version installed?

Are you using the internal Lua or configured LIKWID to use the system Lua?

Do you see in the build process something like:

===>  ENTER  /tmp/likwid/ext/lua

Strange is, that it searches for the Lua library in /home/sgeorgiou/GitHub/likwid-stable/likwid-4.2.1/bench/ext/lua as it should only be /home/sgeorgiou/GitHub/likwid-stable/likwid-4.2.1/ext/lua. How did you call make? Maybe like this:

cd /home/sgeorgiou/GitHub/likwid-stable/likwid-4.2.1/bench
make -C ..

This leads to a wrong detection of the LIKWID_SRC_DIR as it takes the current path, so /home/sgeorgiou/GitHub/likwid-stable/likwid-4.2.1/bench/ instead of /home/sgeorgiou/GitHub/likwid-stable/likwid-4.2.1/.

If you have built it once and changed something in config.mk afterwards, you have to do a make distclean before calling make again.

stefanos1316 commented 6 years ago

Yes, I do an initial build on my systems. I never installed this software before. I am not sure which Lua I am using, however, while building (I now cloned the git repo) I get the following message:

===> ENTER ext/hwloc ===> ENTER /home/sgeorgiou/GitHub/likwid/ext/lua ===> CREATE SHARED LIB liblikwid.so ===> CREATE LIB liblikwidpin.so make[1]: Entering directory '/home/sgeorgiou/GitHub/likwid/src/pthread-overload' make[1]: Leaving directory '/home/sgeorgiou/GitHub/likwid/src/pthread-overload' ===> ADJUSTING likwid-perfctr ===> ADJUSTING likwid-pin ===> ADJUSTING likwid-powermeter ===> ADJUSTING likwid-topology ===> ADJUSTING likwid-memsweeper ===> ADJUSTING likwid-agent ===> ADJUSTING likwid-mpirun ===> ADJUSTING likwid-features ===> ADJUSTING likwid-perfscope ===> ADJUSTING likwid-genTopoCfg ===> ADJUSTING likwid-setFrequencies ===> ADJUSTING likwid.lua ===> BUILD access daemon likwid-accessD make[1]: Entering directory '/home/sgeorgiou/GitHub/likwid/src/access-daemon' make[1]: Leaving directory '/home/sgeorgiou/GitHub/likwid/src/access-daemon' ===> BUILD frequency daemon likwid-setFreq make[1]: Entering directory '/home/sgeorgiou/GitHub/likwid/src/access-daemon' make[1]: Leaving directory '/home/sgeorgiou/GitHub/likwid/src/access-daemon' ===> ENTER bench

and in the end, the build process fails

/bin/ld: cannot find -llikwid-lua collect2: error: ld returned 1 exit status Makefile:95: recipe for target 'likwid-bench' failed make[1]: *** [likwid-bench] Error 1 Makefile:190: recipe for target 'bench/likwid-bench' failed make: *** [bench/likwid-bench] Error 2

I called the make function like: cd /home/sgeorgiou/GitHub/likwid sudo make

I haven't changed anything in the config.mk or any other file after cloning the new repo.

TomTheBear commented 6 years ago

I have to dig deeper to find the reason for your problem. Have you checked whether it still uses the library path /home/sgeorgiou/GitHub/likwid/bench/ext/lua when linking likwid-bench ?

Just as a quick guess, call make without sudo.

cd /home/sgeorgiou/GitHub/likwid
make distclean
make
sudo make install

My first tests didn't reveal any problems:

$ cd /tmp
$ git clone https://github.com/RRZE-HPC/likwid
$ cd /tmp/likwid/; sudo make
[...]
===>  LINKING  likwid-bench
$

But when I do that in my home, I get an error because "root" is not allowed to create files there. At least I found a machine where it has problems but doesn't break the make process:

$ cd /tmp/
$ git clone https://github.com/RRZE-HPC/likwid
$ cd /tmp/likwid/; sudo make
[...]
===>  LINKING  likwid-bench
/usr/bin/ld: warning: liblikwid-lua.so.4.3, needed by ../liblikwid.so, not found (try using -rpath or -rpath-link)
$

I think the problem is that sudo resets some environment variable to a secure state, so running make without sudo should work.

stefanos1316 commented 6 years ago

And you are absolutely right Thomas, about sudo resets environment variables. After I make without sudo it worked properly and I can use your software.

Thanks a lot for your time and help :)