Skip to content

Fix cross-compiling for Apple platforms - #1389

Merged
NobodyXu merged 3 commits into
rust-lang:mainfrom
madsmtm:apple-cross-compile
Feb 8, 2025
Merged

NobodyXu merged 3 commits into
rust-lang:mainfrom
madsmtm:apple-cross-compile

Conversation

@madsmtm

@madsmtm madsmtm commented Feb 5, 2025 •

Copy link
Copy Markdown
Member

(So, of course we weren't done here...)

Basically, the only difference between this and pre-#1384 is that on visionOS and Mac Catalyst, we pass a versioned --target instead of unversioned --target + -mtargetos=.
This is similar to the alternative I noted in that PR, and while it does run into #1278 (the bug that configuration files + versioned targets are badly supported on older Clang) on those targets, I think that's the better option.

Fixes #1388. To avoid this in the future, I have added a CI step to verify that cross-compilation works (fails in the first commit, succeeds in the second).

Alternatives

I looked through Clang's parsing code, and from that I glean that an alternative would probably be to set --target + *_DEPLOYMENT_TARGET. This has a few problems though:

  • I suspect a lot of users are just inspecting Tool::args/.get_compiler().get_command().get_args(), and forget to also look at Tool::env (I know at least Rust's bootstrap currently forgets to do this).
  • This also doesn't force GCC users to use a compiler configured for Darwin (so we'd still have to pass -mmacosx-version-min= there) (probably acceptable to not do if we did Detect common misconfigurations on error #1391).

@madsmtm madsmtm added bug O-apple Apple targets and toolchains labels Feb 5, 2025
@madsmtm
madsmtm force-pushed the apple-cross-compile branch 2 times, most recently from 31e60ea to c12e9cb Compare February 5, 2025 08:58
@madsmtm
madsmtm force-pushed the apple-cross-compile branch from 9c4030b to ab6767e Compare February 5, 2025 09:30
@madsmtm
madsmtm force-pushed the apple-cross-compile branch 2 times, most recently from 03a896b to c60c0c4 Compare February 5, 2025 10:05
@madsmtm
madsmtm force-pushed the apple-cross-compile branch from c60c0c4 to bfdf3d5 Compare February 5, 2025 10:09
# Test with clang/llvm for now, has better cross-compilation support (GCC requires downloading a different toolchain)
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
echo "AR=llvm-ar" >> $GITHUB_ENV

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is unclear to me why llvm-ar is required here, it seems to not be on my local Ubuntu 24 VM? But if we don't include it, we fail with:

rust-lld: error: /home/runner/work/cc-rs/cc-rs/target/aarch64-apple-darwin/debug/build/cc-test-5875314a6fda6e38/out/libOptLinkage.a: archive has no index; run ranlib to add one
rust-lld: error: undefined symbol: _answer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No idea maybe there's some apple/clang stuff default ar not supporting?

@madsmtm
madsmtm marked this pull request as ready for review February 5, 2025 10:40
Comment thread tests/test.rs Resolved
@madsmtm
madsmtm requested a review from NobodyXu February 8, 2025 04:43
@clubby789

Copy link
Copy Markdown
Contributor

I'm not sure if this is relevant to the last fix, but trying to bump cc in rust gives us rust-lang/rust#136720 (comment)

clang-15: error: cannot specify '-mtargetos=ios14.2-macabi' along with '--target=arm64-apple-ios14.2-macabi'

@madsmtm
madsmtm force-pushed the apple-cross-compile branch from 7e36542 to 7854f2f Compare February 8, 2025 05:07
@madsmtm

madsmtm commented Feb 8, 2025

Copy link
Copy Markdown
Member Author

Hmm, that's what #1384 fixed.

Seems like it's not failing in bootstrap, but when building compiler-builtins. Maybe library/Cargo.lock was somehow updated to include the broken cc-rs version?

@NobodyXu NobodyXu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you!

@NobodyXu
NobodyXu merged commit 23c0ee3 into rust-lang:main Feb 8, 2025
@github-actions github-actions Bot mentioned this pull request Feb 8, 2025
@madsmtm
madsmtm deleted the apple-cross-compile branch February 8, 2025 14:35
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2025
…<try>

Bump bootstrap cc to 1.2.14 and cmake to 0.1.54

## Summary

Bump bootstrap's `cc` and `cmake` deps:

1. To make it easier to add new/unofficial targets. In particular, `cc` v1.2.4+ allows using env vars to pass target parameters to the `cc` crate. This was previously attempted in rust-lang#134344 but ran into macos-cross-to-iOS problems with `cmake` (and also rust-lang#136440, rust-lang#136720). See also discussions in rust-lang/cc-rs#1317.
2. Fix some flag inheritance warnings. Fixes rust-lang#136338.

## `cc` changelogs between `1.2.0` and `1.2.14`

> ## [1.2.14](rust-lang/cc-rs@cc-v1.2.13...cc-v1.2.14) - 2025-02-14
>
> ### Other
>
> - Regenerate target info ([rust-lang#1398](rust-lang/cc-rs#1398))
> - Add support for setting `-gdwarf-{version}` based on RUSTFLAGS ([rust-lang#1395](rust-lang/cc-rs#1395))
> - Add support for alternative network stack io-sock on QNX 7.1 aarch64 and x86_64 ([rust-lang#1312](rust-lang/cc-rs#1312))
>
> ## [1.2.13](rust-lang/cc-rs@cc-v1.2.12...cc-v1.2.13) - 2025-02-08
>
> ### Other
>
> - Fix cross-compiling for Apple platforms ([rust-lang#1389](rust-lang/cc-rs#1389))
>
> ## [1.2.12](rust-lang/cc-rs@cc-v1.2.11...cc-v1.2.12) - 2025-02-04
>
> ### Other
>
> - Split impl Build ([rust-lang#1382](rust-lang/cc-rs#1382))
> - Don't specify both `-target` and `-mtargetos=` on Apple targets ([rust-lang#1384](rust-lang/cc-rs#1384))
>
> ## [1.2.11](rust-lang/cc-rs@cc-v1.2.10...cc-v1.2.11) - 2025-01-31
>
> ### Other
>
> - Fix more flag inheritance ([rust-lang#1380](rust-lang/cc-rs#1380))
> - Include wrapper args. in `stdout` family heuristics to restore classifying `clang --driver-mode=cl` as `Msvc { clang_cl: true }` ([rust-lang#1378](rust-lang/cc-rs#1378))
> - Constrain `-Clto` and `-Cembed-bitcode` flag inheritance to be `clang`-only ([rust-lang#1379](rust-lang/cc-rs#1379))
> - Pass deployment target with `-m*-version-min=` ([rust-lang#1339](rust-lang/cc-rs#1339))
> - Regenerate target info ([rust-lang#1376](rust-lang/cc-rs#1376))
>
> ## [1.2.10](rust-lang/cc-rs@cc-v1.2.9...cc-v1.2.10) - 2025-01-17
>
> ### Other
>
> - Fix CC_FORCE_DISABLE=0 evaluating to true ([rust-lang#1371](rust-lang/cc-rs#1371))
> - Regenerate target info ([rust-lang#1369](rust-lang/cc-rs#1369))
> - Make hidden lifetimes explicit. ([rust-lang#1366](rust-lang/cc-rs#1366))
>
> ## [1.2.9](rust-lang/cc-rs@cc-v1.2.8...cc-v1.2.9) - 2025-01-12
>
> ### Other
>
> - Don't pass inherited PGO flags to GNU compilers (rust-lang#1363)
> - Adjusted zig cc judgment and avoided zigbuild errors([rust-lang#1360](rust-lang/cc-rs#1360)) ([rust-lang#1361](rust-lang/cc-rs#1361))
> - Fix compilation on macOS using clang and fix compilation using zig-cc ([rust-lang#1364](rust-lang/cc-rs#1364))
>
> ## [1.2.8](rust-lang/cc-rs@cc-v1.2.7...cc-v1.2.8) - 2025-01-11
>
> ### Other
>
> - Add `is_like_clang_cl()` getter (rust-lang#1357)
> - Fix clippy error in lib.rs ([rust-lang#1356](rust-lang/cc-rs#1356))
> - Regenerate target info ([rust-lang#1352](rust-lang/cc-rs#1352))
> - Fix compiler family detection issue with clang-cl on macOS ([rust-lang#1328](rust-lang/cc-rs#1328))
> - Update `windows-bindgen` dependency ([rust-lang#1347](rust-lang/cc-rs#1347))
> - Fix clippy warnings ([rust-lang#1346](rust-lang/cc-rs#1346))
>
> ## [1.2.7](rust-lang/cc-rs@cc-v1.2.6...cc-v1.2.7) - 2025-01-03
>
> ### Other
>
> - Regenerate target info ([rust-lang#1342](rust-lang/cc-rs#1342))
> - Document new supported architecture names in windows::find
> - Make is_flag_supported_inner take an &Tool ([rust-lang#1337](rust-lang/cc-rs#1337))
> - Fix is_flag_supported on msvc ([rust-lang#1336](rust-lang/cc-rs#1336))
> - Allow using Visual Studio target names in `find_tool` ([rust-lang#1335](rust-lang/cc-rs#1335))
>
> ## [1.2.6](rust-lang/cc-rs@cc-v1.2.5...cc-v1.2.6) - 2024-12-27
>
> ### Other
>
> - Don't inherit the `/Oy` flag for 64-bit targets ([rust-lang#1330](rust-lang/cc-rs#1330))
>
> ## [1.2.5](rust-lang/cc-rs@cc-v1.2.4...cc-v1.2.5) - 2024-12-19
>
> ### Other
>
> - Check linking when testing if compiler flags are supported ([rust-lang#1322](rust-lang/cc-rs#1322))
>
> ## [1.2.4](rust-lang/cc-rs@cc-v1.2.3...cc-v1.2.4) - 2024-12-13
>
> ### Other
>
> - Add support for C/C++ compiler for Neutrino QNX: `qcc` ([rust-lang#1319](rust-lang/cc-rs#1319))
> - use -maix64 instead of -m64 ([rust-lang#1307](rust-lang/cc-rs#1307))
>
> ## [1.2.3](rust-lang/cc-rs@cc-v1.2.2...cc-v1.2.3) - 2024-12-06
>
> ### Other
>
> - Improve detection of environment when compiling from msbuild or msvc ([rust-lang#1310](rust-lang/cc-rs#1310))
> - Better error message when failing on unknown targets ([rust-lang#1313](rust-lang/cc-rs#1313))
> - Optimize RustcCodegenFlags ([rust-lang#1305](rust-lang/cc-rs#1305))
>
> ## [1.2.2](rust-lang/cc-rs@cc-v1.2.1...cc-v1.2.2) - 2024-11-29
>
> ### Other
>
> - Inherit flags from rustc ([rust-lang#1279](rust-lang/cc-rs#1279))
> - Add support for using sccache wrapper with cuda/nvcc ([rust-lang#1304](rust-lang/cc-rs#1304))
> - Fix msvc stdout not shown on error ([rust-lang#1303](rust-lang/cc-rs#1303))
> - Regenerate target info ([rust-lang#1301](rust-lang/cc-rs#1301))
> - Fix compilation of C++ code for armv7-unknown-linux-gnueabihf ([rust-lang#1298](rust-lang/cc-rs#1298))
> - Fetch target info from Cargo even if `Build::target` is manually set ([rust-lang#1299](rust-lang/cc-rs#1299))
> - Fix two files with different extensions having the same object name ([rust-lang#1295](rust-lang/cc-rs#1295))
> - Allow disabling cc's ability to compile via env var CC_FORCE_DISABLE ([rust-lang#1292](rust-lang/cc-rs#1292))
> - Regenerate target info ([rust-lang#1293](rust-lang/cc-rs#1293))
>
> ## [1.2.1](rust-lang/cc-rs@cc-v1.2.0...cc-v1.2.1) - 2024-11-14
>
> ### Other
>
> - When invoking `cl -?`, set stdin to null ([rust-lang#1288](rust-lang/cc-rs#1288))

## `cmake` changelogs `0.1.51` to `0.1.54`

> ## [0.1.54](rust-lang/cmake-rs@v0.1.53...v0.1.54) - 2025-02-10
>
> ### Other
>
> - Remove workaround for broken `cc-rs` versions ([rust-lang#235](rust-lang/cmake-rs#235))
> - Be more precise in the description of `register_dep` ([rust-lang#238](rust-lang/cmake-rs#238))
>
> ## [0.1.53](rust-lang/cmake-rs@v0.1.52...v0.1.53) - 2025-01-27
>
> ### Other
>
> - Disable broken Make jobserver support on OSX to fix parallel builds ([rust-lang#229](rust-lang/cmake-rs#229))
>
> ## [0.1.52](rust-lang/cmake-rs@v0.1.51...v0.1.52) - 2024-11-25
>
> ### Other
>
> - Expose cc-rs no_default_flags for hassle-free cross-compilation ([rust-lang#225](rust-lang/cmake-rs#225))
> - Add a `success` job to CI
> - Change `--build` to use an absolute path
> - Merge pull request [rust-lang#195](rust-lang/cmake-rs#195) from meowtec/feat/improve-fail-hint
> - Improve hint for cmake not installed in Linux (code 127)
>
> ## [0.1.51](rust-lang/cmake-rs@v0.1.50...v0.1.51) - 2024-08-15
>
> ### Added
>
> - Add JOM generator support ([rust-lang#183](rust-lang/cmake-rs#183))
> - Improve visionOS support ([rust-lang#209](rust-lang/cmake-rs#209))
> - Use `Generic` for bare-metal systems ([rust-lang#187](rust-lang/cmake-rs#187))
>
> ### Fixed
>
> - Fix cross compilation on android armv7 and x86 ([rust-lang#186](rust-lang/cmake-rs#186))

try-job: dist-apple-various
wangchen-vivo pushed a commit to wangchen-vivo/cc-rs that referenced this pull request Aug 13, 2026
zhaowenbo-vivo pushed a commit to vivoblueos/cc-rs that referenced this pull request Oct 14, 2026
* Update doc for detecting changes/upgrades of compilers (rust-lang#1218)

* chore: release (rust-lang#1220)

* Add auto cancellation for CI jobs (rust-lang#1222)

when pushing new commits to the PR, cancel the previous jobs

Signed-off-by: Jiahao XU <[email protected]>

* Reduce the need for the host target triple (rust-lang#1224)

* Fix wasm32-wasip1-threads:  shared-memory disallowed due to not compiled with 'atomics' or 'bulk-memory' features (rust-lang#1221)

* chore: release (rust-lang#1223)

* Remove incorrect "lib" prefixes in CXXSTDLIB doc comments (rust-lang#1228)

* chore: release (rust-lang#1229)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Use debug version of MSVC runtime library on debug (rust-lang#1231)

* Use debug version of MSVC runtime library on debug

Fixed rust-lang#1230

* Fix clippy

* chore: release (rust-lang#1232)

* Disable `CC_ENABLE_DEBUG_OUTPUT` if it is set to "0" (rust-lang#1234)

* Revert "Use debug version of MSVC runtime library on debug (rust-lang#1231)" (rust-lang#1237)

This reverts commit c80a706.

* chore: release (rust-lang#1235)

* Environment variables: For one accepting boolean, treat "0", "false" and empty env as false (rust-lang#1238)

* Add getenv_boolean

* Update Build methods to use getenv_boolean

And update getenv_boolean, to treat "false" as false.

* Fix Build::getenv_Boolean and treat empty env as false

* Env CC_ENABLE_DEBUG_OUTPUT: treat "false" or empty str as false

* Fix Build::getenv_boolean

* Fix clippy

* chore: release (rust-lang#1239)

* Regenerate target info (rust-lang#1243)

Co-authored-by: github-actions <[email protected]>

* chore: release (rust-lang#1244)

* Don't pass -fPIC by default on wasm (rust-lang#1245)

* Don't pass -fPIC by default on wasm

Fix rust-lang#1240

* Fix cargo fmt

* chore: release (rust-lang#1246)

* Add comment explaining why cc does not rebuild on env PATH change (rust-lang#1247)

* chore: release v1.1.31 (rust-lang#1248)

* Use Cargo's target information when possible (rust-lang#1225)

* Reduce the need for the host target triple

* Use Cargo's target information when possible

rustc's target triples generally only have a vague resemblance to each
other and to the information needed by `cc`. Let's instead prefer
`CARGO_CFG_*` variables when available, since these contain the
information directly from the compiler itself.

In the cases where it isn't available (i.e. when running outside of a
build script), we fall back to parsing the target triple, but instead of
doing it in an ad-hoc fashion with string manipulation, we do it in a
more structured fashion up front.

* Remove unnecessary derive

* Use pre-generated target information

* Use Cow<'static, str> in Target

* Remove redundant test

* Redo from_cargo_environment_variables to be more error resilient

* Fix after merge

* Appease clippy

* Add support for targets within MSRV

* Fix test

* Fix a few more tests

* Properly match previous behaviour

* Update to Rust 2024-10-25

* Use a `const` and binary search instead of a match

* Fix formatting

* Use `rustc`'s knowledge of LLVM/Clang target triples (rust-lang#1252)

* Rename Target -> TargetInfo

* Add LLVM target triple to TargetInfo

* Remove AppleOs wrapper struct

* Simplify SDK name lookup code

* Fix passing --target to Clang

Use the same LLVM target triple as rustc does

* Don't pass `--target` twice on Windows

* Simplify LLVM target triple version removal

* Appease clippy

* Fix naming mistake

* Simplify

* chore: release v1.1.32 (rust-lang#1250)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Reduce size of `cc::Build`  and size of generated targets (rust-lang#1257)

* chore: release v1.1.33 (rust-lang#1258)

* Apple: Remove redundant flags (rust-lang#1256)

* Refactor Apple flags

Non-functional change.

* Apple: Remove redundant architecture flags

The architecture is specified for Clang with the --target option, and
both -arch and -m32/-m64 are passed to GCC elsewhere (should probably be
changed to -march, but that's a different issue).

* Don't output version flag on Clang

It is redundant, the version is already specified in `-target`.

* Appease clippy

* chore: release v1.1.34 (rust-lang#1259)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Use -windows-gnu for all UEFI targets (rust-lang#1264)

This restores the behavior prior to
rust-lang#1252, when the UEFI targets were
hardcoded in src/lib.rs.

* Do not add -fPIC by default on UEFI targets (rust-lang#1263)

This fixes a regression caused by 290a629.

* Remove support for FRC (rust-lang#1268)

* chore: release v1.1.35 (rust-lang#1267)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix CUDA build with clang++. (rust-lang#1273)

* chore: release v1.1.36 (rust-lang#1274)

* Regenerate target info (rust-lang#1280)

* Use relative directory for obj files hash (rust-lang#1270)

* chore: release v1.1.37 (rust-lang#1282)

* Fix WASM vs. WASI options (rust-lang#1284)

* windows_registry: Allow only specifying the architecture (rust-lang#1285)

* feat: add i686-pc-windows-gnullvm prefix detection (rust-lang#1283)

* chore: release v1.1.38 (rust-lang#1286)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* When invoking `cl -?`, set stdin to null (rust-lang#1288)

* chore: release v1.2.1 (rust-lang#1289)

* CI: Cap release at once per week (rust-lang#1291)

Signed-off-by: Jiahao XU <[email protected]>

* Regenerate target info (rust-lang#1293)

* Allow disabling cc's ability to compile via env var CC_FORCE_DISABLE (rust-lang#1292)

* Fix two files with different extensions having the same object name (rust-lang#1295)

* Fix: Fetch target info from Cargo even if `Build::target` is manually set (rust-lang#1299)

* Fix compilation of C++ code for armv7-unknown-linux-gnueabihf (rust-lang#1298)

* Regenerate target info (rust-lang#1301)

Co-authored-by: github-actions <[email protected]>

* CI: Avoid running scheduled jobs on forks (rust-lang#1302)

* Fix msvc stdout not shown on error (rust-lang#1303)

* Fix msvc stdout not shown on error

Fixed rust-lang#1260

* Fix clippy lint

* Call disable_localization unconditionally

* Call disable_localization in try_get_compiler`

* Set localization env based on msvc

* Fix setting env

* Fix fmt

* Fix confusing wording in comment

* Add support for using sccache wrapper with cuda/nvcc (rust-lang#1304)

* build: Inherit flags from rustc (rust-lang#1279)

* chore: release v1.2.2 (rust-lang#1306)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Optimize RustcCodegenFlags (rust-lang#1305)

* Optimize RustcCodegenFlags

Use `&str` instead of `String`.

* Fix lifetime annotations

* Fix compilation

* Fix lifetime in flags.rs

And remove unnecessary `.into()`

* Fix compilation in flags.rs: Avoid allocation in prefix handling

* FIx cargo-fmt in flags.rs

* Better error message when failing on unknown targets (rust-lang#1313)

* Improve detection of environment when compiling from msbuild or msvc (rust-lang#1310)

* Enable manual-run of release-pr.yml (rust-lang#1318)

* chore: release v1.2.3 (rust-lang#1316)

* use -maix64 instead of -m64 (rust-lang#1307)

* Add support for C/C++ compiler for Neutrino QNX: `qcc` (rust-lang#1319)

* chore: release v1.2.4 (rust-lang#1320)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Check linking when testing if compiler flags are supported (rust-lang#1322)

* chore: release v1.2.5 (rust-lang#1323)

* Don't inherit the `/Oy` flag for 64-bit targets (rust-lang#1330)

* chore: release v1.2.6 (rust-lang#1333)

* CI: Fix caching (rust-lang#1334)

* CI: Fix caching

Create lockfile before invoking rust-cache to make sure it is invalidated when new versions of dependencies have released

* Fix main.yml

* Allow using Visual Studio target names in `find_tool` (rust-lang#1335)

* Allow using VS target names in find_tool

Also fix a bug in vs15plus_vc_paths due to shadowing of the `target` variable.

* code review update

* Fix is_flag_supported on msvc (rust-lang#1336)

* Make is_flag_supported_inner take an &Tool (rust-lang#1337)

* Document new supported architecture names in windows::find

* CI: Add "test-pass" job (rust-lang#1340)

* Regenerate target info (rust-lang#1342)

* chore: release v1.2.7 (rust-lang#1341)

* Fix cuda testing (rust-lang#1343)

Fix feature name

* Optimize CI (rust-lang#1344)

Parameterize cargo flags into matrix for parallel building and better caching

* Fix clippy warnings (rust-lang#1346)

Signed-off-by: Jiahao XU <[email protected]>

* Update `windows-bindgen` dependency (rust-lang#1347)

* Run regenerate-target-info on Thu (rust-lang#1349)

And run whenever the generation code has changed.

* Run regenerate-windows-sys on Thu (rust-lang#1348)

And run whenever the generation code has changed.

* Fix compiler family detection issue with clang-cl on macOS (rust-lang#1328)

* Fix opening PR in regenerate-target-info.yml (rust-lang#1351)

* Regenerate target info (rust-lang#1352)

* Fix opening PR in regenerate-windows-sys.yml (rust-lang#1353)

* Fix clippy error in lib.rs (rust-lang#1356)

* tool: Add `is_like_clang_cl()` getter (rust-lang#1357)

* chore: release v1.2.8 (rust-lang#1355)

* Fix compilation on macOS using clang and fix compilation using zig-cc (rust-lang#1364)

* Fix compilation on macOS using clang and fix zig-cc

* Reenable test detecting the regression

* Fix fmt in tool.rs

* Add comment

* Adjusted zig cc judgment and avoided zigbuild errors(rust-lang#1360) (rust-lang#1361)

* Adjusted zig cc judgment and avoided zigbuild errors(rust-lang#1360)

Adjusted is_zig_cc judgment and adjusted how supports_path_delimiter is handled.

* Update src/lib.rs

Co-authored-by: Jiahao XU <[email protected]>

* typo fix and format check

cargo fmt --check

* Revert "Update src/lib.rs"

This reverts commit a69d8bb.

---------

Co-authored-by: Jiahao XU <[email protected]>

* build: Don't pass inherited PGO flags to GNU compilers (rust-lang#1363)

Clang and GNU use different PGO libraries, so PGO flags inherited
from rustc should not automatically be passed to GNU compilers.

Fixes rust-lang#1354

* chore: release v1.2.9 (rust-lang#1365)

* Make hidden lifetimes explicit. (rust-lang#1366)

Mainline rustc has deprecated hidden lifetime parameters.

This change is required to build rustc with your own cc-rs fork.

* chore(ci): move ubuntu-20 job to ubuntu-22 (rust-lang#1368)

* Regenerate target info (rust-lang#1369)

* Fix CC_FORCE_DISABLE=0 evaluating to true (rust-lang#1371)

* chore: release v1.2.10 (rust-lang#1370)

* Update rusqlite requirement from 0.32.0 to 0.33.0 (rust-lang#1374)

* Regenerate target info (rust-lang#1376)

* Pass deployment target with `-m*-version-min=` (rust-lang#1339)

* Constrain `-Clto` and `-Cembed-bitcode` flag inheritance to be `clang`-only (rust-lang#1379)

* Include wrapper args. in `stdout` family heuristics to restore classifying `clang --driver-mode=cl` as `Msvc { clang_cl: true }` (rust-lang#1378)

* Fix more flag inheritance (rust-lang#1380)

* chore: release v1.2.11 (rust-lang#1377)

* Don't specify both `-target` and `-mtargetos=` on Apple targets (rust-lang#1384)

* allow specifying `rustc` when generating target information (rust-lang#1385)

* test: ensure `clang --driver-mode=cl` is MSVC- and `clang-cl`-like (rust-lang#1381)

* Split impl Build (rust-lang#1382)

* chore: release v1.2.12 (rust-lang#1387)

* Fix cross-compiling for Apple platforms (rust-lang#1389)

* chore: release v1.2.13 (rust-lang#1394)

* Add support for alternative network stack io-sock on QNX 7.1 aarch64 and x86_64 (rust-lang#1312)

* Add support for setting `-gdwarf-{version}` based on RUSTFLAGS (rust-lang#1395)

Detect if `-Zdwarf-version` (which will probably be stabilized soon
as `-Cdwarf-version`) was passed in RUSTFLAGS and set the corresponding
Clang/GCC option to the same value.

* Regenerate target info (rust-lang#1398)

* chore: release v1.2.14 (rust-lang#1400)

* Simplify the error output on failed `Command` invocation (rust-lang#1397)

* Always read from all `CFLAGS`-style flags (rust-lang#1401)

* Regenerate target info (rust-lang#1406)

* chore: release v1.2.15 (rust-lang#1408)

* Fix archiver detection for musl cross compilation (rust-lang#1404)

* Update windows-bindgen requirement from 0.59 to 0.60 (rust-lang#1412)

* Change flag ordering (rust-lang#1403)

* fix: force windows compiler to run in `out_dir` to prevent artifacts in cwd (rust-lang#1415)

* MSVC: Add LIB var when compiling flag_check (rust-lang#1417)

* Regenerate target info (rust-lang#1418)

* Fix regenerate-windows-sys.yml (rust-lang#1420)

Should run whenever the code is updated

* Fix gen-windows-sys-binding (rust-lang#1419)

--no-core is renamed to --no-deps

* Regenerate windows-sys binding (rust-lang#1422)

* Rename windows_targets.rs to windows_link.rs

* Update windows/mod.rs

* Fix windows-bindgen

* update windows-sys binding

* clang-cl: use `/arch:SSE2` for `x86` target arch (rust-lang#1425)

- Official Rust Windows targets require `SSE2` as part of baseline
  target features.
    - `i586` Windows target without SSE2 is in process of being removed,
      so wasn't changed in this commit.
- STL is built with `/arch:SSE2` and no longer `/arch:IA32` since
  <microsoft/STL#4741>.

This was noticed in rust-lang/rust CI for `i686-pc-windows-msvc`, where
`rustc_llvm` builds failed because `__m128i` wasn't available, and we
suspected it was due to `/arch:IA32`.

* chore: release v1.2.16 (rust-lang#1427)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update rusqlite requirement from 0.33.0 to 0.34.0 (rust-lang#1428)

* Added base support for `wasm32-wali-linux-musl` target (rust-lang#1373)

* Regenerate target info (rust-lang#1429)

* Parse `rustc` target names (rust-lang#1413)

Parse target names instead of using a pre-generated list.
Allows target names like those used by certain Linux distributions,
even when compiling outside build.rs.

* Fix failure from cargo not propagating because of pipe (rust-lang#1432)

* ci: fix creating issue comment (rust-lang#1433)

* Fix wasm32-wali-linux-musl target parsing (rust-lang#1434)

* Update windows-bindgen requirement from 0.60 to 0.61 (rust-lang#1436)

* Regenerate windows sys bindings (rust-lang#1437)

* Regenerate target info (rust-lang#1439)

* chore: release v1.2.17 (rust-lang#1435)

* Use compiler prefix `x86_64-linux-musl` (rust-lang#1443)

* Fix mips64-openwrt-linux-musl parsing (rust-lang#1449)

* Use `std::thread::available_parallelism` for determining the default number of jobs (rust-lang#1447)

* Regenerate target info (rust-lang#1450)

* chore: release v1.2.18 (rust-lang#1451)

* Fix musl compilation: Add musl as a prefix fallback (rust-lang#1455)

Fixed rust-lang#1452

* chore: release v1.2.19 (rust-lang#1458)

* Fix parser.rs on latest rustc nightly (rust-lang#1459)

Fixes rust-lang#1426

* Update rusqlite requirement from 0.34.0 to 0.35.0 (rust-lang#1460)

* Regenerate target info (rust-lang#1461)

* chore: release v1.2.20 (rust-lang#1462)

* Fix wasm32-unknown-unknown by passing -c (rust-lang#1424)

* Fix wasm32-unknown-unknown by passing -c

Fix rust-lang#1423

* Update lib.rs

Co-authored-by: Mads Marquart <[email protected]>

---------

Co-authored-by: Mads Marquart <[email protected]>

* chore: release v1.2.21 (rust-lang#1464)

* Add `flags` method to `cc::Build` for adding multiple flags (rust-lang#1466)

* chore: release v1.2.22 (rust-lang#1467)

* support "vxworks" and "nto" OSes on `get_base_archiver_variant` (rust-lang#1456)

* chore: release v1.2.23 (rust-lang#1470)

* Regenerate windows sys bindings (rust-lang#1471)

* chore: release v1.2.24 (rust-lang#1472)

* Update rusqlite requirement from 0.35.0 to 0.36.0 (rust-lang#1476)

* make `powerp64` use `powerpc64-linux-gnu` prefix (rust-lang#1474)

It used `powerpc-linux-gnu` before, which is 32-bit powerpc

* chore: release v1.2.25 (rust-lang#1478)

* Detect -Wslash-u-filename warning on clang-cl (rust-lang#1477)

* use windows 2022 in CI (rust-lang#1479)

* Also set `SDKROOT` when building apple platforms (rust-lang#1475)

* chore: release v1.2.26 (rust-lang#1481)

* Regenerate target info (rust-lang#1483)

* Update windows-bindgen requirement from 0.61 to 0.62 (rust-lang#1484)

* Regenerate windows sys bindings (rust-lang#1485)

* chore: release v1.2.27 (rust-lang#1486)

* Fix clippy warnings about not using variables in `format!` strings (rust-lang#1489)

* Recognize `mlibc` environment (rust-lang#1488)

* chore: release v1.2.28 (rust-lang#1491)

* [BlueOS] Support vivo BlueOS's toolchain

Adapted to cc-rs 1.2.28's TargetInfo struct API when resolving
conflicts; the -mfloat-abi=hard check is now
`target.arch == "arm" && target.abi == "eabihf"`.

(cherry picked from commit f158c93)

---------

Signed-off-by: Jiahao XU <[email protected]>
Co-authored-by: Jiahao XU <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mads Marquart <[email protected]>
Co-authored-by: Graydon Hoare <[email protected]>
Co-authored-by: Trevor Gross <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: Nicholas Bishop <[email protected]>
Co-authored-by: Andy Polyakov <[email protected]>
Co-authored-by: Nicolas Mattia <[email protected]>
Co-authored-by: Mateusz Mikuła <[email protected]>
Co-authored-by: Chris Denton <[email protected]>
Co-authored-by: Simon Hausmann <[email protected]>
Co-authored-by: Frank Laub <[email protected]>
Co-authored-by: Kajetan Puchalski <[email protected]>
Co-authored-by: David Lönnhager <[email protected]>
Co-authored-by: Henry Jiang <[email protected]>
Co-authored-by: Florian Bartels <[email protected]>
Co-authored-by: clubby789 <[email protected]>
Co-authored-by: Kenny Kerr <[email protected]>
Co-authored-by: Marijn Suijten <[email protected]>
Co-authored-by: Masato TOYOSHIMA <[email protected]>
Co-authored-by: Kajetan Puchalski <[email protected]>
Co-authored-by: tnewsome-lynx <[email protected]>
Co-authored-by: Marco Ieni <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 许杰友 Jieyou Xu (Joe) <[email protected]>
Co-authored-by: Erich Gubler <[email protected]>
Co-authored-by: Josh Junon <[email protected]>
Co-authored-by: Wesley Wiser <[email protected]>
Co-authored-by: Melvin Wang <[email protected]>
Co-authored-by: Arjun Ramesh <[email protected]>
Co-authored-by: Justin W Smith <[email protected]>
Co-authored-by: Jakub Beránek <[email protected]>
Co-authored-by: fiveseven <[email protected]>
Co-authored-by: Onur Özkan <[email protected]>
Co-authored-by: Folkert de Vries <[email protected]>
Co-authored-by: Paul Wagener <[email protected]>
Co-authored-by: Ronny Chan <[email protected]>
Co-authored-by: no92 <[email protected]>
Co-authored-by: Kai Law <[email protected]>
Co-authored-by: Han Jiang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug O-apple Apple targets and toolchains

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when cross-compiling to macOS with cc 1.2.12

3 participants