That's it! `env | grep CommandLineTools` showed me `CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include`. I then ran `export CPATH=''`, and then I compiled hello_world.c without any problems. Apparently I was setting the CPATH environment variable in my .zprofile.
Thanks so much everyone! Efrem Braun On Wed, Nov 25, 2020 at 12:55 PM Floh <[email protected]> wrote: > Complete shot in the dark, but does this show anything: > > env | grep CommandLineTools > > ...basically checking if that include path shows up in any environment > variable... > > On Wednesday, 25 November 2020 at 18:46:15 UTC+1 Floh wrote: > >> Yeah, the first include here is the problem (/Library/Developer/...). The >> question is how this is getting in there... >> >> #include "..." search starts here: >> #include <...> search starts here: >> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include >> /Users/edbraun/software/emsdk/upstream/emscripten/system/include/SDL >> /Users/edbraun/software/emsdk/upstream/emscripten/system/include/compat >> >> I don't know if clang/emcc has any hidden feature to get header search >> paths from anywhere else than the command line (like an environment >> variable maybe?), I tried googling for that but haven't found anything. >> >> >> >> >> On Wednesday, 25 November 2020 at 18:28:26 UTC+1 [email protected] >> wrote: >> >>> Changing the shell to bash and redoing the installation gave the same >>> results, so it's not the zsh shell. >>> >>> It's really strange that >>> `-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/inc` is being >>> passed to clang, as shown by `emcc -E -v -x c /dev/null`. That does seem to >>> be the culprit, but I don't know why that's happening or how to change it. >>> >>> Efrem Braun >>> >>> >>> On Wed, Nov 25, 2020 at 12:12 PM Efrem Braun <[email protected]> wrote: >>> >>>> Yes, I followed the instructions given here: >>>> https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install >>>> : >>>> git clone https://github.com/emscripten-core/emsdk.git >>>> cd emsdk >>>> ./emsdk install latest >>>> ./emsdk activate latest >>>> source ./emsdk_env.sh >>>> >>>> I just deleted the installation and tried those 5 steps again. I >>>> immediately ran `emcc -E -v -x c /dev/null`, and it again showed >>>> `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include` as the >>>> first directory in the #include search path. >>>> >>>> Efrem Braun >>>> >>>> >>>> On Wed, Nov 25, 2020 at 12:03 PM gianluca torta <[email protected]> >>>> wrote: >>>> >>>>> have you run emsdk_env.sh? >>>>> >>>>> Gianluca >>>>> >>>>> On Tuesday, November 24, 2020 at 5:45:09 PM UTC+1 [email protected] >>>>> wrote: >>>>> >>>>>> I installed emscripten using the standard instructions as per >>>>>> https://emscripten.org/docs/getting_started/downloads.html#installation-instructions. >>>>>> Running `emcc -v` gave me no errors, and the following message: >>>>>> ``` >>>>>> (base) edbraun@gs66-lostcheme emscripten % emcc -v >>>>>> emcc (Emscripten gcc/clang-like replacement + linker emulating GNU >>>>>> ld) 2.0.9 >>>>>> clang version 12.0.0 >>>>>> (/opt/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project >>>>>> 27e9f0f95ef7b144d008bc1cf1459dced6cb5842) >>>>>> Target: x86_64-apple-darwin19.6.0 >>>>>> Thread model: posix >>>>>> InstalledDir: /Users/edbraun/software/emsdk/upstream/bin >>>>>> shared:INFO: (Emscripten: Running sanity checks) >>>>>> ``` >>>>>> >>>>>> I then moved on to the tutorial. Running `emcc tests/hello_world.c` >>>>>> gave me errors however: >>>>>> ``` >>>>>> In file included from tests/hello_world.c:8: >>>>>> In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64: >>>>>> In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:68: >>>>>> >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: >>>>>> error: Unsupported architecture >>>>>> #error Unsupported architecture >>>>>> ^ >>>>>> In file included from tests/hello_world.c:8: >>>>>> In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64: >>>>>> In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71: >>>>>> >>>>>> In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27: >>>>>> >>>>>> In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33: >>>>>> >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:2: >>>>>> error: architecture not supported >>>>>> #error architecture not supported >>>>>> ^ >>>>>> In file included from tests/hello_world.c:8: In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64: >>>>>> In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:71: >>>>>> In file included from >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27: >>>>>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:55:9: >>>>>> error: unknown type name '__int64_t'; did you mean '__int128_t'? typedef >>>>>> __int64_t __darwin_blkcnt_t; /* total blocks */ ^~~~~~~~~ __int128_t >>>>>> note: '__int128_t' declared here >>>>>> ``` >>>>>> And so on. >>>>>> >>>>>> I'm having trouble debugging how the installation went wrong. Any >>>>>> tips? I'm running macOS Catalina 10.15.7 with the zsh shell. >>>>>> >>>>>> Efrem Braun >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to a topic in the >>>>> Google Groups "emscripten-discuss" group. >>>>> To unsubscribe from this topic, visit >>>>> https://groups.google.com/d/topic/emscripten-discuss/2Ot0ZQoK9is/unsubscribe >>>>> . >>>>> To unsubscribe from this group and all its topics, send an email to >>>>> [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/emscripten-discuss/c319d3be-35b6-488d-8296-be3251529e77n%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/emscripten-discuss/c319d3be-35b6-488d-8296-be3251529e77n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- > You received this message because you are subscribed to a topic in the > Google Groups "emscripten-discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/emscripten-discuss/2Ot0ZQoK9is/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/c375d3c0-dd42-4aa3-a469-468abec6be40n%40googlegroups.com > <https://groups.google.com/d/msgid/emscripten-discuss/c375d3c0-dd42-4aa3-a469-468abec6be40n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CALV7rxkL4oTX2z%2BGGnLk16wt9KAjjCkHGQ_DphmzA-%3D0xmMHvQ%40mail.gmail.com.
