intel / pcm

Intel® Performance Counter Monitor (Intel® PCM)
BSD 3-Clause "New" or "Revised" License
2.79k stars 476 forks source link

Build failed on RHEL 9.2. #787

Closed CHIH-CHENG-TAI closed 3 months ago

CHIH-CHENG-TAI commented 3 months ago

Hi,

I can't build it on RHEL9.2.

Steps:

  1. dnf install git cmake gcc-c++
  2. git clone https://github.com/opcm/pcm.git
  3. cd pcm
  4. mkdir build
  5. cd build
  6. cmake ..
  7. cmake --build .

This is my log:

[root@localhost build]# cmake .. -- System: Linux-5.14.0-284.11.1.el9_2.x86_64 -- Build type: Release -- initial CMAKE_CXX_FLAGS: -- initial CMAKE_C_FLAGS: -- Set LINUX_SYSTEMD=TRUE for a systemd unit file. -- CMAKE_CXX_FLAGS: -Wno-unknown-pragmas -fPIC -Wextra -DPCM_USE_PERF -Wl,-z,now -- CMAKE_C_FLAGS: -Wno-unknown-pragmas -fPIC -Wextra -DPCM_USE_PERF -Wl,-z,now -- AddressSanitizer is enabled -- To disable AddressSanitizer, use -DNO_ASAN=1 option -- CMAKE_CXX_FLAGS_RELEASE: -Wall -O3 -rdynamic -fPIE -fstack-protector -D_FORTIFY_SOURCE=2 -ftrapv -fsanitize=address -fwrapv -fno-delete-null-pointer-checks -fno-strict-overflow -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -- CMAKE_CXX_FLAGS_DEBUG: -Wall -O0 -g -rdynamic -fPIE -fstack-protector -D_FORTIFY_SOURCE=2 -ftrapv -fsanitize=address -fwrapv -fno-delete-null-pointer-checks -fno-strict-overflow -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -Wall -O3 -g -rdynamic -fPIE -fstack-protector -D_FORTIFY_SOURCE=2 -ftrapv -fsanitize=address -fwrapv -fno-delete-null-pointer-checks -fno-strict-overflow -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -- Detected Linux distribution: rhel -- Using static libasan -- To use dynamic libasan, use -DNO_STATIC_LIBASAN=1 option (required for CentOS) -- Local SIMDJSON exists: /root/pcm/src/simdjson/singleheader/simdjson.h -- Compiling with SSL support, requires libssl-dev or openssl-devel or libopenssl-devel or libopenssl-dev package installed -- To disable SSL support, use -DNO_SSL=1 option -- OpenSSL version 3.0.7 >= 1.1.1, OpenSSL support enabled -- Install directory: /usr/local -- CPACK_GENERATOR is RPM -- Configuring done (0.0s) -- Generating done (0.0s) -- Build files have been written to: /root/pcm/build [root@localhost build]# cmake --build . [ 18%] Built target PCM_STATIC [ 37%] Built target PCM_STATIC_SILENT [ 40%] Built target PCM_SHARED [ 41%] Linking CXX executable ../bin/pcm /usr/bin/ld: cannot find -lasan collect2: error: ld returned 1 exit status gmake[2]: [src/CMakeFiles/pcm.dir/build.make:98: bin/pcm] Error 1 gmake[1]: [CMakeFiles/Makefile2:260: src/CMakeFiles/pcm.dir/all] Error 2 gmake: *** [Makefile:156: all] Error 2

[root@localhost build]# rpm -qa | grep -i asan libasan-11.4.1-3.el9.x86_64

[root@localhost build]# cat /etc/redhat-release Red Hat Enterprise Linux release 9.2 (Plow)

rdementi commented 3 months ago

Hi,

could you please install libasan-static and try again?

dnf install libasan-static

does it help?

CHIH-CHENG-TAI commented 3 months ago

Hi,

No libasan-static on RHEL9 or RockyLinux9. I also install the epel-release.

[root@RockyLinux9 build]# dnf search asan Last metadata expiration check: 0:00:22 ago on Tue 16 Jul 2024 09:23:48 AM CST. =========================================================================================== Name Matched: asan =========================================================================================== gcc-toolset-12-libasan-devel.i686 : The Address Sanitizer static library gcc-toolset-12-libasan-devel.x86_64 : The Address Sanitizer static library gcc-toolset-13-libasan-devel.x86_64 : The Address Sanitizer static library gcc-toolset-13-libasan-devel.i686 : The Address Sanitizer static library libasan.x86_64 : The Address Sanitizer runtime library libasan.i686 : The Address Sanitizer runtime library libasan8.i686 : The Address Sanitizer runtime library from GCC 12 libasan8.x86_64 : The Address Sanitizer runtime library from GCC 12 rust-libsqlite3-sys+with-asan-devel.noarch : Native bindings to the libsqlite3 library rust-libsqlite3-sys0.25+with-asan-devel.noarch : Native bindings to the libsqlite3 library rust-rusqlite+with-asan-devel.noarch : Ergonomic wrapper for SQLite rust-rusqlite0.28+with-asan-devel.noarch : Ergonomic wrapper for SQLite ========================================================================================= Summary Matched: asan ========================================================================================== rust-quick-error+default-devel.noarch : Macro which makes error types pleasant to write rust-quick-error-devel.noarch : Macro which makes error types pleasant to write rust-quick-error1+default-devel.noarch : Macro which makes error types pleasant to write rust-quick-error1-devel.noarch : Macro which makes error types pleasant to write

rdementi commented 3 months ago

Hi,

thank you for checking. Perhaps installing one of the "The Address Sanitizer static library" packages can help. Too bad the packages are named so differently on various Linux distributions..

Also a workaround is possible: compiling with dynamic asan instead. For that please use the option suggested in the PCM compilation log from above: -DNO_STATIC_LIBASAN=1

git clone https://github.com/opcm/pcm.git
cd pcm
mkdir build
cd build
cmake -DNO_STATIC_LIBASAN=1 .. 
cmake --build .

Let me know if either solutions worked for you.

CHIH-CHENG-TAI commented 3 months ago

Hi,

Thanks for your help. It's worked.