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

Different -Wpoison-system-directories behavior between macOS x86_64 and macOS arm64 #14031

Open
ragfield opened this issue Apr 27, 2021 · 22 comments

Comments

@ragfield
Copy link

I have an Intel Mac and a M1 Mac, both with the same OS version (macOS 11.3), both with the same version of emsdk (2.0.18). em++ with -Wpoison-system-directories behaves differently between the two. With the following simple source code:

#include <stdio.h>

int main(int argc, const char* argv[])
{
	printf("Hello world!\n");
	return 0;
}

And the following compiler invocation:

/usr/local/opt/emsdk/upstream/emscripten/em++ -Wpoison-system-directories a.cpp

I get no warnings on the Intel Mac, but I get the following warning on the M1 Mac:

warning: include location '/usr/local/include' is unsafe for cross-compilation [-Wpoison-system-directories]
1 warning generated.

Looking at the verbose (-v) output on the two machines, the only differences are that -I/usr/local/include is added on the M1 Mac, and the version of node differs between the two (/usr/local/opt/emsdk/node/14.15.5_64bit/bin/node on the M1, /usr/local/opt/emsdk/node/12.18.1_64bit/bin/node on the Intel).

Here is the full verbose output on the M1 Mac:

 "/usr/local/opt/emsdk/upstream/bin/clang++" -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=18 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -v -Wpoison-system-directories a.cpp -c -o /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_kjqhgwwc/a_0.o
clang version 13.0.0 (/opt/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 94340dd5bb23fb7c4bc7d91d5ac0608eb25660a8)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/opt/emsdk/upstream/bin
 (in-process)
 "/usr/local/opt/emsdk/upstream/bin/clang-13" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name a.cpp -mrelocation-model static -mframe-pointer=none -fno-rounding-math -mconstructor-aliases -target-cpu generic -fvisibility hidden -debugger-tuning=gdb -target-linker-version 609.8 -v -fcoverage-compilation-dir=/Users/schofield/Downloads/tmp -resource-dir /usr/local/opt/emsdk/upstream/lib/clang/13.0.0 -D EMSCRIPTEN -D __EMSCRIPTEN_major__=2 -D __EMSCRIPTEN_minor__=0 -D __EMSCRIPTEN_tiny__=18 -D _LIBCPP_ABI_VERSION=2 -D unix -D __unix -D __unix__ -isysroot /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot -I/usr/local/include -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1 -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1 -internal-isystem /usr/local/opt/emsdk/upstream/lib/clang/13.0.0/include -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include -Werror=implicit-function-declaration -Wpoison-system-directories -fdeprecated-macro -fdebug-compilation-dir=/Users/schofield/Downloads/tmp -ferror-limit 19 -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 /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_kjqhgwwc/a_0.o -x c++ a.cpp
clang -cc1 version 13.0.0 based upon LLVM 13.0.0git default target x86_64-apple-darwin20.4.0
warning: include location '/usr/local/include' is unsafe for cross-compilation [-Wpoison-system-directories]
ignoring nonexistent directory "/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/SDL
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/compat
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1
 /usr/local/opt/emsdk/upstream/lib/clang/13.0.0/include
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include
End of search list.
1 warning generated.
 "/usr/local/opt/emsdk/upstream/bin/wasm-ld" -o a.out.wasm /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_kjqhgwwc/a_0.o -L/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libgl.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libal.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libhtml5.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libcompiler_rt.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++-noexcept.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++abi-noexcept.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libdlmalloc.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc_rt_wasm.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --strip-debug --export main --export emscripten_stack_get_end --export emscripten_stack_get_free --export emscripten_stack_init --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export fflush --export __errno_location --export-table --export __start_em_asm --export __stop_em_asm -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024
 "/usr/local/opt/emsdk/upstream/bin/wasm-emscripten-finalize" --minimize-wasm-changes --dyncalls-i64 a.out.wasm -o a.out.wasm --detect-features
 "/usr/local/opt/emsdk/node/14.15.5_64bit/bin/node" /usr/local/opt/emsdk/upstream/emscripten/src/compiler.js /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/tmp3nc0jxaa.txt
 "/usr/local/opt/emsdk/upstream/bin/llvm-objcopy" a.out.wasm a.out.wasm --remove-section=.debug* --remove-section=producers

Here is the full verbose output on the Intel Mac:

 "/usr/local/opt/emsdk/upstream/bin/clang++" -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=18 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -v -Wpoison-system-directories a.cpp -c -o /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_q25h2mff/a_0.o
clang version 13.0.0 (/opt/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 94340dd5bb23fb7c4bc7d91d5ac0608eb25660a8)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/opt/emsdk/upstream/bin
 (in-process)
 "/usr/local/opt/emsdk/upstream/bin/clang-13" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name a.cpp -mrelocation-model static -mframe-pointer=none -fno-rounding-math -mconstructor-aliases -target-cpu generic -fvisibility hidden -debugger-tuning=gdb -target-linker-version 609.8 -v -fcoverage-compilation-dir=/Users/schofield/Downloads/tmp -resource-dir /usr/local/opt/emsdk/upstream/lib/clang/13.0.0 -D EMSCRIPTEN -D __EMSCRIPTEN_major__=2 -D __EMSCRIPTEN_minor__=0 -D __EMSCRIPTEN_tiny__=18 -D _LIBCPP_ABI_VERSION=2 -D unix -D __unix -D __unix__ -isysroot /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1 -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1 -internal-isystem /usr/local/opt/emsdk/upstream/lib/clang/13.0.0/include -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include -Werror=implicit-function-declaration -Wpoison-system-directories -fdeprecated-macro -fdebug-compilation-dir=/Users/schofield/Downloads/tmp -ferror-limit 19 -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 /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_q25h2mff/a_0.o -x c++ a.cpp
clang -cc1 version 13.0.0 based upon LLVM 13.0.0git default target x86_64-apple-darwin20.4.0
ignoring nonexistent directory "/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/SDL
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/compat
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1
 /usr/local/opt/emsdk/upstream/lib/clang/13.0.0/include
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include
End of search list.
 "/usr/local/opt/emsdk/upstream/bin/wasm-ld" -o a.out.wasm /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_q25h2mff/a_0.o -L/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libgl.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libal.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libhtml5.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libcompiler_rt.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++-noexcept.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc++abi-noexcept.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libdlmalloc.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc_rt_wasm.a /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libsockets.a -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --allow-undefined --strip-debug --export main --export emscripten_stack_get_end --export emscripten_stack_get_free --export emscripten_stack_init --export stackSave --export stackRestore --export stackAlloc --export __wasm_call_ctors --export fflush --export __errno_location --export-table --export __start_em_asm --export __stop_em_asm -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024
 "/usr/local/opt/emsdk/upstream/bin/wasm-emscripten-finalize" --minimize-wasm-changes --dyncalls-i64 a.out.wasm -o a.out.wasm --detect-features
 "/usr/local/opt/emsdk/node/12.18.1_64bit/bin/node" /usr/local/opt/emsdk/upstream/emscripten/src/compiler.js /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/tmpqw8e916y.txt
 "/usr/local/opt/emsdk/upstream/bin/llvm-objcopy" a.out.wasm a.out.wasm --remove-section=.debug* --remove-section=producers
@sbc100
Copy link
Collaborator

sbc100 commented Apr 27, 2021

It sounds to like maybe a bug in clang that its adding /usr/local/include at all given that we running clang with --sysroot=/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot. With a sysroot like that I don't think /usr/local/include should ever be added by clang.

One thing, does /usr/local/include actually exist on both machines? That could be a difference.

@sbc100
Copy link
Collaborator

sbc100 commented Apr 27, 2021

By the way, thanks for pointing out the existence of -Wpoison-system-directories .. we should be enabling that by default in emscripten.

@ragfield
Copy link
Author

/usr/local/include exists on both machines. It has hundreds of files on the Intel Mac, while it is empty on the M1 Mac.

@ragfield
Copy link
Author

This line in the M1's verbose output seems to indicate -I/usr/local/include is being passed by emcc to clang:

 "/usr/local/opt/emsdk/upstream/bin/clang-13" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all --mrelax-relocations -disable-free -main-file-name a.cpp -mrelocation-model static -mframe-pointer=none -fno-rounding-math -mconstructor-aliases -target-cpu generic -fvisibility hidden -debugger-tuning=gdb -target-linker-version 609.8 -v -fcoverage-compilation-dir=/Users/schofield/Downloads/tmp -resource-dir /usr/local/opt/emsdk/upstream/lib/clang/13.0.0 -D EMSCRIPTEN -D __EMSCRIPTEN_major__=2 -D __EMSCRIPTEN_minor__=0 -D __EMSCRIPTEN_tiny__=18 -D _LIBCPP_ABI_VERSION=2 -D unix -D __unix -D __unix__ -isysroot /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot -I/usr/local/include -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1 -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1 -internal-isystem /usr/local/opt/emsdk/upstream/lib/clang/13.0.0/include -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include -Werror=implicit-function-declaration -Wpoison-system-directories -fdeprecated-macro -fdebug-compilation-dir=/Users/schofield/Downloads/tmp -ferror-limit 19 -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 /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_kjqhgwwc/a_0.o -x c++ a.cpp

@sbc100
Copy link
Collaborator

sbc100 commented Apr 27, 2021

No.. I think that is clang internally passing to to -cc1. The clang command line generated by emscripten does not contain it.

@sbc100
Copy link
Collaborator

sbc100 commented Apr 27, 2021

The clang command line run by emscripten starts with "/usr/local/opt/emsdk/upstream/bin/clang++" -target wasm32-unknown-emscripten ...

@sbc100
Copy link
Collaborator

sbc100 commented Apr 27, 2021

Internally clang then calls "/usr/local/opt/emsdk/upstream/bin/clang-13" -cc1

@ragfield
Copy link
Author

Ah, my mistake. Thanks for the explanation.

@sbc100
Copy link
Collaborator

sbc100 commented Apr 27, 2021

Its a shame that -Wpoison-system-directories doesn't also warn about -L paths.. then maybe we could use it to replace our existing system we have called -Wabsolute-paths... perhaps I will see about adding that.

@sbc100
Copy link
Collaborator

sbc100 commented Apr 27, 2021

The only place in clang I can see that would add that path is https://github.com/llvm/llvm-project/blob/b19136e35256c5b21aff93ea5b55b4c142408c40/clang/lib/Frontend/InitHeaderSearch.cpp#L214. If you are able to re-built perhaps you could see if you are hitting that.. it seems impossible since that calling function returns early of the OS is emscripten.

@ragfield
Copy link
Author

I'm willing to give this a shot, but I've only ever used the prebuilt tools. I haven't been able to find any instructions on how to get, build, and install the correct version of clang for use by Emscripten. Is this documentation available somewhere?

@sbc100
Copy link
Collaborator

sbc100 commented Apr 30, 2021

But if you are using M1 mac hardware aren't you building llvm from source anyway? At least I don't think we provide pre-built binaries in emsdk yet. How are you installing llvm?

@ragfield
Copy link
Author

I'm doing the same installation I would on an Intel Mac. It is installing x86-64 binaries, which are run through translation.

@sbc100
Copy link
Collaborator

sbc100 commented Apr 30, 2021

Well that is even more odd! The exact same clang binaries are doing different things here...

@ragfield
Copy link
Author

The prebuilt binaries are still x86_64 only for Mac as of Emcripten version 2.0.32 (and this issue is still visible). Is there something holding up a native arm64 version of clang?

@sbc100
Copy link
Collaborator

sbc100 commented Oct 28, 2021

We do now build and upload arm64 binaries for macos. It looks like they were added to manifest file in emscripten-core/emsdk#816.

I confirmed that this tar archive does indeed contain arm binaries:

$ wget https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/74646397e3c5010824ad60d1de86c6bcbe334dff/wasm-binaries-arm64.tbz2
$ tar xf wasm-binaries-arm64.tbz2
$ file install/bin/clang-14 
install/bin/clang-14: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|PIE>

So perhaps there is an issue where emsdk is not selecting this download for some reason. Sadly I don't have an M1 mac to test this on. Can you confirm if wasm-binaries-arm64.tbz2 is being downloaded, or if wasm-binaries.tbz2 is being used?

@ragfield
Copy link
Author

It's downloading wasm-binaries.tbz2:

schofield@RobBookPro13 emsdk % ./emsdk install latest
Resolving SDK alias 'latest' to '2.0.32'
Resolving SDK version '2.0.32' to 'sdk-releases-upstream-74646397e3c5010824ad60d1de86c6bcbe334dff-64bit'
Installing SDK 'sdk-releases-upstream-74646397e3c5010824ad60d1de86c6bcbe334dff-64bit'..
Skipped installing node-14.15.5-64bit, already installed.
Skipped installing python-3.9.2-1-64bit, already installed.
Installing tool 'releases-upstream-74646397e3c5010824ad60d1de86c6bcbe334dff-64bit'..
Downloading: /usr/local/opt/emsdk/zips/74646397e3c5010824ad60d1de86c6bcbe334dff-wasm-binaries.tbz2 from https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/74646397e3c5010824ad60d1de86c6bcbe334dff/wasm-binaries.tbz2, 171235733 Bytes
Unpacking '/usr/local/opt/emsdk/zips/74646397e3c5010824ad60d1de86c6bcbe334dff-wasm-binaries.tbz2' to '/usr/local/opt/emsdk/upstream'
Done installing tool 'releases-upstream-74646397e3c5010824ad60d1de86c6bcbe334dff-64bit'.
Done installing SDK 'sdk-releases-upstream-74646397e3c5010824ad60d1de86c6bcbe334dff-64bit'.

My system python3 and node are arm64 binaries, but the python3 and node included with Emscripten are x86_64:

schofield@RobBookPro13 emsdk % file python/3.9.2-1_64bit/bin/python3
python/3.9.2-1_64bit/bin/python3: Mach-O 64-bit executable x86_64
schofield@RobBookPro13 emsdk % file node/14.15.5_64bit/bin/node
node/14.15.5_64bit/bin/node: Mach-O 64-bit executable x86_64

Is the architecture being detected by Emscripten's python3 (which is running under translation)?

@sbc100
Copy link
Collaborator

sbc100 commented Oct 28, 2021

Yes, python is used to detect the current architecture.

I looks like its using platform.machine().. I guess that is returning x86_64 when running the translated x86_64 version of python?

@ragfield
Copy link
Author

Indeed, it does:

schofield@RobBookPro13 emsdk % python/3.9.2-1_64bit/bin/python3
Python 3.9.2 (tags/v3.9.2:1a79785e3e, Mar 12 2021, 12:33:21) 
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.machine()
'x86_64'
>>> 

@sbc100
Copy link
Collaborator

sbc100 commented Oct 28, 2021

OK, I think we should open a separate issue to get arm64 working.

This issue is still a completely mystery (why the emulated version of clang adds /usr/local/include but that native once doesn't).

Admittedly fixing the former might fix that latter.

@ragfield
Copy link
Author

Admittedly fixing the former might fix that latter.

That's what I was hoping. Thanks for the help with this.

@ragfield
Copy link
Author

I have my emsdk installation fixed so I now have an arm64 native clang compiler, but this issue still persists. Here's the current verbose output:

schofield@RobBookPro13 EmscriptenWarning % /usr/local/opt/emsdk/upstream/emscripten/em++ -v -Wpoison-system-directories a.cpp
 "/usr/local/opt/emsdk/upstream/bin/clang++" -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=32 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -v -Wpoison-system-directories a.cpp -c -o /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_0jkl3z0k/a_0.o
clang version 14.0.0 (https://github.com/llvm/llvm-project 9403514e764950a0dfcd627fc90c73432314bced)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/opt/emsdk/upstream/bin
 (in-process)
 "/usr/local/opt/emsdk/upstream/bin/clang-14" -cc1 -triple wasm32-unknown-emscripten -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -main-file-name a.cpp -mrelocation-model static -mframe-pointer=none -fno-rounding-math -mconstructor-aliases -target-cpu generic -fvisibility hidden -debugger-tuning=gdb -target-linker-version 14.0.0 -v -fcoverage-compilation-dir=/Users/schofield/Downloads/EmscriptenWarning -resource-dir /usr/local/opt/emsdk/upstream/lib/clang/14.0.0 -D EMSCRIPTEN -D __EMSCRIPTEN_major__=2 -D __EMSCRIPTEN_minor__=0 -D __EMSCRIPTEN_tiny__=32 -D _LIBCPP_ABI_VERSION=2 -isysroot /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot -I/usr/local/include -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1 -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1 -internal-isystem /usr/local/opt/emsdk/upstream/lib/clang/14.0.0/include -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten -internal-isystem /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include -Werror=implicit-function-declaration -Wpoison-system-directories -fdeprecated-macro -fdebug-compilation-dir=/Users/schofield/Downloads/EmscriptenWarning -ferror-limit 19 -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 /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_0jkl3z0k/a_0.o -x c++ a.cpp
clang -cc1 version 14.0.0 based upon LLVM 14.0.0git default target x86_64-apple-darwin21.1.0
warning: include location '/usr/local/include' is unsafe for cross-compilation [-Wpoison-system-directories]
ignoring nonexistent directory "/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten/c++/v1"
ignoring nonexistent directory "/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/wasm32-emscripten"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/SDL
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/compat
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1
 /usr/local/opt/emsdk/upstream/lib/clang/14.0.0/include
 /usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/include
End of search list.
1 warning generated.
 "/usr/local/opt/emsdk/upstream/bin/wasm-ld" -o a.out.wasm /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/emscripten_temp_0jkl3z0k/a_0.o -L/usr/local/opt/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -ldlmalloc -lc_rt_wasm -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=main --export-if-defined=emscripten_stack_get_end --export-if-defined=emscripten_stack_get_free --export-if-defined=emscripten_stack_init --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=__wasm_call_ctors --export-if-defined=fflush --export-if-defined=__errno_location --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024
 "/usr/local/opt/emsdk/upstream/bin/wasm-emscripten-finalize" --minimize-wasm-changes --dyncalls-i64 a.out.wasm -o a.out.wasm --detect-features
 "/usr/local/opt/emsdk/node/14.15.5_64bit/bin/node" /usr/local/opt/emsdk/upstream/emscripten/src/compiler.js /var/folders/0f/lpnk71n94dg4f4yqv0zxwz7c0000gn/T/tmpj3y1w36p.txt
 "/usr/local/opt/emsdk/upstream/bin/llvm-objcopy" a.out.wasm a.out.wasm --remove-section=.debug* --remove-section=producers

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