All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/libnss: fix musl build
@ 2024-01-12 19:20 Fabrice Fontaine
  2024-01-12 21:15 ` Giulio Benetti
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrice Fontaine @ 2024-01-12 19:20 UTC (permalink / raw)
  To: buildroot; +Cc: Joseph Kogut, Giulio Benetti, Fabrice Fontaine

Fix following musl build failure raised at least since bump to version
3.84 in commit bcdf2fc0e41832147d3fc398070074be29c159d4:

/home/buildroot/autobuild/instance-3/output-1/host/bin/microblazeel-linux-gcc -shared   -Wl,-z,defs -Wl,-soname -Wl,libfreebl3.so  -Wl,--version-script,Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/freebl.def -Wl,-Bsymbolic -o Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o      -ldl -lc
/home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/microblazeel-buildroot-linux-musl/11.2.0/../../../../microblazeel-buildroot-linux-musl/bin/ld: Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o: in function `loader_GetOriginalPathname':
(.text.loader_GetOriginalPathname+0x1c4): undefined reference to `PR_SetError'

Fixes:
 - http://autobuild.buildroot.org/results/9a51138bb8a65f7f76a01d0e73c451273e6eb49e
 - http://autobuild.buildroot.org/results/d00d22f1bfee5c175f3266ff16124632906463c3

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...l-genload.c-drop-call-to-PR_SetError.patch | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch

diff --git a/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch b/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch
new file mode 100644
index 0000000000..fcbb434727
--- /dev/null
+++ b/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch
@@ -0,0 +1,39 @@
+From ac93583db67145467c0698f6adba5ee907d9216b Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Fri, 12 Jan 2024 20:13:30 +0100
+Subject: [PATCH] lib/freebl/genload.c: drop call to PR_SetError
+
+Drop call to PR_SetError in genload.c as already done in
+lowhash_vector.c to avoid adding a dependency on a function defined in
+nspr and raising the following build failure when FREEBL_NO_DEPEND is
+set to 1 (default on Linux):
+
+/home/buildroot/autobuild/instance-3/output-1/host/bin/microblazeel-linux-gcc -shared   -Wl,-z,defs -Wl,-soname -Wl,libfreebl3.so  -Wl,--version-script,Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/freebl.def -Wl,-Bsymbolic -o Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o      -ldl -lc
+/home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/microblazeel-buildroot-linux-musl/11.2.0/../../../../microblazeel-buildroot-linux-musl/bin/ld: Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o: in function `loader_GetOriginalPathname':
+(.text.loader_GetOriginalPathname+0x1c4): undefined reference to `PR_SetError'
+
+Fixes:
+ - http://autobuild.buildroot.org/results/d00d22f1bfee5c175f3266ff16124632906463c3
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Upstream: https://github.com/nss-dev/nss/pull/28
+---
+ lib/freebl/genload.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nss/lib/freebl/genload.c b/nss/lib/freebl/genload.c
+index 832deb58c..1f145048b 100644
+--- a/nss/lib/freebl/genload.c
++++ b/nss/lib/freebl/genload.c
+@@ -43,7 +43,7 @@ loader_GetOriginalPathname(const char* link)
+     PRUint32 iterations = 0;
+     PRInt32 len = 0, retlen = 0;
+     if (!link) {
+-        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
++        /*PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); */
+         return NULL;
+     }
+     len = PR_MAX(1024, strlen(link) + 1);
+-- 
+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] 5+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix musl build
  2024-01-12 19:20 [Buildroot] [PATCH 1/1] package/libnss: fix musl build Fabrice Fontaine
@ 2024-01-12 21:15 ` Giulio Benetti
  2024-01-12 22:11   ` Fabrice Fontaine
  0 siblings, 1 reply; 5+ messages in thread
From: Giulio Benetti @ 2024-01-12 21:15 UTC (permalink / raw)
  To: Fabrice Fontaine, buildroot; +Cc: Joseph Kogut

Hi Fabrice,

On 12/01/24 20:20, Fabrice Fontaine wrote:
> Fix following musl build failure raised at least since bump to version
> 3.84 in commit bcdf2fc0e41832147d3fc398070074be29c159d4:
> 
> /home/buildroot/autobuild/instance-3/output-1/host/bin/microblazeel-linux-gcc -shared   -Wl,-z,defs -Wl,-soname -Wl,libfreebl3.so  -Wl,--version-script,Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/freebl.def -Wl,-Bsymbolic -o Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o      -ldl -lc
> /home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/microblazeel-buildroot-linux-musl/11.2.0/../../../../microblazeel-buildroot-linux-musl/bin/ld: Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o: in function `loader_GetOriginalPathname':
> (.text.loader_GetOriginalPathname+0x1c4): undefined reference to `PR_SetError'
> 
> Fixes:
>   - http://autobuild.buildroot.org/results/9a51138bb8a65f7f76a01d0e73c451273e6eb49e
>   - http://autobuild.buildroot.org/results/d00d22f1bfee5c175f3266ff16124632906463c3
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Thank you for the patch. This is not a fix but a work-around. I've tried
several times to fix the problem from the root, but I haven't made it
and given up in the end.

So to me this looks ok, at least better than the actual situation, so:
Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

> ---
>   ...l-genload.c-drop-call-to-PR_SetError.patch | 39 +++++++++++++++++++
>   1 file changed, 39 insertions(+)
>   create mode 100644 package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch
> 
> diff --git a/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch b/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch
> new file mode 100644
> index 0000000000..fcbb434727
> --- /dev/null
> +++ b/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch
> @@ -0,0 +1,39 @@
> +From ac93583db67145467c0698f6adba5ee907d9216b Mon Sep 17 00:00:00 2001
> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Date: Fri, 12 Jan 2024 20:13:30 +0100
> +Subject: [PATCH] lib/freebl/genload.c: drop call to PR_SetError
> +
> +Drop call to PR_SetError in genload.c as already done in
> +lowhash_vector.c to avoid adding a dependency on a function defined in
> +nspr and raising the following build failure when FREEBL_NO_DEPEND is
> +set to 1 (default on Linux):
> +
> +/home/buildroot/autobuild/instance-3/output-1/host/bin/microblazeel-linux-gcc -shared   -Wl,-z,defs -Wl,-soname -Wl,libfreebl3.so  -Wl,--version-script,Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/freebl.def -Wl,-Bsymbolic -o Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o      -ldl -lc
> +/home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/microblazeel-buildroot-linux-musl/11.2.0/../../../../microblazeel-buildroot-linux-musl/bin/ld: Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o: in function `loader_GetOriginalPathname':
> +(.text.loader_GetOriginalPathname+0x1c4): undefined reference to `PR_SetError'
> +
> +Fixes:
> + - http://autobuild.buildroot.org/results/d00d22f1bfee5c175f3266ff16124632906463c3
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Upstream: https://github.com/nss-dev/nss/pull/28

This ^^^ is not Mozilla upstream and I think they would never accept it,
so I would set Upstream: to "N/A"

Best regards
-- 
Giulio Benetti
CEO&CTO@Benetti Engineering sas

> +---
> + lib/freebl/genload.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/nss/lib/freebl/genload.c b/nss/lib/freebl/genload.c
> +index 832deb58c..1f145048b 100644
> +--- a/nss/lib/freebl/genload.c
> ++++ b/nss/lib/freebl/genload.c
> +@@ -43,7 +43,7 @@ loader_GetOriginalPathname(const char* link)
> +     PRUint32 iterations = 0;
> +     PRInt32 len = 0, retlen = 0;
> +     if (!link) {
> +-        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
> ++        /*PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); */
> +         return NULL;
> +     }
> +     len = PR_MAX(1024, strlen(link) + 1);
> +--
> +2.43.0
> +

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

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

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix musl build
  2024-01-12 21:15 ` Giulio Benetti
@ 2024-01-12 22:11   ` Fabrice Fontaine
  2024-01-12 22:39     ` Giulio Benetti
  0 siblings, 1 reply; 5+ messages in thread
From: Fabrice Fontaine @ 2024-01-12 22:11 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: Joseph Kogut, buildroot

Hi Giulio,

Le ven. 12 janv. 2024 à 22:15, Giulio Benetti
<giulio.benetti@benettiengineering.com> a écrit :
>
> Hi Fabrice,
>
> On 12/01/24 20:20, Fabrice Fontaine wrote:
> > Fix following musl build failure raised at least since bump to version
> > 3.84 in commit bcdf2fc0e41832147d3fc398070074be29c159d4:
> >
> > /home/buildroot/autobuild/instance-3/output-1/host/bin/microblazeel-linux-gcc -shared   -Wl,-z,defs -Wl,-soname -Wl,libfreebl3.so  -Wl,--version-script,Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/freebl.def -Wl,-Bsymbolic -o Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o      -ldl -lc
> > /home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/microblazeel-buildroot-linux-musl/11.2.0/../../../../microblazeel-buildroot-linux-musl/bin/ld: Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o: in function `loader_GetOriginalPathname':
> > (.text.loader_GetOriginalPathname+0x1c4): undefined reference to `PR_SetError'
> >
> > Fixes:
> >   - http://autobuild.buildroot.org/results/9a51138bb8a65f7f76a01d0e73c451273e6eb49e
> >   - http://autobuild.buildroot.org/results/d00d22f1bfee5c175f3266ff16124632906463c3
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>
> Thank you for the patch. This is not a fix but a work-around. I've tried
> several times to fix the problem from the root, but I haven't made it
> and given up in the end.

Why do you think this is a work-around?
Here is an extract of [1]:

# On Linux 2.6 or later, build libfreebl3.so with no NSPR and libnssutil3.so
# dependencies by default.  Set FREEBL_NO_DEPEND to 0 in the environment to
# override this.

So basically, when FREEBL_NO_DEPEND is set to 1, freebl shall not
depend on PR_SetError as this function is defined by nspr.
If upstream is against this patch, another solution is to set
FREEBL_NO_DEPEND to 0 in libnss.mk.
However this could have some side effects on packages using freebl.

[1] https://github.com/nss-dev/nss/blob/ecab6a135bda33b8ea3aa887dd9944a8dcb27129/coreconf/Linux.mk#L178

>
> So to me this looks ok, at least better than the actual situation, so:
> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>
> > ---
> >   ...l-genload.c-drop-call-to-PR_SetError.patch | 39 +++++++++++++++++++
> >   1 file changed, 39 insertions(+)
> >   create mode 100644 package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch
> >
> > diff --git a/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch b/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch
> > new file mode 100644
> > index 0000000000..fcbb434727
> > --- /dev/null
> > +++ b/package/libnss/0002-lib-freebl-genload.c-drop-call-to-PR_SetError.patch
> > @@ -0,0 +1,39 @@
> > +From ac93583db67145467c0698f6adba5ee907d9216b Mon Sep 17 00:00:00 2001
> > +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > +Date: Fri, 12 Jan 2024 20:13:30 +0100
> > +Subject: [PATCH] lib/freebl/genload.c: drop call to PR_SetError
> > +
> > +Drop call to PR_SetError in genload.c as already done in
> > +lowhash_vector.c to avoid adding a dependency on a function defined in
> > +nspr and raising the following build failure when FREEBL_NO_DEPEND is
> > +set to 1 (default on Linux):
> > +
> > +/home/buildroot/autobuild/instance-3/output-1/host/bin/microblazeel-linux-gcc -shared   -Wl,-z,defs -Wl,-soname -Wl,libfreebl3.so  -Wl,--version-script,Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/freebl.def -Wl,-Bsymbolic -o Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/libfreebl3.so Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o      -ldl -lc
> > +/home/buildroot/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/microblazeel-buildroot-linux-musl/11.2.0/../../../../microblazeel-buildroot-linux-musl/bin/ld: Linux2.6_microblazeel_microblazeel-linux-gcc.br_real_glibc_PTH_DBG.OBJ/Linux_SINGLE_SHLIB/lowhash_vector.o: in function `loader_GetOriginalPathname':
> > +(.text.loader_GetOriginalPathname+0x1c4): undefined reference to `PR_SetError'
> > +
> > +Fixes:
> > + - http://autobuild.buildroot.org/results/d00d22f1bfee5c175f3266ff16124632906463c3
> > +
> > +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> > +Upstream: https://github.com/nss-dev/nss/pull/28
>
> This ^^^ is not Mozilla upstream and I think they would never accept it,
> so I would set Upstream: to "N/A"
>
> Best regards
> --
> Giulio Benetti
> CEO&CTO@Benetti Engineering sas
>
> > +---
> > + lib/freebl/genload.c | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/nss/lib/freebl/genload.c b/nss/lib/freebl/genload.c
> > +index 832deb58c..1f145048b 100644
> > +--- a/nss/lib/freebl/genload.c
> > ++++ b/nss/lib/freebl/genload.c
> > +@@ -43,7 +43,7 @@ loader_GetOriginalPathname(const char* link)
> > +     PRUint32 iterations = 0;
> > +     PRInt32 len = 0, retlen = 0;
> > +     if (!link) {
> > +-        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
> > ++        /*PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); */
> > +         return NULL;
> > +     }
> > +     len = PR_MAX(1024, strlen(link) + 1);
> > +--
> > +2.43.0
> > +
>

Best Regards,

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

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

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix musl build
  2024-01-12 22:11   ` Fabrice Fontaine
@ 2024-01-12 22:39     ` Giulio Benetti
  2024-02-07 15:40       ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 5+ messages in thread
From: Giulio Benetti @ 2024-01-12 22:39 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Joseph Kogut, buildroot


[-- Attachment #1.1: Type: text/html, Size: 30243 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

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

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

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix musl build
  2024-01-12 22:39     ` Giulio Benetti
@ 2024-02-07 15:40       ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-02-07 15:40 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: Joseph Kogut, Fabrice Fontaine, buildroot

Hello Giulio,

On Fri, 12 Jan 2024 23:39:55 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:

> > So basically, when FREEBL_NO_DEPEND is set to 1, freebl shall not
> > depend on PR_SetError as this function is defined by nspr.
> > 
> Yes but your patch only comment out PR_SetError() while it should
> depend on FREEBL_NO_DEPEND at this point even if I didn’t go in depth
> again after 1/2 years.
>
> But the point is why this only happens on musl and specific
> architectures.

This is indeed the question that we need to answer. Why is that musl
only?

According to Fabrice's explanation, it should happen on all platforms,
regarding of the C library. So there is something "more" to it, that we
don't yet understand.

Best regards,

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

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

end of thread, other threads:[~2024-02-07 15:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-12 19:20 [Buildroot] [PATCH 1/1] package/libnss: fix musl build Fabrice Fontaine
2024-01-12 21:15 ` Giulio Benetti
2024-01-12 22:11   ` Fabrice Fontaine
2024-01-12 22:39     ` Giulio Benetti
2024-02-07 15:40       ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.