Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/sscep: fix linking error with musl-libc
@ 2024-05-11 18:13 Dario Binacchi
  2024-05-12  7:06 ` Thomas Petazzoni via buildroot
  2024-06-08  8:12 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Dario Binacchi @ 2024-05-11 18:13 UTC (permalink / raw)
  To: buildroot; +Cc: Dario Binacchi, linux-amarula, michael

The patch fixes the following linking failure:

/home/buildroot/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld: /home/buildroot/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/lib/libc.a(getopt.o): in function `getopt':
getopt.c:(.text.getopt+0x0): multiple definition of `getopt'; src/getopt.o:getopt.c:(.text+0x0): first defined here
/home/buildroot/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld: /home/buildroot/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/lib/libc.a(getopt.o):(.data.optind+0x0): multiple definition of `optind'; src/getopt.o:(.data+0x0): first defined here

Fixes:
- http://autobuild.buildroot.net/results/d5b1b4e5e9d9c8eca5e75c345db4d1f3f0cd84ed

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 ...-getopt-linking-error-with-musl-libc.patch | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 package/sscep/0002-Fix-getopt-linking-error-with-musl-libc.patch

diff --git a/package/sscep/0002-Fix-getopt-linking-error-with-musl-libc.patch b/package/sscep/0002-Fix-getopt-linking-error-with-musl-libc.patch
new file mode 100644
index 000000000000..ebb9985ef3ee
--- /dev/null
+++ b/package/sscep/0002-Fix-getopt-linking-error-with-musl-libc.patch
@@ -0,0 +1,67 @@
+From db7fab775d03438b4cfce6b49fab2d3176ecb1d3 Mon Sep 17 00:00:00 2001
+From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
+Date: Sat, 11 May 2024 19:38:01 +0200
+Subject: [PATCH] Fix getopt linking error with musl-libc
+
+The buildroot project, to which the sscep application was added, has
+configurations that raise the following linking error:
+buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld: buildroot/output/host/i586-buildroot-linux-musl/sysroot/lib/libc.a(getopt.o): in function `getopt':
+getopt.c:(.text.getopt+0x0): multiple definition of `getopt'; src/getopt.o:getopt.c:(.text+0x0): first defined here
+buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld: buildroot/output/host/i586-buildroot-linux-musl/sysroot/lib/libc.a(getopt.o):(.data.optind+0x0): multiple definition of `optind'; src/getopt.o:(.data+0x0): first defined here
+collect2: error: ld returned 1 exit status
+
+The commit 65561b53344b8 ("Fix getopt linking error") actually fixed the
+linking error only for uclibc, but not for musl-libc. The patch fixes
+the error for both uclibc and musl-libc.
+
+Link: http://autobuild.buildroot.net/results/d5b1b4e5e9d9c8eca5e75c345db4d1f3f0cd84ed/build-end.log
+Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
+Upstream: https://github.com/certnanny/sscep/pull/181
+---
+ configure.ac |  2 +-
+ src/getopt.c | 12 ++----------
+ 2 files changed, 3 insertions(+), 11 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 9f3ee15686a2..7a968d97dcaa 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -34,7 +34,7 @@ AC_TYPE_SIZE_T
+ # Checks for library functions.
+ AC_FUNC_MALLOC
+ AC_FUNC_REALLOC
+-AC_CHECK_FUNCS([alarm gethostbyname memset socket strchr strdup strstr])
++AC_CHECK_FUNCS([alarm gethostbyname getopt memset socket strchr strdup strstr])
+ 
+ AC_CONFIG_FILES([Makefile])
+ AC_SUBST([LIBTOOL_DEPS])
+diff --git a/src/getopt.c b/src/getopt.c
+index 0109406ba4ac..8793052845ed 100644
+--- a/src/getopt.c
++++ b/src/getopt.c
+@@ -31,15 +31,7 @@
+ #include <stddef.h>
+ #include <string.h>
+ 
+-#define GETOPT_INTERFACE_VERSION 2
+-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+-# include <gnu-versions.h>
+-# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+-#  define ELIDE_CODE
+-# endif
+-#endif
+-
+-#ifndef ELIDE_CODE
++#ifndef HAVE_GETOPT
+ 
+ char* optarg;
+ int optopt;
+@@ -237,4 +229,4 @@ int getopt_long(int argc, char* const argv[], const char* optstring,
+   return retval;
+ }
+ 
+-#endif	/* Not ELIDE_CODE.  */
++#endif	/* HAVE_GETOPT  */
+-- 
+2.43.0
+
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/sscep: fix linking error with musl-libc
  2024-05-11 18:13 [Buildroot] [PATCH 1/1] package/sscep: fix linking error with musl-libc Dario Binacchi
@ 2024-05-12  7:06 ` Thomas Petazzoni via buildroot
  2024-06-08  8:12 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-12  7:06 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: michael, linux-amarula, buildroot

On Sat, 11 May 2024 20:13:52 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> The patch fixes the following linking failure:
> 
> /home/buildroot/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld: /home/buildroot/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/lib/libc.a(getopt.o): in function `getopt':
> getopt.c:(.text.getopt+0x0): multiple definition of `getopt'; src/getopt.o:getopt.c:(.text+0x0): first defined here
> /home/buildroot/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld: /home/buildroot/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/lib/libc.a(getopt.o):(.data.optind+0x0): multiple definition of `optind'; src/getopt.o:(.data+0x0): first defined here
> 
> Fixes:
> - http://autobuild.buildroot.net/results/d5b1b4e5e9d9c8eca5e75c345db4d1f3f0cd84ed
> 
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>  ...-getopt-linking-error-with-musl-libc.patch | 67 +++++++++++++++++++
>  1 file changed, 67 insertions(+)
>  create mode 100644 package/sscep/0002-Fix-getopt-linking-error-with-musl-libc.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/sscep: fix linking error with musl-libc
  2024-05-11 18:13 [Buildroot] [PATCH 1/1] package/sscep: fix linking error with musl-libc Dario Binacchi
  2024-05-12  7:06 ` Thomas Petazzoni via buildroot
@ 2024-06-08  8:12 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-06-08  8:12 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: michael, linux-amarula, buildroot

>>>>> "Dario" == Dario Binacchi <dario.binacchi@amarulasolutions.com> writes:

 > The patch fixes the following linking failure:
 > /home/buildroot/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld:
 > /home/buildroot/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/lib/libc.a(getopt.o):
 > in function `getopt':
 > getopt.c:(.text.getopt+0x0): multiple definition of `getopt'; src/getopt.o:getopt.c:(.text+0x0): first defined here
 > /home/buildroot/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/i586-buildroot-linux-musl/9.3.0/../../../../i586-buildroot-linux-musl/bin/ld:
 > /home/buildroot/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/lib/libc.a(getopt.o):(.data.optind+0x0):
 > multiple definition of `optind'; src/getopt.o:(.data+0x0): first
 > defined here

 > Fixes:
 > - http://autobuild.buildroot.net/results/d5b1b4e5e9d9c8eca5e75c345db4d1f3f0cd84ed

 > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

Committed to 2024.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-08  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-11 18:13 [Buildroot] [PATCH 1/1] package/sscep: fix linking error with musl-libc Dario Binacchi
2024-05-12  7:06 ` Thomas Petazzoni via buildroot
2024-06-08  8:12 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox