runno icon indicating copy to clipboard operation
runno copied to clipboard

Error when including stdlib.h Clang

Open LukePrior opened this issue 2 years ago • 2 comments

The program will fail to compile if stdlib.h is included.

Three errors occur all appearing to do with wchar_t

In file included from program:2:
/sys/include/stdlib.h:83:13: error: unknown type name 'wchar_t'
int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
            ^
/sys/include/stdlib.h:85:18: error: unknown type name 'wchar_t'
size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
                 ^
/sys/include/stdlib.h:86:42: error: unknown type name 'wchar_t'
size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);

Example here.

LukePrior avatar Apr 07 '22 08:04 LukePrior

I tried compiling the code using wasm-clang directly and it seems to have worked so I'm not sure what the issue is.

image

LukePrior avatar Apr 07 '22 08:04 LukePrior

If you switch to the clangpp runtime this seems to work fine. The clang available on WAPM (https://wapm.io/syrusakbary/clang) had a bunch of issues with C++ so I fixed them in runno-clang (https://wapm.io/taybenlor/runno-clang) by copying wasm-clang. This could probably be fixed by switching uses of clang in the C runtime to runno-clang (PR welcome!).

taybenlor avatar Apr 07 '22 13:04 taybenlor

This is fixed by the new runtime in v0.4.2

taybenlor avatar Jun 11 '23 13:06 taybenlor