From b2934c7aec8e08d4b2c388bba41f78010fd4ae74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Florian=20M=2E=20Gr=C3=A4tz?= Date: Tue, 27 Dec 2016 20:51:42 +0100 Subject: [PATCH] Fix build on Ubuntu 16.10 for x86_64 Ubuntu provides position independent shared objects for libraries, e.g., libsdl1.2-dev. To appropriatly link it to Genode, the linker flag '-no-pie' has to be added to the make file. --- repos/base-linux/lib/import/import-lx_hybrid.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/repos/base-linux/lib/import/import-lx_hybrid.mk b/repos/base-linux/lib/import/import-lx_hybrid.mk index b6a67756b7..cfb3a07903 100644 --- a/repos/base-linux/lib/import/import-lx_hybrid.mk +++ b/repos/base-linux/lib/import/import-lx_hybrid.mk @@ -109,3 +109,13 @@ LD_CMD = c++ # disable format-string security checks, which prevent non-literal format strings CC_OPT += -Wno-format-security + +# +# Disable position-independent executables (which are enabled by default on +# Ubuntu 16.10 or newer) +# +CXX_LINK_OPT_NO_PIE := $(shell \ + (echo "int main(){}" | $(LD_CMD) -no-pie -x c++ - -o /dev/null >& /dev/null \ + && echo "-no-pie") || true) +CXX_LINK_OPT += $(CXX_LINK_OPT_NO_PIE) +