rust-lang / rust-lang/libz-sys

MacOS: fails to compile

Open
#245 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Rust
Stars
138
Forks
88
PR merge metrics
No merged PRs in 30d

Description

  • MacOS Sequoia 15.5, Xcode-16.4.
  • rustc 1.88.0 (6b00bc388 2025-06-23)

Clang:

clang version 20.1.7
Target: x86_64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-20/bin
$ sudo port select clang apple-clang
Selecting 'apple-clang' for 'clang' succeeded. 'apple-clang' is now active.
$ clang --version
Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: x86_64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ 

Problem: C compiler hangs up trying to compile detect_compiler_family.c:

$ ifrun clang
1638356520  8311  8308   0 11:08AM ttys010    0:00.02 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E /var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/cargo-installom9ShE/release/build/libz-sys-d98ab235bd715166/out/16425769093887032327detect_compiler_family.c
1638356520  8312  8311   0 11:08AM ttys010    0:00.01 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -cc1 -triple x86_64-apple-macosx15.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -E -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name 16425769093887032327detect_compiler_family.c -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -ffp-contract=on -fno-rounding-math -funwind-tables=2 -target-sdk-version=15.5 -fvisibility-inlines-hidden-static-local-var -fdefine-target-os-macros -fno-assume-unique-vtables -fno-modulemap-allow-subdirectory-search -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -fdebug-compilation-dir=/Users/ur20980/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libz-sys-1.1.22 -target-linker-version 1167.5 -fcoverage-compilation-dir=/Users/ur20980/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libz-sys-1.1.22 -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fmax-type-align=16 -fcommon -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -clang-vendor-feature=+disableAtImportPrivateFrameworkInImplementationError -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o - -x c /var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/cargo-installom9ShE/release/build/libz-sys-d98ab235bd715166/out/16425769093887032327detect_compiler_family.c
$

The above picture does not change after 10 minutes, at which time I kill it manually.

Same with a different compiler:

$ ifrun clang
1638356520  9358  9355   0 11:24AM ttys010    0:00.76 /opt/local/libexec/llvm-20/bin/clang -E /var/folders/c6/lnc_0m093ys8w16md_fm1mnxhtfnj8/T/cargo-installs4pgCn/release/build/libz-sys-d98ab235bd715166/out/14215467920557312181detect_compiler_family.c
$

The only way to successfully pass this hurdle is to set default compiler to GCC. Which is not my preference/

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the hang while building libz-sys with Apple Clang or LLVM Clang, focusing on the generated detect_compiler_family.c shown in the build output. Compare the compiler invocation with the GCC case and determine what change lets the crate compile without switching the default compiler; done means the macOS build completes successfully with Clang.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.