Skip to content

Commit

Permalink
Fix ld error due to debian/ubuntu -pie default
Browse files Browse the repository at this point in the history
Fixes iovisor#782. Solution taken verbatim from @jepio here:

iovisor#782 (comment)

I ran into the same issue attempting to compile from source on
a fresh Ubuntu 16.10/Yakkety host:

Linking C executable bcc-lua
/usr/bin/ld: libluajit-5.1.a(ljamalg.o): relocation R_X86_64_32S
    against `.rodata' can not be used when making a shared object;
    recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output

Build succeeded after patch was applied.
  • Loading branch information
rtomayko authored and goldshtn committed Jun 8, 2017
1 parent e09564d commit 8e9aaea
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if (LUAJIT_LIBRARIES AND LUAJIT)
set_target_properties(bcc-lua PROPERTIES LINKER_LANGUAGE C)
target_link_libraries(bcc-lua ${LUAJIT_LIBRARIES})
target_link_libraries(bcc-lua -Wl,--whole-archive bcc-static -Wl,--no-whole-archive)
target_link_libraries(bcc-lua -no-pie)

install(TARGETS bcc-lua RUNTIME DESTINATION bin)
endif()

0 comments on commit 8e9aaea

Please sign in to comment.