Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/alchemy: don't copy the C library into the Alchemy staging
@ 2026-11-25  9:33 Yegor Yefremov via buildroot
  2026-11-25 10:48 ` Herve Codina via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Yegor Yefremov via buildroot @ 2026-11-25  9:33 UTC (permalink / raw)
  To: buildroot; +Cc: Hervé Codina

With BR2_ROOTFS_MERGED_USR=y and a glibc toolchain, ulog fails to link:

  SharedLib: libulog => alchemy-out/build/libulog/libulog.so
  .../ld: cannot find /lib64/libm.so.6: No such file or directory
  .../ld: cannot find /lib64/libmvec.so.1: No such file or directory

For eglibc/musl targets, Alchemy copies the C library from the toolchain
sysroot (lib/libc.so*, lib/libm.so*, ...) into its own staging
directory, and passes that directory to the linker with -L. Normally
sysroot/lib only holds the runtime libraries. With merged /usr,
sysroot/lib is a symlink to usr/lib, so the glibc libc.so and libm.so
linker scripts are copied as well. ld then finds alchemy-out/staging/lib/
libm.so first. As that script is outside of the sysroot, ld does not
prefix its absolute paths (/lib64/libm.so.6) with the sysroot and fails.

Buildroot already provides the C library in the sysroot, so there is no
need for Alchemy to install it. Pass an empty TOOLCHAIN_LIBC to Alchemy
to skip this step. It has to be passed on the command line, as Alchemy
overrides the environment variable. This fixes all Alchemy-based
packages (ulog, libfutils, libshdata).

This issue has been present since commit 7f1f3f87868f ("package/alchemy:
new host package"), which added Alchemy with the libc installation
enabled. It therefore affects 2022.02 and later, including 2026.02.x.

Fixes:
https://autobuild.buildroot.org/results/60397b107a5c09de5fd444babae8db538690ef33

Fixes: 7f1f3f87868fa333833dbba9f4f07adc338b34ed ("package/alchemy: new host package")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 package/alchemy/alchemy.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/alchemy/alchemy.mk b/package/alchemy/alchemy.mk
index 10d1068ac4..ae3efa67d5 100644
--- a/package/alchemy/alchemy.mk
+++ b/package/alchemy/alchemy.mk
@@ -23,7 +23,15 @@ $(eval $(host-generic-package))
 
 # Variables used by other packages
 
-ALCHEMY_MAKE = $(ALCHEMY_HOME)/scripts/alchemake
+# Alchemy copies the C library from the toolchain sysroot into its own
+# staging directory, and adds that directory to the linker search path.
+# With BR2_ROOTFS_MERGED_USR, sysroot/lib is sysroot/usr/lib, so this
+# also copies the glibc libc.so/libm.so linker scripts. ld then finds
+# them outside of the sysroot and doesn't prefix their absolute paths
+# (/lib64/libm.so.6) with it. The libc is provided by Buildroot anyway,
+# so tell Alchemy there is none to install. This has to be passed on the
+# command line, as Alchemy overrides the environment variable.
+ALCHEMY_MAKE = $(ALCHEMY_HOME)/scripts/alchemake TOOLCHAIN_LIBC=
 
 # TARGET_ARCH is set to 'xxx' to avoid Alchemy managing the architecture.
 # When Alchemy manages the architecture, it can add some flags to CFGLAGS and
-- 
2.34.1

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

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

* Re: [Buildroot] [PATCH] package/alchemy: don't copy the C library into the Alchemy staging
  2026-11-25  9:33 [Buildroot] [PATCH] package/alchemy: don't copy the C library into the Alchemy staging Yegor Yefremov via buildroot
@ 2026-11-25 10:48 ` Herve Codina via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Herve Codina via buildroot @ 2026-11-25 10:48 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: buildroot

Hi Yegor,

On Wed, 25 Nov 2026 10:33:30 +0100
Yegor Yefremov <yegorslists@googlemail.com> wrote:

> With BR2_ROOTFS_MERGED_USR=y and a glibc toolchain, ulog fails to link:
> 
>   SharedLib: libulog => alchemy-out/build/libulog/libulog.so
>   .../ld: cannot find /lib64/libm.so.6: No such file or directory
>   .../ld: cannot find /lib64/libmvec.so.1: No such file or directory
> 
> For eglibc/musl targets, Alchemy copies the C library from the toolchain
> sysroot (lib/libc.so*, lib/libm.so*, ...) into its own staging
> directory, and passes that directory to the linker with -L. Normally
> sysroot/lib only holds the runtime libraries. With merged /usr,
> sysroot/lib is a symlink to usr/lib, so the glibc libc.so and libm.so
> linker scripts are copied as well. ld then finds alchemy-out/staging/lib/
> libm.so first. As that script is outside of the sysroot, ld does not
> prefix its absolute paths (/lib64/libm.so.6) with the sysroot and fails.
> 
> Buildroot already provides the C library in the sysroot, so there is no
> need for Alchemy to install it. Pass an empty TOOLCHAIN_LIBC to Alchemy
> to skip this step. It has to be passed on the command line, as Alchemy
> overrides the environment variable. This fixes all Alchemy-based
> packages (ulog, libfutils, libshdata).
> 
> This issue has been present since commit 7f1f3f87868f ("package/alchemy:
> new host package"), which added Alchemy with the libc installation
> enabled. It therefore affects 2022.02 and later, including 2026.02.x.
> 
> Fixes:
> https://autobuild.buildroot.org/results/60397b107a5c09de5fd444babae8db538690ef33
> 
> Fixes: 7f1f3f87868fa333833dbba9f4f07adc338b34ed ("package/alchemy: new host package")
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
>  package/alchemy/alchemy.mk | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/package/alchemy/alchemy.mk b/package/alchemy/alchemy.mk
> index 10d1068ac4..ae3efa67d5 100644
> --- a/package/alchemy/alchemy.mk
> +++ b/package/alchemy/alchemy.mk
> @@ -23,7 +23,15 @@ $(eval $(host-generic-package))
>  
>  # Variables used by other packages
>  
> -ALCHEMY_MAKE = $(ALCHEMY_HOME)/scripts/alchemake
> +# Alchemy copies the C library from the toolchain sysroot into its own
> +# staging directory, and adds that directory to the linker search path.
> +# With BR2_ROOTFS_MERGED_USR, sysroot/lib is sysroot/usr/lib, so this
> +# also copies the glibc libc.so/libm.so linker scripts. ld then finds
> +# them outside of the sysroot and doesn't prefix their absolute paths
> +# (/lib64/libm.so.6) with it. The libc is provided by Buildroot anyway,
> +# so tell Alchemy there is none to install. This has to be passed on the
> +# command line, as Alchemy overrides the environment variable.
> +ALCHEMY_MAKE = $(ALCHEMY_HOME)/scripts/alchemake TOOLCHAIN_LIBC=
>  
>  # TARGET_ARCH is set to 'xxx' to avoid Alchemy managing the architecture.
>  # When Alchemy manages the architecture, it can add some flags to CFGLAGS and


LGTM. Thanks for handling this.

Acked-by: Herve Codina <herve.codina@bootlin.com>

Best regards,
Hervé
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-11-25 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  9:33 [Buildroot] [PATCH] package/alchemy: don't copy the C library into the Alchemy staging Yegor Yefremov via buildroot
2026-11-25 10:48 ` Herve Codina via buildroot

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