Skip to content

Commit

Permalink
Add explicit ElfUtils dependency for ParseThat and examples (#678)
Browse files Browse the repository at this point in the history
When linking the binaries for ParseThat and the examples, the transitive linkage between libsymtabAPI and libelf was not correctly resolved by the linker. Instead, it used the system libelf which may or may not be correct. This was discovered when using a non-system compiler with the --sysroot switch.
  • Loading branch information
hainest committed Nov 15, 2019
1 parent 1c738e7 commit 32abe5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ add_executable(unstrip unstrip.dir/unstrip.C
unstrip.dir/fingerprint.C
unstrip.dir/callback.C)
add_dependencies(unstrip parseAPI symtabAPI instructionAPI common)
target_link_libraries(unstrip parseAPI symtabAPI instructionAPI common dynDwarf dynElf ${Boost_LIBRARIES})
target_link_libraries(unstrip parseAPI symtabAPI instructionAPI common dynDwarf dynElf ${Boost_LIBRARIES} ${ElfUtils_LIBRARIES})

add_executable(codeCoverage codeCoverage.dir/codeCoverage.C)
add_dependencies(codeCoverage dyninstAPI patchAPI parseAPI symtabAPI instructionAPI pcontrol common stackwalk dynDwarf dynElf)
target_link_libraries(codeCoverage dyninstAPI patchAPI parseAPI symtabAPI instructionAPI pcontrol common stackwalk dynDwarf dynElf ${Boost_LIBRARIES})
target_link_libraries(codeCoverage dyninstAPI patchAPI parseAPI symtabAPI instructionAPI pcontrol common stackwalk dynDwarf dynElf ${Boost_LIBRARIES} ${ElfUtils_LIBRARIES})

add_library(Inst SHARED codeCoverage.dir/libInst.C)
if(TARGET TBB)
Expand All @@ -21,7 +21,7 @@ endif()

add_executable(cfg_to_dot ../parseAPI/doc/example.cc)
add_dependencies(cfg_to_dot parseAPI symtabAPI instructionAPI common dynDwarf dynElf)
target_link_libraries(cfg_to_dot parseAPI symtabAPI instructionAPI common dynDwarf dynElf ${Boost_LIBRARIES})
target_link_libraries(cfg_to_dot parseAPI symtabAPI instructionAPI common dynDwarf dynElf ${Boost_LIBRARIES} ${ElfUtils_LIBRARIES})
#add_executable(retee)

if (USE_OpenMP MATCHES "ON")
Expand Down
2 changes: 1 addition & 1 deletion parseThat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if (USE_OpenMP MATCHES "ON")
set_target_properties (parseThat PROPERTIES LINK_FLAGS "-fopenmp")
endif()

target_link_private_libraries(parseThat dyninstAPI patchAPI parseAPI instructionAPI stackwalk symtabAPI common pcontrol dynDwarf dynElf ${Boost_LIBRARIES})
target_link_private_libraries(parseThat dyninstAPI patchAPI parseAPI instructionAPI stackwalk symtabAPI common pcontrol dynDwarf dynElf ${Boost_LIBRARIES} ${ElfUtils_LIBRARIES})
install(TARGETS parseThat RUNTIME DESTINATION bin)

0 comments on commit 32abe5d

Please sign in to comment.