schellingb / wajic

WebAssembly JavaScript Interface Creator
zlib License
194 stars 5 forks source link

libc build - clang extern hidden #7

Closed Tythos closed 1 year ago

Tythos commented 2 years ago

Found this from your excellent https://schellcode.github.io/webassembly-without-emscripten ; thank you very much for putting together a very solid resource.

I've tried a few different versions (of the libc source and of your various makefiles) but keep running up against issues in the libc.h header in which clang's build profile rejects the use of "hidden":

In file included from ..\lib\libc\musl\src\aio\aio.c:11:
In file included from ..\lib\libc\musl\src\internal\pthread_impl.h:9:
..\lib\libc\musl\src\internal\libc.h:38:8: error: unknown type name 'hidden'
extern hidden struct __libc __libc;
       ^
..\lib\libc\musl\src\internal\libc.h:41:1: error: unknown type name 'hidden'
hidden void __init_libc(char **, char *);

I'm wondering if there is a clang build configuration flag I am missing from an update somewhere, or if perhaps I just need to completely refetch the libc source tree. Does this error seem familiar to you?

schellingb commented 2 years ago

I do remember something about hidden being unknown and it was either fixed one of the previous system library compatibility updates (a54bf18, 731d27d, f00377a) or by using a newer version of clang. Starting with system libraries 2.0.34, LLVM 12.0 or higher is a requirement.

Just tried building against very latest emscripten system libraries (main last released as 3.1.8) and got a new error I have never seen ('threading_internal.h' file not found) but I just fixed that (bc4d93c).

Now following the "Manually Building System Libraries" section of the README building system.bc works for me with the wajic.mk makefile of this repository.

Tythos commented 2 years ago

Interesting, so it sounds like it is most likely still a version mismatch. I have been using LLVM v13.0.1 but will try checking out specific versions of the system libraries to see if that makes a difference. Will post more updated when I have some details.

Tythos commented 1 year ago

Dropped this to chase other projects (SQUIRREL!) but I think the versioning resolves the original issue. I'm still transcribing makefiles to batch scripts but between versioning and the updates in wajic (vs original clangwasm) include paths I think I'm on the right track. Will close this. Thanks.