From: Ryan Tomayko Date: Mon, 5 Jun 2017 17:43:46 +0000 (+0000) Subject: Fix ld error due to debian/ubuntu -pie default X-Git-Tag: submit/tizen_4.0/20171018.110122~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e9aaea07f1f108953c7b8c998f45ac209f7045b;p=platform%2Fupstream%2Fbcc.git Fix ld error due to debian/ubuntu -pie default Fixes #782. Solution taken verbatim from @jepio here: https://github.com/iovisor/bcc/issues/782#issuecomment-259075010 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. --- diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt index 97e2bb40..6ad0e874 100644 --- a/src/lua/CMakeLists.txt +++ b/src/lua/CMakeLists.txt @@ -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()