-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
"no-entry" argument not recognized #11045
Comments
Note |
Only works with wasm32 target. Usage: zig cc main.c -target wasm32-freestanding-none -o binary.wasm -Wl,--no-entry Fixes ziglang#11045
Linking my comment from the PR here for visibility: As mentioned, the solution is to build a library, rather than an executable. |
@Luukdegram If the ship has sailed on flag compatibility with clang, then something must be done to address the usability of this situation. Zig cc is being advertised as an easy entry into the zig world - but incompatibility+bad error messages like this will discourage adoption. Either
Probably both should be done, so if you are transitioning an existing command to zig cc, it'll tell you the flag is invalid, or if you're working on something new, it'll tell you to add -shared |
@danielchasehooper |
I might have been stuck for hours on this exact problem if I had not found this ticket via Google, and learning that I just need to add the -shared option. Thanks. |
im slightly confused by the workaround
here from
using a single c file exe https://raw.githubusercontent.com/circulosmeos/gztool/master/gztool.c I am a first-time zig user also, happy to learn how this can simplify wasm targets edit: this works |
I'm still stuck on this for compiling c libraries to wasm32-wasi, and with cmake there doesn't seem to be an easy fix because using wasm-ld directly causes more issues. This argument is required to build libraries for wasm32-wasi because without it, it errors saying main isn't defined 😕 It seems like this is where the error occurs: Line 2224 in 6bc9c4f
However I have no idea what the correct fix would be. Edit: I have found a workaround that actually works but it doesn't support existing build systems like cmake.
|
Zig Version
0.10.0-dev.871+bb05a8a08
Steps to Reproduce
run this:
Expected Behavior
should compile without issue
Actual Behavior
output:
similarly, if you run
zig cc main.c -target wasm32-freestanding-none -nostdlib -o binary.wasm --no-entry
you get
error: Unknown Clang option: '--no-entry'
so whether you pass the argument to zig cc with
--no-entry
or the linker with-Wl,--no-entry
, it doesn't workThe text was updated successfully, but these errors were encountered: