Closed grassel closed 5 years ago
What is the clang++ --version ?
Clang 8 was not released in November 2018 so it is likely too old.
Ah, my bad, sorry, Peter. I should have told , I am using the just released clang/llvm 8. I mentioned the XCode command line tools of Nov 2018 because ( I am speculating ) these update the headers /usr/include/*.h
I see!
Then I think your system headers for some reason do not support the wasm target. But that is a very minor problem since this project use almost nothing from the system headers anyway.
We could easily create our own system header with printf, malloc etc. and that would work fine.
Here is a branch that does this: https://github.com/PetterS/clang-wasm/tree/no_c_headers
Thank you for your help PetterS. I used your branch 'no_c_headers'. Compilation whent ok except for printf.cpp It still complained about unsupported architecture when compiling printf.cpp. Following your suggestion I changed printf.cpp as follows:
typedef long int intmax_t;
typedef long unsigned int uintmax_t;
typedef unsigned long uintptr_t;
//#include
These definition are copied from header files in directories /usr/include/_types and /usr/include/sys/_types on my system (macos).
I will close the issue.
Hi
Great stuff - appreciate your effort to teach how to use the new WASM support in LLVM. I am having an issue with the header files. Unsupported architecture Any idea what could be wrong:
I am on macOS 10.13 with Xcode 10.1 command line tools installed (November 2018) So, system headers should be reasonably fresh.
The beginning of output of make with your Makefile:
make clang++ \ -c \ -I. -I./nanolibc -Wall --target=wasm32 -Os -flto -nostdlib -fvisibility=hidden -std=c++14 -ffunction-sections -fdata-sections -DPRINTF_DISABLE_SUPPORT_FLOAT=1 -DPRINTF_DISABLE_SUPPORT_LONG_LONG=1 -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T=1 \ -o library.o \ library.cpp In file included from library.cpp:1: In file included from /usr/include/memory.h:36: In file included from /usr/include/string.h:61: In file included from /usr/include/_types.h:27: In file included from /usr/include/sys/_types.h:32: /usr/include/sys/cdefs.h:763:2: error: Unsupported architecture
error Unsupported architecture
^ In file included from library.cpp:1: In file included from /usr/include/memory.h:36: In file included from /usr/include/string.h:61: In file included from /usr/include/_types.h:27: In file included from /usr/include/sys/_types.h:33: /usr/include/machine/_types.h:34:2: error: architecture not supported
error architecture not supported