Skip to contentSkip to conversation

Crosstool-ng external toolchain with BR2_ROOTFS_MERGED_USR

Buildroot Charlie Jenkins 1 participant 3 messages Mar 10, 2025 – Mar 11, 2025

lore
Share & tools
lore
#0 lore raw

I am trying to use a crosstool-ng build toolchain in Buildroot with the BR2_ROOTFS_MERGED_USR option enabled. However, crosstool-ng installs the sysroot libs at /lib instead /usr/lib as BR2_ROOTFS_MERGED_USR expects. I am not sure what the best solution for this is. Should BR2_ROOTFS_MERGED_USR be ignored for toolchain packages when an external toolchain is being used?

My crosstool-ng config is:
CT_CONFIG_VERSION="4"
CT_ARCH_RISCV=y
# CT_DEMULTILIB is not set
CT_ARCH_USE_MMU=y
CT_ARCH_64=y
CT_ARCH_ARCH="rv64gc"
CT_KERNEL_LINUX=y
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
# CT_GDB_GDBSERVER is not set

My buildroot config is:
BR2_riscv=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="<path to built crosstool-ng toolchain>" BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-unknown-linux-gnu" BR2_TOOLCHAIN_EXTERNAL_HEADERS_6_11=y BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
# BR2_STRIP_strip is not set
BR2_ROOTFS_MERGED_USR=y

- Charlie

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw
Quoted 6 lines · Charlie Jenkins

I am trying to use a crosstool-ng build toolchain in Buildroot with the BR2_ROOTFS_MERGED_USR option enabled. However, crosstool-ng installs the sysroot libs at /lib instead /usr/lib as BR2_ROOTFS_MERGED_USR expects. I am not sure what the best solution for this is. Should BR2_ROOTFS_MERGED_USR be ignored for toolchain packages when an external toolchain is being used?

I meant to add more information about the failure...

Because crosstool-ng installs the libs at /lib instead of /usr/lib, the libraries end up getting symlinked into nothingness. For example:

$ ls -l ./output/host/riscv64-buildroot-linux-gnu/sysroot/usr/lib/libm.so
lrwxrwxrwx 1 charlie rvs 6 Mar  9 22:58 ./output/host/riscv64-buildroot-linux-gnu/sysroot/usr/lib/libm.so -> ../../
Quoted 27 lines

My crosstool-ng config is:
CT_CONFIG_VERSION="4"
CT_ARCH_RISCV=y
# CT_DEMULTILIB is not set
CT_ARCH_USE_MMU=y
CT_ARCH_64=y
CT_ARCH_ARCH="rv64gc"
CT_KERNEL_LINUX=y
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
# CT_GDB_GDBSERVER is not set

My buildroot config is:
BR2_riscv=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="<path to built crosstool-ng toolchain>" BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-unknown-linux-gnu" BR2_TOOLCHAIN_EXTERNAL_HEADERS_6_11=y BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
# BR2_STRIP_strip is not set
BR2_ROOTFS_MERGED_USR=y

Quoted 2 lines

- Charlie

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 8 lines · Charlie Jenkins
Quoted 6 lines · Charlie Jenkins

I am trying to use a crosstool-ng build toolchain in Buildroot with the BR2_ROOTFS_MERGED_USR option enabled. However, crosstool-ng installs the sysroot libs at /lib instead /usr/lib as BR2_ROOTFS_MERGED_USR expects. I am not sure what the best solution for this is. Should BR2_ROOTFS_MERGED_USR be ignored for toolchain packages when an external toolchain is being used?

Quoted 7 lines

I meant to add more information about the failure...

Because crosstool-ng installs the libs at /lib instead of /usr/lib, the libraries end up getting symlinked into nothingness. For example:

$ ls -l ./output/host/riscv64-buildroot-linux-gnu/sysroot/usr/lib/libm.so
lrwxrwxrwx 1 charlie rvs 6 Mar  9 22:58 ./output/host/riscv64-buildroot-linux-gnu/sysroot/usr/lib/libm.so -> ../../

I believed I fixed the problem here:

https://lore.kernel.org/buildroot/[email protected]/T/#u

- Charlie

Quoted 28 lines
Quoted 28 lines

My crosstool-ng config is:
CT_CONFIG_VERSION="4"
CT_ARCH_RISCV=y
# CT_DEMULTILIB is not set
CT_ARCH_USE_MMU=y
CT_ARCH_64=y
CT_ARCH_ARCH="rv64gc"
CT_KERNEL_LINUX=y
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
# CT_GDB_GDBSERVER is not set

My buildroot config is:
BR2_riscv=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="<path to built crosstool-ng toolchain>" BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="$(ARCH)-unknown-linux-gnu" BR2_TOOLCHAIN_EXTERNAL_HEADERS_6_11=y BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
# BR2_STRIP_strip is not set
BR2_ROOTFS_MERGED_USR=y

Quoted 2 lines
Quoted 2 lines

- Charlie

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot