Intel® HPC Toolkit
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2140 Discussions

Linking to Intel libVT in CMake results with undefined references to _VT_em64t_*

thrudprimrose
Beginner
421 Views

I am using CMake to link to libVT.so for tracing, the MPI implementation used does not need to be intel-mpi therefore I am linking the required libraries with CMake.

 

I have the following file the define the VT target:

 

include(FindPackageHandleStandardArgs)

find_path(VT_INCLUDE_DIR NAMES VT.h)
find_library(VT_LIBRARY NAMES libVT.so liVT.a VT)

mark_as_advanced(VT_LIBRARY VT_INCLUDE_DIR)

find_package_handle_standard_args(VT
DEFAULT_MSG
VT_INCLUDE_DIR
VT_LIBRARY
)


if(VT_FOUND)
set(VT_LIBRARIES ${VT_LIBRARY})
set(VT_INCLUDE_DIRS ${VT_INCLUDE_DIR})
endif()

if(VT_FOUND AND NOT TARGET VT::VT)
add_library(VT::VT UNKNOWN IMPORTED)
set_target_properties(VT::VT PROPERTIES
IMPORTED_LOCATION "${VT_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_VT_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${VT_INCLUDE_DIR}"
)

find_library(DWARF_LIBRARY NAMES libdwarf.a dwarf)
find_library(ELF_LIBRARY NAMES libelf.a elf)
find_library(VTUNWIND NAMES libvtunwind.a vtunwind)

target_link_libraries(VT::VT INTERFACE ${DWARF_LIBRARY} ${ELF_LIBRARY} MPI::MPI_CXX)
endif()


I then link with the created VT target with:
 
target_link_directories(TARGET1 PRIVATE VT::VT)
target_include_directories(TARGET1 ${VT_INCLUDE_DIRS})
 
 
The build system resolves the includes, but the linking fails with the following error:
 
/usr/bin/ld: /home/primrose/installed/spack/opt/spack/linux-ubuntu22.04-zen3/oneapi-2022.1.0/intel-oneapi-itac-2021.6.0-p2qb5a64gf7tj3qqvawkc7vi2vfeubsw/itac/2021.6.0/lib/libVT.a(pc.pic.o): in function `VT_Pc_get':
pc.c:(.text+0x2ea): undefined reference to `_VT_em64t_init_init_signal_region'
/usr/bin/ld: pc.c:(.text+0x36a): undefined reference to `_VT_em64t_get_reg'
/usr/bin/ld: pc.c:(.text+0x701): undefined reference to `_VT_em64t_init_local'
/usr/bin/ld: pc.c:(.text+0x719): undefined reference to `_VT_em64t_get_reg'
/usr/bin/ld: pc.c:(.text+0x755): undefined reference to `_VT_em64t_init_init_stack_region'
/usr/bin/ld: /home/primrose/installed/spack/opt/spack/linux-ubuntu22.04-zen3/oneapi-2022.1.0/intel-oneapi-itac-2021.6.0-p2qb5a64gf7tj3qqvawkc7vi2vfeubsw/itac/2021.6.0/lib/libVT.a(pc.pic.o): in function `VT_Pc_unwind':
pc.c:(.text+0x7f4): undefined reference to `_VT_em64t_step'
/usr/bin/ld: pc.c:(.text+0x80c): undefined reference to `_VT_em64t_get_reg'
/usr/bin/ld: pc.c:(.text+0x957): undefined reference to `_VT_em64t_init_init_stack_region'
/usr/bin/ld: /home/primrose/installed/spack/opt/spack/linux-ubuntu22.04-zen3/oneapi-2022.1.0/intel-oneapi-itac-2021.6.0-p2qb5a64gf7tj3qqvawkc7vi2vfeubsw/itac/2021.6.0/lib/libVT.a(pc.pic.o): in function `VT_Pc_UpdateStackRange':
pc.c:(.text+0x10b3): undefined reference to `_VT_em64t_init_init_stack_region'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/convert/CMakeFiles/convert_3d_debug.dir/build.make:302: convert_3d_debug] Error 1
make[1]: *** [CMakeFiles/Makefile2:1116: src/convert/CMakeFiles/convert_3d_debug.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Linking CXX static library ../../libexahype2_3d_debug.a
 
 
When I search, I get the idea that em64t refers to extended memory feature but I could not find which library I need to link, could you help me on how to resolve this issue?
 
I installed the intel trace analyzer and collector with to spack package manager:
spack install intel-oneapi-itac
I have also instealled intel-oneapi-mpi and intel-oneapi-compilers with spack.
I have compiled the programs (used gcc with spack) with gcc:
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
 
 
 
0 Kudos
3 Replies
HemanthCH_Intel
Moderator
392 Views

Hi,

 

Thanks for posting in Intel Communities.

 

If you use a different MPI implementation or an old version of the supported one, you need to check its compatibility with Intel® Trace Collector. Compile and run the check_compatibility.c program located at /opt/intel/oneapi/itac/2021.6.0/examples/ directory. for more information refer to the below link:

https://www.intel.com/content/www/us/en/develop/documentation/itc-user-and-reference-guide/top/introduction/compatibility-with-mpi-implementations.html

 

If ITAC is compatible with your MPI implementation, could you please try adding below steps in the Cmake file for including the header file path and linking with the libVT.so file.

source /opt/intel/oneapi/setvars.sh
include_directories(${VT_ROOT}/include)
link_directories(${VT_ROOT}/lib)

 

Thanks & Regards,

Hemanth

 

0 Kudos
HemanthCH_Intel
Moderator
358 Views

Hi,


We haven't heard back from you. Could you please provide any updates on your issue?


Thanks & Regards,

Hemanth


0 Kudos
HemanthCH_Intel
Moderator
328 Views

Hi,


We have not heard back from you. This thread will no longer be monitored by Intel. If you need further assistance, please post a new question.


Thanks & Regards,

Hemanth


0 Kudos
Reply