Skip to content
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

emconfigure sets both, CROSS_COMPILE and CC to absolute path, which seems to fail with man projects #21969

Open
CodingMarkus opened this issue May 21, 2024 · 2 comments

Comments

@CodingMarkus
Copy link

I'm not sure if that is a bug of emconfigure or of other projects using environment variables incorrectly but when I run emconfigure ./configure ... two environment variables are set:

CROSS_COMPILE=/full/path/to/emscripten/em
CC=/full/path/to/emscripten/emcc

And that causes issues since makefiles (like the one of OpenSSL for eample), will then read

CROSS_COMPILE=/full/path/to/emscripten/em
CC=($CROSS_COMPILE)=/full/path/to/emscripten/em/full/path/to/emscripten/emcc

Which will of course not work. I know little about UNIX build system details but to me it looks like you either set CROSS_COMPILE and keep CC as cc or you directly set CC to the full path but you are not expected to two both as that is then "doubly doubled".

If you think you are setting variables correctly and projects like OpenSSL are simply not using them correctly, as they should either just use $CC as is or use $(CROSS_COMPILE)cc but never both, just let me know and I will be happy to report that to projects I came across instead.

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.31-git
clang version 19.0.0git
Target: wasm32-unknown-emscripten
Thread model: posix

@sbc100
Copy link
Collaborator

sbc100 commented May 21, 2024

I'm afraid I don't know much about the CROSS_COMPILE environment variable, but if we can/should only set either CC or CROSS_COMPILE then I suppose we should set CC since that is much more commnly set, and it should like it would work in the openssl case too?

Would you like to send a patch to remove CROSS_COMPILE?

@CodingMarkus
Copy link
Author

I'm not sure if there are any rules for how cross-compiling should work in general, so maybe setting both is okay and the problem is with OpenSSL not handling all situations well.

Just to be sure, I also created an issue for OpenSSL

openssl/openssl#24460

they are considering adding logic like "if $CC is set and an absolute path, do not use $CROSS_COMPILE/$CC but just use $CC", which totally makes sense to me and in that case it would not be required to change anything with the emscripten wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants