Created attachment 3827 [details] Workaround patch I observed quite a few "cannot make copy relocation for protected symbol" build errors among recipes, with the following config: MACHINE = "beaglebone" TCLIBC = "musl" DISTRO_FEATURES_append = " ld-is-gold" to give a example, the errors looks like: ...... | /home/peter-liu/opensource/poky-upstream/build/tmp/work/cortexa8hf-neon-poky-linux-musleabi/kmod/23+gitAUTOINC+65a885df5f-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-musleabi/../../libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/6.3.0/ld: error: tools/kmod.o: cannot make copy relocation for protected symbol 'program_invocation_short_name', defined in /home/peter-liu/opensource/poky-upstream/build/tmp/work/cortexa8hf-neon-poky-linux-musleabi/kmod/23+gitAUTOINC+65a885df5f-r0/recipe-sysroot/usr/lib/libc.so ...... I observed similar build errors with the following recipes: meta/recipes-core/coreutils/coreutils_8.27.bb meta/recipes-core/gettext/gettext_0.19.8.1.bb meta/recipes-core/glib-2.0/glib.inc meta/recipes-core/udev/eudev_3.2.1.bb meta/recipes-core/util-linux/util-linux.inc meta/recipes-devtools/m4/m4.inc meta/recipes-extended/diffutils/diffutils.inc meta/recipes-extended/grep/grep_3.0.bb meta/recipes-extended/iptables/iptables_1.6.1.bb meta/recipes-extended/procps/procps_3.3.12.bb meta/recipes-extended/xz/xz_5.2.3.bb meta/recipes-graphics/wayland/libinput_1.6.1.bb meta/recipes-graphics/xorg-xserver/xserver-xorg.inc meta/recipes-kernel/kmod/kmod.inc and I noticed there is a workaround for libunwind recipe: https://patchwork.openembedded.org/patch/132005/ So I made a patch also applying the same logic to other recipes, which seems fixed the building issues(see the attached), but it does not look like a real fix, could somebody give some input?
More information, I also tested with the following scenarios: ... MACHINE = "genericx86-64" TCLIBC = "musl" DISTRO_FEATURES_append = " ld-is-gold" ... ... MACHINE = "beaglebone" TCLIBC = "glibc" DISTRO_FEATURES_append = " ld-is-gold" ... ... MACHINE = "genericx86-64" TCLIBC = "glibc" DISTRO_FEATURES_append = " ld-is-gold" ... bitbake core-image-minimal the issue did not show up with any of the above configs, so it only impacts arm + bfd linker?
musl did not support lazy binding, which was added lately, however there could be issues. Although I would like you to try out the latest master where the latest musl is now in oe-core. And see if it still happens if so, I can work with community to narrow down the issue. Meanwhile the workaround patch you posted look fine to me.
Hi, Khem: I just tried out the latest poky. In meta/recipes-core/musl/musl_git.bb: SRCREV = "a08910fc2cc739f631b75b2d09b8d72a0d64d285" it's the latest commit in musl as you said, but the issues are still there, I see same compiling errors as I tested last time. I am planning to retest my workaround patch against the latest poky and send it OE mail list, to see if there is any chance it can be merged as a temporary fix before you and musl community figure out a real fix.
Can you test this patch please diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index 53a8ba196a..93e3535c8d 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb @@ -36,6 +36,7 @@ CONFIGUREOPTS = " \ --libdir=${libdir} \ --includedir=${includedir} \ --syslibdir=${base_libdir} \ + --disable-visibility \ " do_configure() {
Just tried applying this patch, but the error still could be observed, for instance: | /home/peter-liu/opensource/poky-upstream/build/tmp/work/cortexa8hf-neon-poky-linux-musleabi/m4/1.4.18-r0/recipe-sysroot-native/usr/bin/arm-poky-linux-musleabi/../../libexec/arm-poky-linux-musleabi/gcc/arm-poky-linux-musleabi/7.1.0/ld: error: ../lib/libm4.a(progname.o): cannot make copy relocation for protected symbol 'program_invocation_name', defined in /home/peter-liu/opensource/poky-upstream/build/tmp/work/cortexa8hf-neon-poky-linux-musleabi/m4/1.4.18-r0/recipe-sysroot/usr/lib/libc.so | collect2: error: ld returned 1 exit status | Makefile:1554: recipe for target 'm4' failed
I think I gave you converse. Can you try --enable-visibility instead?
Hi, Khem: Just tried, still no lucky, I got the same error with: diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index 31583de..a047ac6 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb @@ -35,6 +35,7 @@ CONFIGUREOPTS = " \ --libdir=${libdir} \ --includedir=${includedir} \ --syslibdir=${base_libdir} \ + --enable-visibility \ "
(In reply to comment #6) > I think I gave you converse. Can you try > > --enable-visibility > > instead? try --disable-visibility and --enable-visibility one by one btw you should use bitbake -ccleansstate musl m4 bitbake m4
Hi, Khem: That exactly is what I have done.
> Hi, Khem: > That exactly is what I have done. Sorry, I just realized, I probably forgot to cleansstate when I was trying "--disable-visibility", will re-test that option. I did cleansstate when trying "--enable-visibility" by the way.
Hi, Khem: The problem seems resolved with your suggestion "--disable-visibility" if I run cleansstate musl beforehand, now I have built core-image-minimal successfully. But I would like to try to build from scratch one more time. I am curious about the "cleansstate" thing, I do not understand why that is necessary? Since the CONFIGUREOPTS change will taint the do_configure hence will lead musl recompile, isn't that correct? If cleansstate is needed, does this mean the users would still get this problem even with your patch applied if they do not build from scratch?
Just tried build core-image-minimal from scratch with: diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb index 53a8ba196a..93e3535c8d 100644 --- a/meta/recipes-core/musl/musl_git.bb +++ b/meta/recipes-core/musl/musl_git.bb @@ -36,6 +36,7 @@ CONFIGUREOPTS = " \ --libdir=${libdir} \ --includedir=${includedir} \ --syslibdir=${base_libdir} \ + --disable-visibility \ " the problem seems fixed.
This is fixed by oe-core/5490efb7446196dce6a4be678263e8a73648446a