@@ -23,10 +23,19 @@ if(VITRUVIAN_CHROOT_BUILD)
2323 return ()
2424 endif ()
2525
26- # Full sysroot: redirects gcc's implicit header/library search into the chroot
26+ set (VITRUVIAN_MULTIARCH_TRIPLE "x86_64-linux-gnu" )
27+ if (DEFINED VITRUVIAN_TARGET_ARCH)
28+ if (VITRUVIAN_TARGET_ARCH STREQUAL "arm64" )
29+ set (VITRUVIAN_MULTIARCH_TRIPLE "aarch64-linux-gnu" )
30+ elseif (VITRUVIAN_TARGET_ARCH STREQUAL "arm" OR VITRUVIAN_TARGET_ARCH STREQUAL "arm32" )
31+ set (VITRUVIAN_MULTIARCH_TRIPLE "arm-linux-gnueabihf" )
32+ elseif (VITRUVIAN_TARGET_ARCH STREQUAL "riscv64" )
33+ set (VITRUVIAN_MULTIARCH_TRIPLE "riscv64-linux-gnu" )
34+ endif ()
35+ endif ()
36+
2737 set (CMAKE_SYSROOT "${VITRUVIAN_CHROOT_PATH} " )
2838
29- # Direct find_* to search chroot only (programs still from host)
3039 set (CMAKE_FIND_ROOT_PATH "${VITRUVIAN_CHROOT_PATH} " )
3140 set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
3241 set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
@@ -36,27 +45,21 @@ if(VITRUVIAN_CHROOT_BUILD)
3645 set (HEADERS_PATH_BASE "${VITRUVIAN_CHROOT_PATH} /usr/include"
3746 CACHE PATH "Base path for system headers" )
3847
39- # pkg-config: point at chroot .pc files
4048 set (ENV{PKG_CONFIG_SYSROOT_DIR} "${VITRUVIAN_CHROOT_PATH} " )
4149 set (ENV{PKG_CONFIG_LIBDIR}
42- "${VITRUVIAN_CHROOT_PATH} /usr/lib/x86_64-linux-gnu /pkgconfig:${VITRUVIAN_CHROOT_PATH} /usr/share/pkgconfig" )
50+ "${VITRUVIAN_CHROOT_PATH} /usr/lib/${VITRUVIAN_MULTIARCH_TRIPLE} /pkgconfig:${VITRUVIAN_CHROOT_PATH} /usr/share/pkgconfig" )
4351 set (ENV{PKG_CONFIG_PATH} "" )
4452
45- # Multiarch system headers (e.g. sys/uio.h, sys/types.h live here on Debian/Ubuntu)
46- include_directories (SYSTEM "${VITRUVIAN_CHROOT_PATH} /usr/include/x86_64-linux-gnu" )
53+ include_directories (SYSTEM "${VITRUVIAN_CHROOT_PATH} /usr/include/${VITRUVIAN_MULTIARCH_TRIPLE} " )
4754
48- # Linker search paths inside chroot
4955 link_directories (
50- "${VITRUVIAN_CHROOT_PATH} /usr/lib/x86_64-linux-gnu "
51- "${VITRUVIAN_CHROOT_PATH} /lib/x86_64-linux-gnu "
56+ "${VITRUVIAN_CHROOT_PATH} /usr/lib/${VITRUVIAN_MULTIARCH_TRIPLE} "
57+ "${VITRUVIAN_CHROOT_PATH} /lib/${VITRUVIAN_MULTIARCH_TRIPLE} "
5258 "${VITRUVIAN_CHROOT_PATH} /usr/lib"
5359 )
5460
55- # Binaries are installed into the live image where libs are in standard paths;
56- # skip RPATH to avoid host/chroot path conflicts in CMake's RPATH generator.
5761 set (CMAKE_SKIP_RPATH TRUE )
5862
59- # Kernel headers from chroot image kernel
6063 if (NOT KERNEL_RELEASE)
6164 message (FATAL_ERROR "KERNEL_RELEASE not set. Pass -DKERNEL_RELEASE=<version>." )
6265 endif ()
7578 CACHE PATH "Kernel headers for nexus-dkms" )
7679 endif ()
7780endif ()
78-
79- # ARM64 cross-compilation: not supported yet
80- if (VITRUVIAN_TARGET_ARCH STREQUAL "arm64" )
81- message (FATAL_ERROR "ARM64 cross-compilation is not yet supported." )
82- endif ()
0 commit comments