-
Notifications
You must be signed in to change notification settings - Fork 195
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
macOS release binaries not able to create executables #138
Comments
The But macOS binaries available for download here are not notarized, so they cannot be used on Catalina if you download them using a web browser, or anything quarantining untrusted downloads. A possible workaround is to download them using But if you are using Homebrew, you really don't need a second installation of LLVM, especially since LLVM packages in Homebrew are always up to date. The wasi-sdk I started to work on a Homebrew package to add these dependencies. A package for the wasi sysroot is pretty straightforward, but for the builtins, I couldn't figure out how to cleanly install them into another package's (llvm) path. |
Thanks @jedisct1 - we'd love to make notarized packages available for download but none of the current maintainers have the expertise (and most of us don't even have macs) to get it done, so we'd welcome help with that. Homebrew is another possibility, but similarly I don't have any idea how that actually works. |
Another option is having a That wouldn't require notarization, would provide a unified installation procedure on all operating systems, and would provide a single-step way to install |
We already provide a tarball containing just the sysroot if you want to use the llvm from homebrew: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-10/wasi-sysroot-10.0.tar.gz |
I downloaded the release with |
clang --target=wasm32-wasi --sysroot="${WASI_SYSROOT}" ... Is that version of If not, provide the full path to it, or set a temporary |
The default target is |
Oh wait are you expecting to be able to run the output of the toolchain directly? Just to be clear this toolchain builds wasm files, which are not directly runnable. You need to run them in a wasm engine. Assuming you already knew that can you build a simple hello world program, and include the full command line (with -v added) and the full output? Also can you attach the output file? |
|
Right, I would imaging that is what that means. I was just confused by the statement: "they however do not produce executables on my machine". What does the toolchain produce then? What happens when you run clang directly? |
I apologize, I was just repeating the error statement. |
The actual error is visible in the |
@myobie when you use |
@sbc100 I decided to create a simple example project today to isolate the issue and the included binaries do work on my Mac, so my and other's original suspicions were wrong. See https://gist.github.com/myobie/e5f15231cca4fc22e0b77a741ea64772 The project I am attempting to compile has a I manually edited the Thanks for your help. I'm going to close this, since the original issue wasn't really valid. However, I'll stay subscribed and if you all need or want any more info from me then let me know. |
A typical set of options for env CC="clang" ./configure --with-sysroot="$WASI_SYSROOT" --host=wasm32-wasi
Some extra environment variables may have to be explicitly defined in addition to NM="llvm-nm"
AR="llvm-ar"
RANLIB="llvm-ranlib"
STRIP="llvm-strip" Running tests when cross-compiling to WASI is also fully supported by autoconf, by defining a |
Also, if an old version of the autotools was used to generate it, the You can download an up-to-date version of that script here. |
@jedisct1 the These are the env vars I am using in the project: export CC="clang"
export NM="llvm-nm"
export AR="llvm-ar"
export RANLIB="llvm-ranlib"
export STRIP="llvm-strip" And my configure line: ./configure --prefix="${PREFIX}" --with-sysroot="$WASI_SYSROOT" \
--host=wasm32-wasi \
--disable-ssp --disable-shared The project includes an The part of
|
Wait, are you trying to compile |
@jedisct1 some parts of it are included in my project, yes. Is that a problem or known issue? |
That Not a problem at all, especially since WASI is a supported platform. Make sure that you are using the If you still have issues, it may be better to continue the discussion in the Thanks! |
@jedisct1 Ha! OK, good, that's what I thought 😄 Ah good point, I'll try to create a small example script like I did before and make an issue over there after I can easily replicate it outside my project. I am using a vendor-ed tar of the 1.0.18 release. Thanks again for the help. |
Breaking changes happened to The |
I'm a little confused by why such a fix would work. The clang driver, even when run as part of wasi-sdk won't ever default to creating files that end in So, why are files ending in |
@sbc100 while I did edit the I've created a new gist which uses /cc @jedisct1 since it's (Oh and this is still just using the |
The error you get is
Because your script should set the sysroot before calling env CFLAGS="--sysroot=/tmp/wasi-sdk-10.0/share/wasi-sysroot -O2" ./configure --host=wasm32-wasi But please just use the provided script, that works out of the box and is the only supported way to compile it to WebAssembly. The resulting library can be linked with other object files like any other library. |
@jedisct1 oh, interesting that you get a different error than I do 😕 – I updated https://gist.github.com/myobie/dedd68a05245db0376a803a19fd635e1 to include the output from my run of the test script. Also, setting This does give me more evidence that my build environment is not clean or easily reproducible. I want my larger project to have predictable/reproducible builds and I'll need to track down what is in my environment before I can have that. Also, I would use the script if I were just compiling |
I'm running into the same issue, I followed https://doc.libsodium.org/installation which didn't produce a .wasm binary so I'm trying to execute Seems to start failing here:
Any ideas how to get it to compile? Sorry if I missed it in the above ^^ |
You need to install that file (eventually, the Homebrew formula will install it along with See https://github.com/jedisct1/libclang_rt.builtins-wasm32.a |
This brings in the following changes: f645f49 Update signal macros after upgrade to snapshot1 (WebAssembly#144) 8b3266d github actions: pin checkout action to v1 (WebAssembly#145) 410c660 Use constructor functions for optional init routines. (WebAssembly#142) fe13053 c header generation updated for reorganized witx ast (WebAssembly#139) cd74e1d Correct the version of WebAssembly#136 on master (WebAssembly#141) 446cb3f Wasi snapshot preview1 (WebAssembly#140) 54102f0 Ignore rights in libpreopen. (WebAssembly#129) 8c9e1c6 Make the `__original_main` definition weak, fixing -flto. (WebAssembly#138) cf81683 Optimize `fmin`, `fmax`, etc. (WebAssembly#120) deb8eae Don't pre-check capabilities in `openat`. (WebAssembly#130) ca9046d Use consistent style for wasi-libc C source files. (WebAssembly#131) 951cc3e Fix unintended recursion in __wasilibc_register_preopened_fd. (WebAssembly#133) 5216983 Avoid a `strdup` call in `__wasilibc_populate_libpreopen`. (WebAssembly#128) 70099d4 Don't link in libpreopen initialization code when it isn't needed. (WebAssembly#127) ec4549d Temporarily disable the use of `__heap_base`. (WebAssembly#132) a214f1c Use __heap_base by dlmalloc (WebAssembly#114) a94d2d0 Avoid varargs conventions when calling open (WebAssembly#126) 7fcc4f2 Revamp and simplify the libpreopen code. (WebAssembly#110) eb7230c Remove more unsupported headers. (WebAssembly#123)
Given these env variables:
I then see
configure: error: C compiler cannot create executables
.checking build system type... i386-apple-darwin19.5.0
checking host system type... wasm32-unknown-wasi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for wasm32-wasi-strip... llvm-strip
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '501' is supported by ustar format... yes
checking whether GID '20' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports the include directive... yes (GNU style)
checking for wasm32-wasi-gcc... clang
checking whether the C compiler works... no
configure: error: in
/.../': configure: error: C compiler cannot create executables See
config.log' for more detailsI am able to make a
sysroot
myself inside a checked outwasi-sdk
repo withmake install INSTALL_DIR="${PROJECT}/sysroot/"
and I can use it to compile the same project (after I've downloaded and placedlibclang_rt.builtins-wasm32-wasi-10.0.tar.gz
into myllvm
installation inside homebrew). However, I'd like to take advantage of the pre-compiled binaries + sysroots if at all possible because I've run into a problem too many times with one machine having a different version of llvm installed, etc.One key difference I notice when using the version I compiled myself is it says it's build system type is
x86_64-apple-darwin19.5.0
.I am using macOS 10.15.5 with the latest homebrew and
llvm
10.0.0_3
.The text was updated successfully, but these errors were encountered: