-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Rust] set CC and CFLAGS envvars #18
Comments
A great find, thank you for sharing! I think we should take care of this in We could tweak - CC = emcc
- CXX = em++
- FC = $(EMFC)
- CFLAGS = $(WASM_CFLAGS)
- CPPFLAGS = $(WASM_CPPFLAGS)
- CXXFLAGS = -std=gnu++11 $(WASM_CXXFLAGS)
+ export CC = emcc
+ export CXX = em++
+ export FC = $(EMFC)
+ export CFLAGS = $(WASM_CFLAGS)
+ export CPPFLAGS = $(WASM_CPPFLAGS)
+ export CXXFLAGS = -std=gnu++11 $(WASM_CXXFLAGS) With this, Rust should pick up the One thing I am not sure about is how this change could potentially affect other R packages. I can think of a situation where this might break things: if some package is building an executable as an intermediate step, then running it on the host machine to generate some further output to be included in the package. I don't actually know if any R packages work like that - @jeroen, can you think of any? Or think of any other issues with simply exporting these variables to the build environment? Either way, I suppose any packages doing something like that could be made to use the compiler given in
|
Sounds great! To be fair, the use of Rust is not majority and probably only few of them invokes C compiler. So, it might not be really worth the risk. At the moment, we anyway need to use Also, to be precise, |
We shim UNAME := $(shell uname -s)
ifeq ($(UNAME),Emscripten)
[...]
endif |
Oh, good to know, thanks. |
FYI, I chose to use |
The |
(This issue is mainly for sharing the information, so feel free to close. But I hope this helps somehow.)
Probably you already know, the Rust compiler sometimes invokes the C compiler inside.
https://doc.rust-lang.org/cargo/reference/build-scripts.html
rwasm overrides the
CC
andCFLAGS
Makevars, but I found these settings are not propagated to the C compiler unless the same name of envvars are set.https://github.com/rust-lang/cc-rs#external-configuration-via-environment-variables
I'm not sure if this is what rwasm should take care of or the package author should, but I actually had to specify it in my package, which compiles a bit of C code in the crate.
yutannihilation/savvy-webr-test@5ee66d7
The text was updated successfully, but these errors were encountered: