From patchwork Mon Sep 3 07:25:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABl_PORTAY?= X-Patchwork-Id: 965270 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.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=savoirfairelinux.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 423hMY40XZz9s1x for ; Mon, 3 Sep 2018 17:25:45 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3E22122846; Mon, 3 Sep 2018 07:25:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TvEIhmSyQPms; Mon, 3 Sep 2018 07:25:38 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 612FD22816; Mon, 3 Sep 2018 07:25:38 +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 8CC001C2D35 for ; Mon, 3 Sep 2018 07:25:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8864B86E87 for ; Mon, 3 Sep 2018 07:25:35 +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 xgcwkkB9pNWF for ; Mon, 3 Sep 2018 07:25:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by hemlock.osuosl.org (Postfix) with ESMTPS id 2590286AE7 for ; Mon, 3 Sep 2018 07:25:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 3DF999C30E6; Mon, 3 Sep 2018 03:25:31 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id sxxDfSrUVN3b; Mon, 3 Sep 2018 03:25:30 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id AA6B09C2379; Mon, 3 Sep 2018 03:25:30 -0400 (EDT) X-Virus-Scanned: amavisd-new at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MBg-FRSnesK1; Mon, 3 Sep 2018 03:25:30 -0400 (EDT) Received: from t1000.mtl.sfl (unknown [192.168.50.190]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 807409C30E6; Mon, 3 Sep 2018 03:25:30 -0400 (EDT) From: =?utf-8?q?Ga=C3=ABl_PORTAY?= To: buildroot@buildroot.org Date: Mon, 3 Sep 2018 03:25:27 -0400 Message-Id: <20180903072528.15744-3-gael.portay@savoirfairelinux.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180903072528.15744-1-gael.portay@savoirfairelinux.com> References: <20180903072528.15744-1-gael.portay@savoirfairelinux.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 2/3] leveldb: generate pic for static libraries 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: =?utf-8?q?Ga=C3=ABl_Portay?= , Peter Seiderer , Steve James Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The project's static libraries are not compiled with the -fPIC compiler flag that prevents any libraries to link against those libraries. This commit adds a patch that sets the -fPIC compiler flag to the list of CFLAGS/CXXFLAGS. The project now generates position independant code for all of its outputs (i.e. not limited anymore to its shared libraries). Fixes: /home/gportay/src/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-amd-linux-gnu/6.2.0/../../../../x86_64-amd-linux-gnu/bin/ld: /home/gportay/src/buildroot/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libmemenv.a(memenv.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC /home/gportay/src/buildroot/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libmemenv.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status Signed-off-by: Gaël PORTAY --- ...sition-independant-code-for-static-librar.patch | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 package/leveldb/0001-Generate-position-independant-code-for-static-librar.patch diff --git a/package/leveldb/0001-Generate-position-independant-code-for-static-librar.patch b/package/leveldb/0001-Generate-position-independant-code-for-static-librar.patch new file mode 100644 index 0000000000..dce06ec725 --- /dev/null +++ b/package/leveldb/0001-Generate-position-independant-code-for-static-librar.patch @@ -0,0 +1,52 @@ +From 6ed1b57ef6bcee0d497c181730710b2b0fafbfb3 Mon Sep 17 00:00:00 2001 +From: =?utf-8?q?Ga=C3=ABl=20PORTAY?= +Date: Fri, 31 Aug 2018 12:23:46 -0400 +Subject: [PATCH] Generate position independant code for static library +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Currently, only shared libraries are using the PIC flag. + +Generalize this flag for static libraries in order to let them linkable +by dynamic libraries. + +Fixes: + + /home/gportay/src/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-amd-linux-gnu/6.2.0/../../../../x86_64-amd-linux-gnu/bin/ld: /home/gportay/src/buildroot/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libmemenv.a(memenv.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC + /home/gportay/src/buildroot/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/libmemenv.a: error adding symbols: Bad value + collect2: error: ld returned 1 exit status + +Upstream-Status: Inappropriate [upstream has migrated to cmake] +Signed-off-by: Gaël PORTAY +--- + build_detect_platform | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/build_detect_platform b/build_detect_platform +index d2a20ce..4839444 100755 +--- a/build_detect_platform ++++ b/build_detect_platform +@@ -55,8 +55,8 @@ fi + + COMMON_FLAGS= + CROSS_COMPILE= +-PLATFORM_CCFLAGS= +-PLATFORM_CXXFLAGS= ++PLATFORM_CCFLAGS="-fPIC" ++PLATFORM_CXXFLAGS="-fPIC" + PLATFORM_LDFLAGS= + PLATFORM_LIBS= + PLATFORM_SHARED_EXT="so" +@@ -197,7 +197,7 @@ else + EOF + if [ "$?" = 0 ]; then + COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX -DLEVELDB_ATOMIC_PRESENT" +- PLATFORM_CXXFLAGS="-std=c++0x" ++ PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS -std=c++0x" + else + COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX" + fi +-- +2.18.0 +