PetterS / clang-wasm

How to build webassembly files with nothing other than standard Clang/llvm.
143 stars 15 forks source link

MacOS: fatal error: 'memory.h' file not found #4

Closed stkevintan closed 4 years ago

stkevintan commented 5 years ago

I replace clang++-8 with clang++ in README.md ,since my clang version is already 8.0.0; but when runing make in terminal, I encounter an error: 图片

PetterS commented 5 years ago

I forgot what that was used for. What fails if it is removed?

Perhaps it should be <string.h> instead? Can you try this?

stkevintan commented 5 years ago

@PetterS <string.h> still doesn't work. I guess, did you forget some compile flag , like --sysroot?

PetterS commented 5 years ago

Well, what is the error if you remove the header?

stkevintan commented 5 years ago

same error except 'memory.h' becames to 'string.h'

PetterS commented 5 years ago

OK, I meant without the headers at all.

But <string.h> is a standard C header. So I'm afraid I can't help you here. Clang should need that to do just about anything.

stkevintan commented 5 years ago

I figure out the cannot found errors by tweak my mac commandline tools. but, I encounter some other errors:

❯ make                                                                                                                                                                                   clang-wasm/git/master !
clang++ \
                -c \
                -Wall --target=wasm32-unknown-unknown-wasm -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:803: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
 ^
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:
/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 */
        ^
note: '__int128_t' declared here
/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
        ^
note: '__int128_t' declared here
/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t       __darwin_dev_t;         /* dev_t */
        ^
note: '__int128_t' declared here
/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_gid_t;         /* [???] process and group IDs */
        ^
note: '__uint128_t' declared here
/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_id_t;          /* [XSI] pid_t, uid_t, or gid_t*/
        ^
note: '__uint128_t' declared here
/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'; did you mean '__uint128_t'?
typedef __uint64_t      __darwin_ino64_t;       /* [???] Used for 64 bit inodes */
        ^
note: '__uint128_t' declared here
/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
        ^
/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'; did you mean '__uint128_t'?
typedef __uint16_t      __darwin_mode_t;        /* [???] Some file attributes */
        ^
note: '__uint128_t' declared here
/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?
typedef __int64_t       __darwin_off_t;         /* [???] Used for file sizes */
        ^
note: '__int128_t' declared here
/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t       __darwin_pid_t;         /* [???] process and group IDs */
        ^
note: '__int128_t' declared here
/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_sigset_t;      /* [???] signal set */
        ^
note: '__uint128_t' declared here
/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?
typedef __int32_t       __darwin_suseconds_t;   /* [???] microseconds */
        ^
note: '__int128_t' declared here
/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_uid_t;         /* [???] user IDs */
        ^
note: '__uint128_t' declared here
/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?
typedef __uint32_t      __darwin_useconds_t;    /* [???] microseconds */
        ^
note: '__uint128_t' declared here
In file included from library.cpp:1:
In file included from /usr/include/memory.h:36:
In file included from /usr/include/string.h:64:
/usr/include/sys/_types/_size_t.h:31:9: error: unknown type name '__darwin_size_t'
typedef __darwin_size_t        size_t;
        ^
In file included from library.cpp:1:
In file included from /usr/include/memory.h:36:
In file included from /usr/include/string.h:152:
In file included from /usr/include/sys/_types/_ssize_t.h:30:
/usr/include/machine/types.h:37:2: error: architecture not supported
#error architecture not supported
 ^
In file included from library.cpp:1:
In file included from /usr/include/memory.h:36:
In file included from /usr/include/string.h:152:
/usr/include/sys/_types/_ssize_t.h:31:9: error: unknown type name '__darwin_ssize_t'; did you mean '__darwin_blksize_t'?
typedef __darwin_ssize_t        ssize_t;
        ^
/usr/include/sys/_types.h:56:25: note: '__darwin_blksize_t' declared here
typedef __int32_t       __darwin_blksize_t;     /* preferred block size */
                        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [library.o] Error 1

Do you test it in Mac OS X system ? I'm not sure if it is related to OSX

PetterS commented 5 years ago

No, I don't have a Mac, nor do I have access to one.

PetterS commented 5 years ago

But the error message "#error Unsupported architecture" seems to suggest that it is impossible with your current architechture?