-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use case: cross-compiling to macOS with a dependency on iconv #10485
Comments
Seems related to #9725 |
Since you're invoking Zig with
Note that this is also conditional on this fix #10568 |
@hzuo OK, I seem to have misunderstood the issue, however, it is not a regression per se. Let me explain. The behaviour (and error) are actually correct. @andrewrk do you think we should leave it at status quo of this being a hard error? I for one stand by this and believe it should always be a hard error. |
Yes if you specify to link a library with As for how to solve @hzuo's problem, they will need to provide an iconv to link against when cross compiling, or if possible, pass a build configuration option telling it to not depend on iconv. If you wish to use zig cc to cross compile and you want to avoid a macOS SDK, I suggest to first cross-compile iconv with zig, then you will have a static iconv build that you can link against. I will leave this open for a while as a "use case" to remind us that solving this problem somehow could help Rust folks - but there is a good chance that it will be eventually closed with no solution. |
Allow developers to opt for libiconv variant instead of the built-in iconv support of their platform. This helps with cross-compilation of binaries to platforms like macOS, which requires bulky SDK being installed in order to support linking to their bundled `iconv` library. Alternatively, developer should be able to build a static version of iconv (`libiconv`) and be able to link with it by forcing its usage with `-Duse_libiconv`: $ crystal build app.cr \ --cross-compile --target x86_64-apple-darwin -Duse_libiconv Relevant links: - https://forum.crystal-lang.org/t/macos-compilation-and-libiconv-support/4439 - ziglang/zig#10485 (comment)
Zig Version
0.9.0
Steps to Reproduce
Importantly, this was working fine on Zig 0.8.1.
On a Linux x86_64 system, with the following environment variables:
/tmp/zig/zig-cc.sh:
Rust has the appropriate toolchain installed as well via
rustup target add x86_64-apple-darwin
.Running the following fails:
cargo build --release --target x86_64-apple-darwin
Expected Behavior
Cross-compiling should succeed, as it previously did on 0.8.1.
Actual Behavior
The error message:
Seems that 0.9.0 can't find iconv but 0.8.1 was able to?
The text was updated successfully, but these errors were encountered: