diff options
| author | Yogesh Tyagi <yogesh.tyagi@intel.com> | 2026-04-28 15:46:16 +0800 |
|---|---|---|
| committer | Yogesh Tyagi <yogesh.tyagi@intel.com> | 2026-04-29 21:15:11 +0800 |
| commit | 1cd9b78e1ba91bfeb1e716de15edda1d63a82337 (patch) | |
| tree | 6f672a5433b8fb4abd21962f48ccb3e36858b7b4 | |
| parent | 511ddb7ea90499b2088248f59bab3e9d6f3c900c (diff) | |
| download | meta-intel-1cd9b78e1ba91bfeb1e716de15edda1d63a82337.tar.gz | |
classes: add oneapi-vendor-compat bbclass
The Intel oneAPI DPC++/C++ compiler binaries (icx, icpx) shipped by
meta-intel as prebuilt installers have a fixed default -target triple
baked into the LLVM driver. As of the 2025.3.x bundle the triple is
'x86_64-unknown-linux-gnu' (LLVM's portable default); prior 2024.x
bundles used 'x86_64-oe-linux' (matching the OpenEmbedded nodistro
default of TARGET_VENDOR=oe). icx also emits 'x86_64-linux-gnu' (the
Debian/Ubuntu host triple) in some search paths.
Yocto distros set TARGET_VENDOR differently: poky uses 'poky'
(TARGET_SYS=x86_64-poky-linux), nodistro uses 'oe', etc. The result
is a vendor-triple mismatch: icx looks for crtbeginS.o /
bits/c++config.h and similar files under one triple while they are
installed at another.
Until Intel either ships per-vendor variants or the meta-intel oneAPI
recipes patch the prebuilt binaries, install a set of compatibility
symlinks at rootfs time so every spelling of the multilib vendor
triple resolves to the same files on the image. The alias set is
configurable via ONEAPI_VENDOR_TRIPLE_ALIASES; entries that already
match the native target triple are skipped, so the class is a no-op
on images whose native vendor matches every alias.
Usage: add to IMAGE_CLASSES in a distro / local config that consumes
the Intel oneAPI compiler:
IMAGE_CLASSES += "oneapi-vendor-compat"
Signed-off-by: Yogesh Tyagi <yogesh.tyagi@intel.com>
| -rw-r--r-- | classes/oneapi-vendor-compat.bbclass | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/classes/oneapi-vendor-compat.bbclass b/classes/oneapi-vendor-compat.bbclass new file mode 100644 index 00000000..49776d22 --- /dev/null +++ b/classes/oneapi-vendor-compat.bbclass | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | # SPDX-License-Identifier: MIT | ||
| 2 | # | ||
| 3 | # oneapi-vendor-compat.bbclass | ||
| 4 | # | ||
| 5 | # The Intel oneAPI DPC++/C++ compiler binaries (icx, icpx) shipped by | ||
| 6 | # meta-intel as prebuilt installers have a fixed default ``-target`` triple | ||
| 7 | # baked into the LLVM driver. As of the 2025.3.x bundle the triple is | ||
| 8 | # ``x86_64-unknown-linux-gnu`` (LLVM's portable default); prior bundles used | ||
| 9 | # ``x86_64-oe-linux`` (matching the OpenEmbedded ``nodistro`` default of | ||
| 10 | # ``TARGET_VENDOR=oe``). | ||
| 11 | # | ||
| 12 | # Yocto distros set ``TARGET_VENDOR`` differently: poky uses ``poky`` | ||
| 13 | # (TARGET_SYS=``x86_64-poky-linux``), nodistro uses ``oe``, etc. The result | ||
| 14 | # is a vendor-triple mismatch: icx looks for ``crtbeginS.o`` / | ||
| 15 | # ``bits/c++config.h`` and similar files under one triple while they are | ||
| 16 | # installed at another. | ||
| 17 | # | ||
| 18 | # Until Intel either ships per-vendor variants or the meta-intel oneAPI | ||
| 19 | # recipes patch the prebuilt binaries, this class installs a set of | ||
| 20 | # compatibility symlinks at rootfs time so every spelling of the multilib | ||
| 21 | # vendor triple resolves to the same files on the image. The class is a | ||
| 22 | # no-op when the native vendor triple already matches every alias. | ||
| 23 | # | ||
| 24 | # Usage: add to IMAGE_CLASSES in a distro / local config that consumes | ||
| 25 | # the Intel oneAPI compiler:: | ||
| 26 | # | ||
| 27 | # IMAGE_CLASSES += "oneapi-vendor-compat" | ||
| 28 | # | ||
| 29 | |||
| 30 | # Native triple as provided by Yocto for the target sysroot. | ||
| 31 | ONEAPI_VENDOR_TRIPLE_NATIVE ?= "${TARGET_SYS}" | ||
| 32 | |||
| 33 | # Aliases icx may resolve at runtime, in priority order: | ||
| 34 | # - x86_64-unknown-linux-gnu : LLVM portable default (oneAPI 2025.x) | ||
| 35 | # - x86_64-linux-gnu : Debian/Ubuntu host triple (icx -v output) | ||
| 36 | # - x86_64-oe-linux : OE nodistro (oneAPI 2024.x) | ||
| 37 | ONEAPI_VENDOR_TRIPLE_ALIASES ?= " \ | ||
| 38 | ${TARGET_ARCH}-unknown-${TARGET_OS} \ | ||
| 39 | ${TARGET_ARCH}-${TARGET_OS}-gnu \ | ||
| 40 | ${TARGET_ARCH}-oe-${TARGET_OS} \ | ||
| 41 | " | ||
| 42 | |||
| 43 | oneapi_vendor_compat_rootfs() { | ||
| 44 | native="${ONEAPI_VENDOR_TRIPLE_NATIVE}" | ||
| 45 | |||
| 46 | for alias in ${ONEAPI_VENDOR_TRIPLE_ALIASES}; do | ||
| 47 | if [ "${alias}" = "${native}" ]; then | ||
| 48 | continue | ||
| 49 | fi | ||
| 50 | |||
| 51 | # gcc multilib library tree (crt*.o, libgcc.a, etc). | ||
| 52 | if [ -d "${IMAGE_ROOTFS}/usr/lib/${native}" ] && \ | ||
| 53 | [ ! -e "${IMAGE_ROOTFS}/usr/lib/${alias}" ]; then | ||
| 54 | ln -s "${native}" \ | ||
| 55 | "${IMAGE_ROOTFS}/usr/lib/${alias}" | ||
| 56 | fi | ||
| 57 | |||
| 58 | # multilib-aware C headers (e.g. asm/unistd_64.h). | ||
| 59 | if [ -d "${IMAGE_ROOTFS}/usr/include/${native}" ] && \ | ||
| 60 | [ ! -e "${IMAGE_ROOTFS}/usr/include/${alias}" ]; then | ||
| 61 | ln -s "${native}" \ | ||
| 62 | "${IMAGE_ROOTFS}/usr/include/${alias}" | ||
| 63 | fi | ||
| 64 | |||
| 65 | # libstdc++ vendor-keyed bits (bits/c++config.h, ext/*.h). | ||
| 66 | for cxxdir in "${IMAGE_ROOTFS}/usr/include/c++/"*/ ; do | ||
| 67 | if [ -d "${cxxdir}/${native}" ] && \ | ||
| 68 | [ ! -e "${cxxdir}/${alias}" ]; then | ||
| 69 | ln -s "${native}" \ | ||
| 70 | "${cxxdir}/${alias}" | ||
| 71 | fi | ||
| 72 | done | ||
| 73 | done | ||
| 74 | } | ||
| 75 | |||
| 76 | ROOTFS_POSTPROCESS_COMMAND:append = " oneapi_vendor_compat_rootfs;" | ||
