From patchwork Wed Apr 11 15:30:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Korenblit X-Patchwork-Id: 897239 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=smile.fr Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Lp014qz1z9s0n for ; Thu, 12 Apr 2018 01:30:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 400DE868C5; Wed, 11 Apr 2018 15:30:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BRWsSFFViHDR; Wed, 11 Apr 2018 15:30:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 717E98688A; Wed, 11 Apr 2018 15:30:35 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 96FAB1C0000 for ; Wed, 11 Apr 2018 15:30:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 93CD588067 for ; Wed, 11 Apr 2018 15:30:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id La6t-+CzfhgZ for ; Wed, 11 Apr 2018 15:30:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from idris.smile.fr (idris.smile.fr [91.216.209.19]) by hemlock.osuosl.org (Postfix) with ESMTPS id 5200488037 for ; Wed, 11 Apr 2018 15:30:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by idris.smile.fr (Postfix) with ESMTP id 6ECC01EE2264; Wed, 11 Apr 2018 17:30:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at smile.fr Received: from idris.smile.fr ([127.0.0.1]) by localhost (bluemind-mta.prod.vitry.intranet [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ahx1W3TwiTm5; Wed, 11 Apr 2018 17:30:29 +0200 (CEST) Received: from sisellBox.daviel.idf.intranet (static-css-ccs-204145.business.bouyguestelecom.com [176.157.204.145]) by idris.smile.fr (Postfix) with ESMTPSA id 4432A1EE2260; Wed, 11 Apr 2018 17:30:29 +0200 (CEST) From: Valentin Korenblit To: buildroot@buildroot.org Date: Wed, 11 Apr 2018 17:30:22 +0200 Message-Id: <20180411153022.13335-1-valentin.korenblit@smile.fr> X-Mailer: git-send-email 2.14.3 Subject: [Buildroot] [PATCH] package/llvm: remove $ORIGIN/../lib from RPATH X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Valentin Korenblit , romain.naour@gmail.com MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" AddLLVM.cmake adds $ORIGIN/../lib to the RPATH of llvm binaries. This causes a problem when llvm-config from host installed in STAGING_DIR is executed under the following conditions: *Target architecture same as host architecture (normally x86_64) *Target's libc different from host's libc (normally glibc) llvm-config will try to link with the target's libc, resulting in: ./llvm-config: error while loading shared libraries: libc.so.0: cannot open shared object file: No such file or directory. Link to autobuild error: http://autobuild.buildroot.net/results/b81c12d529c66a028e2297ea5ce1d6930324fa69/ To avoid this, remove the code from llvm_setup_rpath in AddLLVM.cmake Link to discussion: http://lists.busybox.net/pipermail/buildroot/2018-April/218627.html Signed-off-by: Valentin Korenblit --- .../llvm/0001-Avoid-adding-RPATH-to-binaries.patch | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 package/llvm/0001-Avoid-adding-RPATH-to-binaries.patch diff --git a/package/llvm/0001-Avoid-adding-RPATH-to-binaries.patch b/package/llvm/0001-Avoid-adding-RPATH-to-binaries.patch new file mode 100644 index 0000000000..861eed1f1e --- /dev/null +++ b/package/llvm/0001-Avoid-adding-RPATH-to-binaries.patch @@ -0,0 +1,55 @@ +From 134fe34a0b737003a9728f77d37fd3a6d763f757 Mon Sep 17 00:00:00 2001 +From: Valentin Korenblit +Date: Wed, 11 Apr 2018 16:26:10 +0200 +Subject: [PATCH] Avoid adding RPATH to binaries + +Signed-off-by: Valentin Korenblit +--- + cmake/modules/AddLLVM.cmake | 30 ------------------------------ + 1 file changed, 30 deletions(-) + +diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake +index 1c922651b13..e70c9fbdb8e 100644 +--- a/cmake/modules/AddLLVM.cmake ++++ b/cmake/modules/AddLLVM.cmake +@@ -1440,37 +1440,7 @@ function(llvm_externalize_debuginfo name) + endfunction() + + function(llvm_setup_rpath name) +- if(CMAKE_INSTALL_RPATH) +- return() +- endif() +- +- if(LLVM_INSTALL_PREFIX AND NOT (LLVM_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX)) +- set(extra_libdir ${LLVM_LIBRARY_DIR}) +- elseif(LLVM_BUILD_LIBRARY_DIR) +- set(extra_libdir ${LLVM_LIBRARY_DIR}) +- endif() +- +- if (APPLE) +- set(_install_name_dir INSTALL_NAME_DIR "@rpath") +- set(_install_rpath "@loader_path/../lib" ${extra_libdir}) +- elseif(UNIX) +- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) +- if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") +- set_property(TARGET ${name} APPEND_STRING PROPERTY +- LINK_FLAGS " -Wl,-z,origin ") +- elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT LLVM_LINKER_IS_GOLD) +- # $ORIGIN is not interpreted at link time by ld.bfd +- set_property(TARGET ${name} APPEND_STRING PROPERTY +- LINK_FLAGS " -Wl,-rpath-link,${LLVM_LIBRARY_OUTPUT_INTDIR} ") +- endif() +- else() +- return() +- endif() + +- set_target_properties(${name} PROPERTIES +- BUILD_WITH_INSTALL_RPATH On +- INSTALL_RPATH "${_install_rpath}" +- ${_install_name_dir}) + endfunction() + + function(setup_dependency_debugging name) +-- +2.14.3 +