Zig Version
0.14.0-dev.2851+b074fb7dd
Steps to Reproduce and Observed Behavior
Very simple c++ file:
#include <iostream>
int main(){
std::cout<<"hello\n";
return 0;
}
And a c one:
#include <stdio.h>
int main(){
printf("hello\n");
return 0;
}
Running the following commands, result on the right:
zig c++ --target=wasm32-wasi main.cpp -flto -> fail to run
zig c++ --target=wasm32-wasi main.cpp -> fail, surprisingly as from meson it works.
zig cc --target=wasm32-wasi main.c -flto -> fail to run
zig cc --target=wasm32-wasi main.c -> working
I also tested the C++ cases using the C code, so no libc++ and it works without -flto.
For failure, I mean that running it via a wasm/wasi runtime like bun, it results in an exception from the runtime.
I also noticed that the -static attribute does not work, so zig cc main.c -static does not generate a static build, but clang would.
Expected Behavior
All the previous cases should just compile and run fine.
So, running bun run a.out should just display hello for each of the test cases.
Further problems and discussion @ lazy-eggplant/vs.templ#18 where some of these issues were first isolated.
Zig Version
0.14.0-dev.2851+b074fb7dd
Steps to Reproduce and Observed Behavior
Very simple c++ file:
And a c one:
Running the following commands, result on the right:
zig c++ --target=wasm32-wasi main.cpp -flto-> fail to runzig c++ --target=wasm32-wasi main.cpp-> fail, surprisingly as from meson it works.zig cc --target=wasm32-wasi main.c -flto-> fail to runzig cc --target=wasm32-wasi main.c-> workingI also tested the C++ cases using the C code, so no libc++ and it works without
-flto.For failure, I mean that running it via a wasm/wasi runtime like bun, it results in an exception from the runtime.
I also noticed that the
-staticattribute does not work, sozig cc main.c -staticdoes not generate a static build, but clang would.Expected Behavior
All the previous cases should just compile and run fine.
So, running
bun run a.outshould just displayhellofor each of the test cases.Further problems and discussion @ lazy-eggplant/vs.templ#18 where some of these issues were first isolated.