cc-rs icon indicating copy to clipboard operation
cc-rs copied to clipboard

emscripten not passing -s options to emcc?

Open slmjkdbtl opened this issue 5 years ago • 7 comments

// --target wasm32-unknown-emscripten
cc::Build::new()
	.flag("-s")
	.flag("FULL_ES3=1")
	.file("sokol.c")
	.compile("test")
	;

a build session like this, I'm trying to emulate the command emcc -s FULL_ES3=1 sokol.c, but the .flag("-s").flag("FULL_ES3=1") part didn't seem to get work, I'm getting the same error message as it's not passed. If I feed something that'll sure fail like .flag("-s").flag("ENVIRONMENT=123") it won't fail, makes me suspect emcc didn't receive the options at all (or I'm doing the wrong way)?

slmjkdbtl avatar Jul 06 '20 05:07 slmjkdbtl

The cc crate should print out the command its executing, does the command look like you'd expect?

alexcrichton avatar Jul 06 '20 15:07 alexcrichton

@alexcrichton It does, running with -vv gives

running: "emcc" "-O0" ... "-s" "FULL_ES3=1" "-DSOKOL_GLES3" "-o" ...

there is -s FULL_ES3=1 in the command, but it's giving error message as if this option is not passed

slmjkdbtl avatar Jul 06 '20 16:07 slmjkdbtl

After some tweaking I seem to break it more.. Now I'm getting a lot of undefined symbol errors, as if I'm not passing the file(c_file) option. Not getting any of these on other non-emscripten targets.

slmjkdbtl avatar Jul 06 '20 16:07 slmjkdbtl

Sorry I don't really know anything about Emscripten. It sounds like this is not an issue wit hhis crate, however, and is likely an issue with your setup and/or emcc?

alexcrichton avatar Jul 06 '20 17:07 alexcrichton

It doesn't really seem to be cc's problem to me too, but running raw equivalent emcc command doesn't have this problem, and a minimal int add(int a, int b); example works, just breaks when I'm trying to bind this c library, weird

slmjkdbtl avatar Jul 06 '20 17:07 slmjkdbtl

Sorry I can't really help you myself, I don't really know how to debug Emscripten.

alexcrichton avatar Jul 06 '20 21:07 alexcrichton

@alexcrichton Sure! Never mind

slmjkdbtl avatar Jul 06 '20 21:07 slmjkdbtl