From patchwork Sat Dec 1 21:59:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrice Fontaine X-Patchwork-Id: 1006431 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.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ws++T/5a"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 436lYm3PMtz9s55 for ; Sun, 2 Dec 2018 09:00:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2B690870B3; Sat, 1 Dec 2018 22:00:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yqnmHPdm-fsD; Sat, 1 Dec 2018 22:00:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id D478687066; Sat, 1 Dec 2018 22:00:19 +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 A07A71BF2E3 for ; Sat, 1 Dec 2018 22:00:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9DD5F87B59 for ; Sat, 1 Dec 2018 22:00:17 +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 foQMCa+iTCGp for ; Sat, 1 Dec 2018 22:00:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9C51787A4D for ; Sat, 1 Dec 2018 22:00:12 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id n133so2210232wmd.4 for ; Sat, 01 Dec 2018 14:00:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=p0wUzgwe+JrWNXaL/4fC8Gq7dNraix6LLxeo4ucmqyM=; b=Ws++T/5ahJfDGq4Kf4OnVoxJoqI0vRpV4gYd1qJSmhiZ3wT53GAeFae/ARQE03Z27b DEUPc+xGMB3UG4dOrDpaXIDCQNvP1gCp9ZMwiatpdbkTSH+bTeMFBHf+DMeMUG4MfKF/ kgPBfpvwKfUIpbcEkSiCfY2bTlFaxQMu/rmpFf5SqL7ASEqHjy9IuMFrCDN0uVy+4K7+ i+2dh0yQ62N9BDF8mNQRw0erlrZ4mELao4viTq1E3GEM/dyKI3El3wLmNamgV/gncSPm 4lL9LoLkr//+jqdILTV5yegn8D/FYf+g/L0j7eHHnt4UYn84RXKVyOko0TfK7DrWZ1nB WSow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=p0wUzgwe+JrWNXaL/4fC8Gq7dNraix6LLxeo4ucmqyM=; b=ihCKbG8+yDpwZks0wCg1pGBHWefdRpb/PwV1TNVpYb0bcYVsIkpKK9/6eXCs96CBG4 IMcGmTqdJGVNqtysDTpKymjCO2a1IfRditOyg7l696x38XeFvpXiASOxyc9ezphWLE8i iUY99GuHtVSIX0CWkgMaHUqzqFIoUdZVOYvWRgkGwaf+oj2SpYNJiU0S72w5YzuoMgut W3VXgdiiAcoa72VxbblohDKHSEkSiYQxq90+ldeRVfsxmfuBI9PFXW/k0DOYO3YlwSMD UDYR5wvOUD/jI4l3tYl3hICwndBN9tlDXxJtoJ53BEFTWVewwsSCieD2/yGVrZHltedj PPeA== X-Gm-Message-State: AA+aEWa4c5KDA8S96zhj1BJQMyUfJFNKgECulD1SgLGU0jOC5G4/3LLJ 6hMniT5YCrtVMdYIu/9VbtYYyqUo X-Google-Smtp-Source: AFSGD/VKJ7DDT9l4M/JYMFvz0KfxFpzVaxVjj1Err+8LWKP+V0KsGkWuEVzXf3f98BGznojA3cu9SA== X-Received: by 2002:a1c:3e84:: with SMTP id l126-v6mr3192939wma.57.1543701610717; Sat, 01 Dec 2018 14:00:10 -0800 (PST) Received: from fabrice-imedia-S3210.home (arennes-656-1-408-27.w92-135.abo.wanadoo.fr. [92.135.60.27]) by smtp.gmail.com with ESMTPSA id j199sm9125153wmf.13.2018.12.01.14.00.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Dec 2018 14:00:09 -0800 (PST) From: Fabrice Fontaine To: buildroot@buildroot.org Date: Sat, 1 Dec 2018 22:59:53 +0100 Message-Id: <20181201215953.6966-1-fontaine.fabrice@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH 1/1] quagga: fix static build with musl X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabrice Fontaine MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" zebra library defines optind and opterr which are already defined in libc Current code is not included if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 && _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION However, this fails on musl even if musl provides getopt as a result static linking with musl fails To fix this issue, add an option to allow the user to disable getopt code and use it in quagga.mk Fixes: - http://autobuild.buildroot.org/results/32f93a73379d073abcaf8936ffbb8b5707583024 Signed-off-by: Fabrice Fontaine --- ...an-option-to-disable-embedded-getopt.patch | 84 +++++++++++++++++++ package/quagga/quagga.mk | 3 +- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 package/quagga/0009-add-an-option-to-disable-embedded-getopt.patch diff --git a/package/quagga/0009-add-an-option-to-disable-embedded-getopt.patch b/package/quagga/0009-add-an-option-to-disable-embedded-getopt.patch new file mode 100644 index 0000000000..f8b0e7bcfe --- /dev/null +++ b/package/quagga/0009-add-an-option-to-disable-embedded-getopt.patch @@ -0,0 +1,84 @@ +From 4d09fabe5fb3272d04cf86f4197d75f300af15be Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Sat, 1 Dec 2018 22:23:30 +0100 +Subject: [PATCH] add an option to disable embedded getopt + +zebra library defines optind and opterr which are already defined in +libc +Current code is not included if !defined _LIBC && defined __GLIBC__ && + __GLIBC__ >= 2 && _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION + +However, this fails on musl even if musl provides getopt as a result +static linking with musl fails + +To fix this issue, add an option to allow the user to disable getopt +code + +Fixes: + - http://autobuild.buildroot.org/results/32f93a73379d073abcaf8936ffbb8b5707583024 + +Signed-off-by: Fabrice Fontaine +--- + configure.ac | 7 +++++++ + lib/getopt.c | 4 ++++ + lib/getopt1.c | 4 ++++ + 3 files changed, 15 insertions(+) + +diff --git a/configure.ac b/configure.ac +index ed279f48..ace2ed48 100755 +--- a/configure.ac ++++ b/configure.ac +@@ -360,6 +360,9 @@ AC_ARG_ENABLE([protobuf], + AC_ARG_ENABLE([dev_build], + AS_HELP_STRING([--enable-dev-build], [build for development])) + ++AC_ARG_ENABLE(embedded-getopt, ++ AS_HELP_STRING([--disable-embedded-getopt], [disable embedded getopt functions])) ++ + if test x"${enable_gcc_rdynamic}" != x"no" ; then + if test x"${enable_gcc_rdynamic}" = x"yes" -o x"$COMPILER" = x"GCC"; then + LDFLAGS="${LDFLAGS} -rdynamic" +@@ -383,6 +386,10 @@ if test "x${enable_dev_build}" = "xyes"; then + fi + AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"]) + ++if test "${enable_embedded_getopt}" = "yes"; then ++ AC_DEFINE(HAVE_EMBEDDED_GETOPT,,Enable embedded getopt functions) ++fi ++ + # + # Logic for protobuf support. + # +diff --git a/lib/getopt.c b/lib/getopt.c +index 7a58a8a8..45fe6a7d 100644 +--- a/lib/getopt.c ++++ b/lib/getopt.c +@@ -58,6 +58,10 @@ + # endif + #endif + ++#if !defined HAVE_EMBEDDED_GETOPT ++# define ELIDE_CODE ++#endif ++ + #ifndef ELIDE_CODE + + +diff --git a/lib/getopt1.c b/lib/getopt1.c +index bd3099e7..b8c87ddc 100644 +--- a/lib/getopt1.c ++++ b/lib/getopt1.c +@@ -49,6 +49,10 @@ + #endif + #endif + ++#if !defined HAVE_EMBEDDED_GETOPT ++# define ELIDE_CODE ++#endif ++ + #ifndef ELIDE_CODE + + +-- +2.17.1 + diff --git a/package/quagga/quagga.mk b/package/quagga/quagga.mk index 8c2b80631b..cc4cd0a79f 100644 --- a/package/quagga/quagga.mk +++ b/package/quagga/quagga.mk @@ -16,7 +16,8 @@ QUAGGA_LICENSE_FILES = COPYING QUAGGA_CONF_OPTS = \ --program-transform-name='' \ --sysconfdir=/etc/quagga \ - --localstatedir=/var/run/quagga + --localstatedir=/var/run/quagga \ + --disable-embedded-getopt # 0002-configure-fix-static-linking-with-readline.patch QUAGGA_AUTORECONF = YES