Skip to content

rust: fix llvm build failure on macOS due to uuid_string_t conflict#29673

Open
BKPepe wants to merge 1 commit into
openwrt:masterfrom
BKPepe:macos-rust-host-compile
Open

rust: fix llvm build failure on macOS due to uuid_string_t conflict#29673
BKPepe wants to merge 1 commit into
openwrt:masterfrom
BKPepe:macos-rust-host-compile

Conversation

@BKPepe

@BKPepe BKPepe commented Jun 8, 2026

Copy link
Copy Markdown
Member

Maintainer: @lu-zero

⚠️ Compile tested on macOS 26.5.1 for OpenWrt 24.10
Ping @httpstorm , It should also happen on the OpenWrt master branch. Could you please check it there, if it is not my local issue? Based on your findings, I will try to upstream the patch.


When building host-rustc (which builds LLVM) on macOS, if the libuuid package from Homebrew or MacPorts is installed, its <uuid/uuid.h> header shadows the macOS SDK's <uuid/uuid.h>.

The libuuid header does not define the uuid_string_t typedef (which is normally typedef char uuid_string_t[37]), leading to a compilation failure in LLVM's LockFileManager.cpp:

  FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/LockFileManager.cpp.o
  /usr/bin/c++ ... -isystem .../staging_dir/host/include ... -c .../LockFileManager.cpp
  .../LockFileManager.cpp:92:3: error: unknown type name 'uuid_string_t'
     92 |   uuid_string_t UUIDStr;
        |   ^
  1 error generated.

The root cause is the -isystem .../staging_dir/host/include flag, which adds the Homebrew libuuid header path before the macOS SDK, shadowing the system uuid/uuid.h that defines uuid_string_t.

Avoid this conflict by explicitly declaring char UUIDStr[37] instead of uuid_string_t UUIDStr, which is portable and fully compatible with both the system SDK and libuuid headers.

Tested by building lang/rust from clean on macOS (Apple Silicon):

make package/feeds/packages/rust/host/compile

When building host-rustc (which builds LLVM) on macOS, if the libuuid
package from Homebrew or MacPorts is installed, its <uuid/uuid.h> header
shadows the macOS SDK's <uuid/uuid.h>.

The libuuid header does not define the uuid_string_t typedef (which is
normally typedef char uuid_string_t[37]), leading to a compilation
failure in LLVM's LockFileManager.cpp:

  FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/LockFileManager.cpp.o
  /usr/bin/c++ ... -isystem .../staging_dir/host/include ... -c .../LockFileManager.cpp
  .../LockFileManager.cpp:92:3: error: unknown type name 'uuid_string_t'
     92 |   uuid_string_t UUIDStr;
        |   ^
  1 error generated.

The root cause is the -isystem .../staging_dir/host/include flag, which
adds the Homebrew libuuid header path before the macOS SDK, shadowing
the system uuid/uuid.h that defines uuid_string_t.

Avoid this conflict by explicitly declaring char UUIDStr[37] instead of
uuid_string_t UUIDStr, which is portable and fully compatible with both
the system SDK and libuuid headers.

Tested by building lang/rust from clean on macOS (Apple Silicon):
  make package/feeds/packages/rust/host/compile

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Copilot AI review requested due to automatic review settings June 8, 2026 09:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@httpstorm

Copy link
Copy Markdown
Contributor

@BKPepe
For me the build fails at a very early stage, before the file affected by this patch is compiled. How do I get past this error and do I need to enable anything in make menuconfig? Currently Languages, Rust, rust is not selected.

# main
make package/feeds/packages/rust/host/compile -j 1 V=s
WARNING: Makefile 'package/feeds/packages/lxc/Makefile' has a dependency on 'shadow-newuidmap', which does not exist
WARNING: Makefile 'package/feeds/packages/lxc/Makefile' has a dependency on 'shadow-newgidmap', which does not exist
WARNING: Makefile 'package/feeds/packages/onionshare-cli/Makefile' has a dependency on 'python3-pysocks', which does not exist
WARNING: Makefile 'package/feeds/packages/onionshare-cli/Makefile' has a dependency on 'python3-unidecode', which does not exist
make[2]: Entering directory '/Volumes/pepe/py/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/Volumes/pepe/py/openwrt/scripts/config'
make[1]: Entering directory '/Volumes/pepe/py/openwrt'
make[2]: Entering directory '/Volumes/pepe/py/openwrt/feeds/packages/lang/rust'
. /Volumes/pepe/py/openwrt/include/shell.sh; xzcat /Volumes/pepe/py/openwrt/dl/rustc-1.96.0-src.tar.xz | tar -C /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/* /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src

Applying /Volumes/pepe/py/openwrt/feeds/packages/lang/rust/patches/0001-Update-xz2-and-use-it-static.patch using plaintext: 
patching file src/bootstrap/Cargo.toml

Applying /Volumes/pepe/py/openwrt/feeds/packages/lang/rust/patches/0002-llvm-uuid-string-t-macos-fix.patch using plaintext: 
patching file src/llvm-project/llvm/lib/Support/LockFileManager.cpp
Hunk #1 succeeded at 90 (offset 1 line).
touch /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/.prepared81f661cde87a060829f6b7efafe7fa1d_6664517399ebbbc92a37c5bb081b5c53
(cd /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/; if [ -x configure ]; then cp -fpR /Volumes/pepe/py/openwrt/scripts/config.{guess,sub} /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src// && CC="/Volumes/pepe/py/openwrt/staging_dir/host/bin/gcc" CFLAGS="-O2 -I/Volumes/pepe/py/openwrt/staging_dir/host/include -I/Volumes/pepe/py/openwrt/staging_dir/hostpkg/include -I/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/include" CXX="/Volumes/pepe/py/openwrt/staging_dir/host/bin/g++" CPPFLAGS="-I/Volumes/pepe/py/openwrt/staging_dir/host/include -I/Volumes/pepe/py/openwrt/staging_dir/hostpkg/include -I/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/include" CXXFLAGS="-O2 -I/Volumes/pepe/py/openwrt/staging_dir/host/include -I/Volumes/pepe/py/openwrt/staging_dir/hostpkg/include -I/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/include" LDFLAGS="-L/Volumes/pepe/py/openwrt/staging_dir/host/lib -L/Volumes/pepe/py/openwrt/staging_dir/hostpkg/lib -L/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/lib" CONFIG_SHELL="/usr/bin/env bash" CARGO_HOME="/Volumes/pepe/py/openwrt/dl/cargo"  bash ./configure --build=x86_64-unknown-linux- --target=x86_64-unknown-linux-musl,x86_64-unknown-linux- --host=x86_64-unknown-linux- --prefix=/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host --bindir=/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/bin --libdir=/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/lib --sysconfdir=/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/etc --datadir=/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/share --mandir=/Volumes/pepe/py/openwrt/staging_dir/target-x86_64_musl/host/man --dist-compression-formats=gz --disable-sanitizers --release-channel=stable --enable-cargo-native-static --bootstrap-cache-path=/Volumes/pepe/py/openwrt/dl/rustc --set=llvm.download-ci-llvm=false --set=target.x86_64-unknown-linux-musl.ar=x86_64-openwrt-linux-musl-gcc-ar --set=target.x86_64-unknown-linux-musl.cc=x86_64-openwrt-linux-musl-gcc --set=target.x86_64-unknown-linux-musl.cxx=x86_64-openwrt-linux-musl-g++ --set=target.x86_64-unknown-linux-musl.linker=x86_64-openwrt-linux-musl-gcc --set=target.x86_64-unknown-linux-musl.ranlib=x86_64-openwrt-linux-musl-gcc-ranlib --set=target.x86_64-unknown-linux-musl.crt-static=false --set=target.x86_64-unknown-linux-musl.musl-root=/Volumes/pepe/py/openwrt/staging_dir/toolchain-x86_64_gcc-14.3.0_musl ; fi )
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-', '--target=x8 ...
configure: build.build          := x86_64-unknown-linux-
configure: build.target         := ['x86_64-unknown-linux-musl', 'x86_64-unknown- ...
configure: build.host           := ['x86_64-unknown-linux-']
configure: install.prefix       := /Volumes/pepe/py/openwrt/staging_dir/target-x8 ...
configure: install.bindir       := /Volumes/pepe/py/openwrt/staging_dir/target-x8 ...
configure: install.libdir       := /Volumes/pepe/py/openwrt/staging_dir/target-x8 ...
configure: install.sysconfdir   := /Volumes/pepe/py/openwrt/staging_dir/target-x8 ...
configure: install.datadir      := /Volumes/pepe/py/openwrt/staging_dir/target-x8 ...
configure: install.mandir       := /Volumes/pepe/py/openwrt/staging_dir/target-x8 ...
configure: dist.compression-formats := ['gz']
configure: build.sanitizers     := False
configure: rust.channel         := stable
configure: build.cargo-native-static := True
configure: build.bootstrap-cache-path := /Volumes/pepe/py/openwrt/dl/rustc
configure: llvm.download-ci-llvm := False
configure: target.x86_64-unknown-linux-musl.ar := x86_64-openwrt-linux-musl-gcc-a ...
configure: target.x86_64-unknown-linux-musl.cc := x86_64-openwrt-linux-musl-gcc
configure: target.x86_64-unknown-linux-musl.cxx := x86_64-openwrt-linux-musl-g++
configure: target.x86_64-unknown-linux-musl.linker := x86_64-openwrt-linux-musl-g ...
configure: target.x86_64-unknown-linux-musl.ranlib := x86_64-openwrt-linux-musl-g ...
configure: target.x86_64-unknown-linux-musl.crt-static := False
configure: target.x86_64-unknown-linux-musl.musl-root := /Volumes/pepe/py/openwrt ...
configure: profile              := dist
configure: 
configure: writing `bootstrap.toml` in current directory
configure: 
configure: run `python3 /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/x.py --help`
touch /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/.configured
CARGO_HOME=/Volumes/pepe/py/openwrt/dl/cargo TARGET_CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/rust-1.96.0=rust-1.96.0 -Wl,-z,max-page-size=4096 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -Wl,-z,pack-relative-relocs" python3 /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/x.py --build-dir /Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/build dist build-manifest rustc rust-std cargo llvm-tools rust-src
Traceback (most recent call last):
  File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/x.py", line 53, in <module>
    bootstrap.main()
    ~~~~~~~~~~~~~~^^
  File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 1418, in main
    bootstrap(args)
    ~~~~~~~~~^^^^^^
  File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 1366, in bootstrap
    build.download_toolchain()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 697, in download_toolchain
    download_component(download_info)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 529, in download_component
    get(
    ~~~^
        download_info.base_download_url,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        verbose=download_info.verbose,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Volumes/pepe/py/openwrt/build_dir/target-x86_64_musl/host/rustc-1.96.0-src/src/bootstrap/bootstrap.py", line 58, in get
    raise RuntimeError(
    ...<6 lines>...
    )
RuntimeError: src/stage0 doesn't contain a checksum for dist/2026-04-16/rust-std-1.95.0-x86_64-unknown-linux-.tar.xz. Pre-built artifacts might not be available for this target at this time, see https://doc.rust-lang.org/nightly/rustc/platform-support.html for more information.


# openwrt-24.10
make package/feeds/packages/rust/host/compile -j 1 V=s
WARNING: Makefile 'package/feeds/packages/onionshare-cli/Makefile' has a dependency on 'python3-pysocks', which does not exist
WARNING: Makefile 'package/feeds/packages/onionshare-cli/Makefile' has a dependency on 'python3-unidecode', which does not exist
WARNING: Makefile 'package/feeds/packages/python-pika/Makefile' has a build dependency on 'python-setuptools/host', which does not exist
make[2]: Entering directory '/Volumes/pepe/_/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/Volumes/pepe/_/openwrt/scripts/config'
make[1]: Entering directory '/Volumes/pepe/_/openwrt'
make[2]: Entering directory '/Volumes/pepe/_/openwrt/feeds/packages/lang/rust'
. /Volumes/pepe/_/openwrt/include/shell.sh; xzcat /Volumes/pepe/_/openwrt/dl/rustc-1.90.0-src.tar.xz | tar -C /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/* /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src

Applying /Volumes/pepe/_/openwrt/feeds/packages/lang/rust/patches/0001-Update-xz2-and-use-it-static.patch using plaintext: 
patching file src/bootstrap/Cargo.toml

Applying /Volumes/pepe/_/openwrt/feeds/packages/lang/rust/patches/0002-llvm-uuid-string-t-macos-fix.patch using plaintext: 
patching file src/llvm-project/llvm/lib/Support/LockFileManager.cpp
touch /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/.prepared10c094ba284449c355fa3cab69215588_6664517399ebbbc92a37c5bb081b5c53
(cd /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/; if [ -x configure ]; then cp -fpR /Volumes/pepe/_/openwrt/scripts/config.{guess,sub} /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src// && CC="/Volumes/pepe/_/openwrt/staging_dir/host/bin/gcc" CFLAGS="-O2 -I/Volumes/pepe/_/openwrt/staging_dir/host/include -I/Volumes/pepe/_/openwrt/staging_dir/hostpkg/include -I/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/include" CXX="/Volumes/pepe/_/openwrt/staging_dir/host/bin/g++" CPPFLAGS="-I/Volumes/pepe/_/openwrt/staging_dir/host/include -I/Volumes/pepe/_/openwrt/staging_dir/hostpkg/include -I/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/include" CXXFLAGS="-O2 -I/Volumes/pepe/_/openwrt/staging_dir/host/include -I/Volumes/pepe/_/openwrt/staging_dir/hostpkg/include -I/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/include" LDFLAGS="-L/Volumes/pepe/_/openwrt/staging_dir/host/lib -L/Volumes/pepe/_/openwrt/staging_dir/hostpkg/lib -L/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/lib" CONFIG_SHELL="/usr/bin/env bash" CARGO_HOME="/Volumes/pepe/_/openwrt/dl/cargo"  bash ./configure --build=x86_64-unknown-linux- --target=x86_64-unknown-linux-musl,x86_64-unknown-linux- --host=x86_64-unknown-linux- --prefix=/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host --bindir=/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/bin --libdir=/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/lib --sysconfdir=/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/etc --datadir=/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/share --mandir=/Volumes/pepe/_/openwrt/staging_dir/target-x86_64_musl/host/man --dist-compression-formats=gz --disable-sanitizers --release-channel=stable --enable-cargo-native-static --bootstrap-cache-path=/Volumes/pepe/_/openwrt/dl/rustc --set=llvm.download-ci-llvm=false --set=target.x86_64-unknown-linux-musl.ar=x86_64-openwrt-linux-musl-gcc-ar --set=target.x86_64-unknown-linux-musl.cc=x86_64-openwrt-linux-musl-gcc --set=target.x86_64-unknown-linux-musl.cxx=x86_64-openwrt-linux-musl-g++ --set=target.x86_64-unknown-linux-musl.linker=x86_64-openwrt-linux-musl-gcc --set=target.x86_64-unknown-linux-musl.ranlib=x86_64-openwrt-linux-musl-gcc-ranlib --set=target.x86_64-unknown-linux-musl.crt-static=false --set=target.x86_64-unknown-linux-musl.musl-root=/Volumes/pepe/_/openwrt/staging_dir/toolchain-x86_64_gcc-13.3.0_musl ; fi )
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-', '--target=x8 ...
configure: build.build          := x86_64-unknown-linux-
configure: build.target         := ['x86_64-unknown-linux-musl', 'x86_64-unknown- ...
configure: build.host           := ['x86_64-unknown-linux-']
configure: install.prefix       := /Volumes/pepe/_/openwrt/staging_dir/target-x86 ...
configure: install.bindir       := /Volumes/pepe/_/openwrt/staging_dir/target-x86 ...
configure: install.libdir       := /Volumes/pepe/_/openwrt/staging_dir/target-x86 ...
configure: install.sysconfdir   := /Volumes/pepe/_/openwrt/staging_dir/target-x86 ...
configure: install.datadir      := /Volumes/pepe/_/openwrt/staging_dir/target-x86 ...
configure: install.mandir       := /Volumes/pepe/_/openwrt/staging_dir/target-x86 ...
configure: dist.compression-formats := ['gz']
configure: build.sanitizers     := False
configure: rust.channel         := stable
configure: build.cargo-native-static := True
configure: build.bootstrap-cache-path := /Volumes/pepe/_/openwrt/dl/rustc
configure: llvm.download-ci-llvm := False
configure: target.x86_64-unknown-linux-musl.ar := x86_64-openwrt-linux-musl-gcc-a ...
configure: target.x86_64-unknown-linux-musl.cc := x86_64-openwrt-linux-musl-gcc
configure: target.x86_64-unknown-linux-musl.cxx := x86_64-openwrt-linux-musl-g++
configure: target.x86_64-unknown-linux-musl.linker := x86_64-openwrt-linux-musl-g ...
configure: target.x86_64-unknown-linux-musl.ranlib := x86_64-openwrt-linux-musl-g ...
configure: target.x86_64-unknown-linux-musl.crt-static := False
configure: target.x86_64-unknown-linux-musl.musl-root := /Volumes/pepe/_/openwrt/ ...
configure: profile              := dist
configure: 
configure: writing `bootstrap.toml` in current directory
configure: 
configure: run `python3 /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/x.py --help`
touch /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/.configured
CARGO_HOME=/Volumes/pepe/_/openwrt/dl/cargo TARGET_CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/rust-1.90.0=rust-1.90.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" python3 /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/x.py --build-dir /Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/build dist build-manifest rustc rust-std cargo llvm-tools rust-src
Traceback (most recent call last):
  File "/Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/x.py", line 53, in <module>
    bootstrap.main()
  File "/Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/src/bootstrap/bootstrap.py", line 1377, in main
    bootstrap(args)
  File "/Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/src/bootstrap/bootstrap.py", line 1342, in bootstrap
    build.download_toolchain()
  File "/Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/src/bootstrap/bootstrap.py", line 684, in download_toolchain
    download_component(download_info)
  File "/Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/src/bootstrap/bootstrap.py", line 517, in download_component
    get(
  File "/Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/src/bootstrap/bootstrap.py", line 58, in get
    raise RuntimeError(
RuntimeError: src/stage0 doesn't contain a checksum for dist/2025-08-07/rust-std-1.89.0-x86_64-unknown-linux-.tar.xz. Pre-built artifacts might not be available for this target at this time, see https://doc.rust-lang.org/nightly/rustc/platform-support.html for more information.

By the way since this PR is targeting the master branch, you need to update your patch, else I see this warning:

Applying /Volumes/pepe/py/openwrt/feeds/packages/lang/rust/patches/0002-llvm-uuid-string-t-macos-fix.patch using plaintext: 
patching file src/llvm-project/llvm/lib/Support/LockFileManager.cpp
Hunk #1 succeeded at 90 (offset 1 line).

I do not have libuuid installed at the moment, but I can install it to test your patch, once I manage to get past the other error. Here is the list of my brew packages on macOS 15.7.7 Intel:

brew list
aom
apache-serf
apr
apr-util
arping
asciidoc
autoconf
automake
bash
bc
bdw-gc
berkeley-db
berkeley-db@5
binutils
binwalk
bison
boost
brotli
byacc
bzip2
c-ares
ca-certificates
cairo
certifi
cjson
clang-format
cmake
coreutils
curl
dash
dash-shell
dav1d
deno
dfu-util
diffutils
docbook
duti
e2fsprogs
expat
fastjar
ffmpeg
findutils
flac
flex
fontconfig
freetype
fribidi
gawk
gcc
gdb
gdbm
gettext
giflib
git
git-extras
gitleaks
glib
glow
gmp
gnu-getopt
gnu-sed
gnu-tar
gnu-which
gnupg
gnutls
gpatch
gperf
gping
gputils
graphite2
grep
guile
gzip
harfbuzz
hashcat
highway
htop
icu4c@76
icu4c@77
icu4c@78
imagemagick
imath
intltool
isl
jansson
jemalloc
john-jumbo
jpeg-turbo
jpeg-xl
lame
ldns
less
libarchive
libass
libassuan
libavif
libb2
libbluray
libcbor
libde265
libdeflate
libev
libevent
libffi
libfido2
libgcrypt
libgpg-error
libheif
libidn2
libimagequant
libimobiledevice
libimobiledevice-glue
libksba
liblinear
libmetalink
libmpc
libnet
libnghttp2
libnghttp3
libngtcp2
libogg
libomp
libplacebo
libplist
libpng
libraqm
libsamplerate
libsndfile
libssh2
libtasn1
libtatsu
libtiff
libtommath
libtool
libudfread
libunibreak
libunistring
libusb
libusbmuxd
libuv
libvmaf
libvorbis
libvpx
libwebsockets
libx11
libxau
libxcb
libxdmcp
libxext
libxml2
libxrender
libxslt
libyaml
little-cms2
lua
luajit
lz4
lzo
m4
mad
make
mercurial
minizip
molten-vk
mosquitto
mpdecimal
mpfr
mpg123
mpv
mtr
mujs
nano
ncurses
netcat
nettle
nghttp2
nmap
npth
numpy
openblas
openexr
openjpeg
openjph
openldap
openssh
openssl@1.1
openssl@3
opus
opusfile
p11-kit
p7zip
pandoc
patchutils
pcre
pcre2
perl
pillow
pinentry
pixman
pkgconf
pstree
python-certifi
python-matplotlib
python-setuptools
python@3.12
python@3.14
qhull
quilt
readline
rtmpdump
rubberband
ruby
rustup
rustup-init
screen
sdl2
shaderc
socat
source-highlight
sox
sqlite
ssdeep
stlink
subversion
svt-av1
swig
tcl-tk
texinfo
tree
uchardet
unbound
unzip
utf8proc
vapoursynth
vulkan-headers
vulkan-loader
watch
webp
wget
x264
x265
xorgproto
xxhash
xz
youtube-dl
yt-dlp
zimg
zlib
zstd
android-ndk
gcc-arm-embedded

@BKPepe

BKPepe commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

Regarding your issue in main branch and openwrt-24.10 branch, I think the issue is here:

configure: build.configure-args := ['--build=x86_64-unknown-linux-', '--target=x8 ...
configure: build.build          := x86_64-unknown-linux-
configure: build.target         := ['x86_64-unknown-linux-musl', 'x86_64-unknown- ...
configure: build.host           := ['x86_64-unknown-linux-']

This is fixed for Darwin's arm64 as you can see here:

ifeq ($(HOST_OS),Darwin)
by #21837 exactly the issue which you are describing (but it was for arm64).

For your issue, I think this one should help as workaround:

-RUSTC_HOST_SUFFIX:=$(word 4, $(subst -, ,$(GNU_HOST_NAME)))
+RUSTC_HOST_SUFFIX:=$(lastword $(subst -, ,$(GNU_HOST_NAME)))

This is my brew list on MacOS Tahoe (26.5.1), Apple M3:

brew list
==> Formulae
apr				gsmartcontrol			libxtst
apr-util			gtk+3				lz4
at-spi2-core			gtkmm3				lzo
atkmm@2.28			harfbuzz			make
bash				hicolor-icon-theme		midnight-commander
ca-certificates			htop				minicom
cairo				icu4c@78			mpfr
cairomm@1.14			jpeg-turbo			ncurses
coreutils			libassuan			nettle
dbus				libepoxy			npth
diffutils			libevent			openssl@3
findutils			libgcrypt			p11-kit
fontconfig			libgpg-error			pango
freetype			libidn2				pangomm@2.46
fribidi				libksba				pcre2
gawk				libnghttp2			pinentry
gdk-pixbuf			libpng				pinentry-mac
gettext				libsigc++@2			pixman
git-extras			libssh2				pkgconf
glib				libtasn1			quilt
glibmm@2.66			libtiff				readline
gmp				libunistring			s-lang
gnu-getopt			libusb				smartmontools
gnu-sed				libx11				subversion
gnu-tar				libxau				unbound
gnupg				libxcb				utf8proc
gnutls				libxdmcp			wget
gpatch				libxext				xorgproto
graphite2			libxfixes			xz
grep				libxi				zstd
gsettings-desktop-schemas	libxrender

==> Casks
stats

@httpstorm

Copy link
Copy Markdown
Contributor

Thanks! This helped. After many trials and errors, I found this fix:

--- a/lang/rust/rust-values.mk
+++ b/lang/rust/rust-values.mk
@@ -32,6 +32,8 @@ CARGO_RUSTFLAGS+=-Ctarget-feature=-crt-static $(RUSTC_LDFLAGS)
 ifeq ($(HOST_OS),Darwin)
   ifeq ($(HOST_ARCH),arm64)
     RUSTC_HOST_ARCH:=aarch64-apple-darwin
+  else ifeq ($(HOST_ARCH),x86_64)
+    RUSTC_HOST_ARCH:=x86_64-apple-darwin
   endif
 endif
 

The first part is not needed:

-RUSTC_HOST_SUFFIX:=$(word 4, $(subst -, ,$(GNU_HOST_NAME)))
+RUSTC_HOST_SUFFIX:=$(lastword $(subst -, ,$(GNU_HOST_NAME)))

I opened a PR #29685. Let me know if you want me to include it there.

Build logs: Ignore the No space left on device, I got this many times, until I freed enough space and it compiled.
01-rust-v24.10.txt
02-rust-main.txt

@httpstorm

Copy link
Copy Markdown
Contributor

A libuuid package is not available on Homebrew and I also don't see it on the list of your installed libraries.

brew install libuuid
Warning: No available formula with the name "libuuid". Did you mean libcpuid?

Now that building with your patch works on both main and openwrt-24.10, I'll try to build without it.

@httpstorm

Copy link
Copy Markdown
Contributor

The openwrt-24.10 build without your patch failed 03-rust-v24.10-no-patch-fail.txt

/Volumes/pepe/_/openwrt/build_dir/target-x86_64_musl/host/rustc-1.90.0-src/src/llvm-project/llvm/lib/Support/LockFileManager.cpp:92:3: error: unknown type name 'uuid_string_t'
   92 |   uuid_string_t UUIDStr;
      |   ^

The main branch build without your patch succeeded 04-rust-main-no-patch-success.txt
I wonder why it builds successfully on main, both with and without your patch? Did the include-path order change?

Comparing ./staging_dir/host/include/uuid/uuid.h between openwrt-24.10, openwrt-25.12, and main shows that uuid_string_t is not defined in either. I will try to build openwrt-25.12 with and without the patch.

// /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/
// usr/include/uuid/uuid.h:41
// same on both Xcode 16.4 and Xcode 26.3

#ifndef _UUID_STRING_T
#define _UUID_STRING_T
typedef __darwin_uuid_string_t  uuid_string_t;
#endif /* _UUID_STRING_T */

@httpstorm

Copy link
Copy Markdown
Contributor

The openwrt-25.12 build succeeded, both with and without your patch:
05-rust-v25.12-no-patch-success.txt
06-rust-v25.12-success.txt

@BKPepe

BKPepe commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

I wonder why it builds successfully on main, both with and without your patch? Did the include-path order change?

Oh boy. 🤷 🤷 Honestly, I don't know. I will need to look into it further.

Thanks for looking into it. It is weird that it only fails on OpenWrt 24.10.
I cannot test it right now on OpenWrt 25.12 and the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants