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

Given -r, emcc sill requests to use -r for object file extensions #15760

Closed
zauguin opened this issue Dec 13, 2021 · 3 comments · Fixed by #15769
Closed

Given -r, emcc sill requests to use -r for object file extensions #15760

zauguin opened this issue Dec 13, 2021 · 3 comments · Fixed by #15769

Comments

@zauguin
Copy link

zauguin commented Dec 13, 2021

Please include the following in your bug report:

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.0.0-git (3fd52e107187b8a169bb04a02b9f982c8a075205)`

(This is the Arch Linux package. Not sure why it's claiming to be a git version, but it builds the 3.0.0 tag with no changes to the source code)

Failing command line in full:

% touch empty{1,2}.cpp
% emcc -r empty{1,2}.cpp -o empty.o
emcc: warning: generating an executable with an object extension (.o).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]

The warning seems wrong: It explicitly tells me to use -r if I want an object file, but I already do use that option.

Full command and output with -v appended:

% emcc -r empty{1,2}.cpp -o empty.o -v
"/opt/emscripten-llvm/bin/clang++" -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=0 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/home/marcel/.emscripten_cache/sysroot -Xclang -iwithsysroot/include/compat -v empty1.cpp -c -o /tmp/emscripten_temp_mkvix7eg/empty1_0.o
clang version 14.0.0 (/srcdest/llvm-project 4348cd42c385e71b63e5da7e492172cff6a79d7b)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /opt/emscripten-llvm/bin
 (in-process)
 "/opt/emscripten-llvm/bin/clang-14" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name empty1.cpp -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu generic -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/marcel/cppexper/emsc -resource-dir /opt/emscripten-llvm/lib/clang/14.0.0 -D EMSCRIPTEN -D __EMSCRIPTEN_major__=3 -D __EMSCRIPTEN_minor__=0 -D __EMSCRIPTEN_tiny__=0 -D _LIBCPP_ABI_VERSION=2 -isysroot /home/marcel/.emscripten_cache/sysroot -internal-isystem /home/marcel/.emscripten_cache/sysroot/include/wasm32-emscripten/c++/v1 -internal-isystem /home/marcel/.emscripten_cache/sysroot/include/c++/v1 -internal-isystem /opt/emscripten-llvm/lib/clang/14.0.0/include -internal-isystem /home/marcel/.emscripten_cache/sysroot/include/wasm32-emscripten -internal-isystem /home/marcel/.emscripten_cache/sysroot/include -Werror=implicit-function-declaration -fdeprecated-macro -fdebug-compilation-dir=/home/marcel/cppexper/emsc -ferror-limit 19 -fvisibility default -fgnuc-version=4.2.1 -fcxx-exceptions -fignore-exceptions -fexceptions -fcolor-diagnostics -iwithsysroot/include/SDL -iwithsysroot/include/compat -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -o /tmp/emscripten_temp_mkvix7eg/empty1_0.o -x c++ empty1.cpp
clang -cc1 version 14.0.0 based upon LLVM 14.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/home/marcel/.emscripten_cache/sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "/home/marcel/.emscripten_cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 /home/marcel/.emscripten_cache/sysroot/include/SDL
 /home/marcel/.emscripten_cache/sysroot/include/compat
 /home/marcel/.emscripten_cache/sysroot/include/c++/v1
 /opt/emscripten-llvm/lib/clang/14.0.0/include
 /home/marcel/.emscripten_cache/sysroot/include
End of search list.
 "/opt/emscripten-llvm/bin/clang++" -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=0 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/home/marcel/.emscripten_cache/sysroot -Xclang -iwithsysroot/include/compat -v empty2.cpp -c -o /tmp/emscripten_temp_mkvix7eg/empty2_1.o
clang version 14.0.0 (/srcdest/llvm-project 4348cd42c385e71b63e5da7e492172cff6a79d7b)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /opt/emscripten-llvm/bin
 (in-process)
 "/opt/emscripten-llvm/bin/clang-14" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name empty2.cpp -mrelocation-model static -mframe-pointer=none -ffp-contract=on -fno-rounding-math -mconstructor-aliases -target-cpu generic -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/marcel/cppexper/emsc -resource-dir /opt/emscripten-llvm/lib/clang/14.0.0 -D EMSCRIPTEN -D __EMSCRIPTEN_major__=3 -D __EMSCRIPTEN_minor__=0 -D __EMSCRIPTEN_tiny__=0 -D _LIBCPP_ABI_VERSION=2 -isysroot /home/marcel/.emscripten_cache/sysroot -internal-isystem /home/marcel/.emscripten_cache/sysroot/include/wasm32-emscripten/c++/v1 -internal-isystem /home/marcel/.emscripten_cache/sysroot/include/c++/v1 -internal-isystem /opt/emscripten-llvm/lib/clang/14.0.0/include -internal-isystem /home/marcel/.emscripten_cache/sysroot/include/wasm32-emscripten -internal-isystem /home/marcel/.emscripten_cache/sysroot/include -Werror=implicit-function-declaration -fdeprecated-macro -fdebug-compilation-dir=/home/marcel/cppexper/emsc -ferror-limit 19 -fvisibility default -fgnuc-version=4.2.1 -fcxx-exceptions -fignore-exceptions -fexceptions -fcolor-diagnostics -iwithsysroot/include/SDL -iwithsysroot/include/compat -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -o /tmp/emscripten_temp_mkvix7eg/empty2_1.o -x c++ empty2.cpp
clang -cc1 version 14.0.0 based upon LLVM 14.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/home/marcel/.emscripten_cache/sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "/home/marcel/.emscripten_cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 /home/marcel/.emscripten_cache/sysroot/include/SDL
 /home/marcel/.emscripten_cache/sysroot/include/compat
 /home/marcel/.emscripten_cache/sysroot/include/c++/v1
 /opt/emscripten-llvm/lib/clang/14.0.0/include
 /home/marcel/.emscripten_cache/sysroot/include
End of search list.
emcc: warning: generating an executable with an object extension (.o).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
 "/opt/emscripten-llvm/bin/wasm-ld" -o empty.o /tmp/emscripten_temp_mkvix7eg/empty1_0.o /tmp/emscripten_temp_mkvix7eg/empty2_1.o -L/home/marcel/.emscripten_cache/sysroot/lib/wasm32-emscripten --relocatable -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr
@sbc100
Copy link
Collaborator

sbc100 commented Dec 13, 2021

Sorry, yes, I think that is an erroneous warning. I'll see if I can upload a patch now.

BTW, what is your use case for using the -r option? Would using emar archives work for you?

@zauguin
Copy link
Author

zauguin commented Dec 16, 2021

BTW, what is your use case for using the -r option? Would using emar archives work for you?

I tried to make some project which didn't get updated in a while compile again which relied on -r as default behavior, so the first approach was to add it explicitly. I don't think that there is any real reason why archives aren't used here.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 16, 2021

If you can move away from using emcc -r that would be great. In particular we hope to remove the "combine bitcode using llvm-link" part of it a some point: #15724 (This mostly effects folks who are doing LTO)

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

Successfully merging a pull request may close this issue.

2 participants