Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasi-libc fails to build #368

Open
jmgurney opened this issue Dec 20, 2022 · 12 comments
Open

wasi-libc fails to build #368

jmgurney opened this issue Dec 20, 2022 · 12 comments

Comments

@jmgurney
Copy link

When attempting to build wasm-libc, I get the following error:

$ make
[...]
diff -wur /Users/jmg/wasm/wasi-libc/expected/wasm32-wasi/defined-symbols.txt /Users/jmg/wasm/wasi-libc/sysroot/share/wasm32-wasi/defined-symbols.txt
--- /Users/jmg/wasm/wasi-libc/expected/wasm32-wasi/defined-symbols.txt	2022-12-20 11:19:59
+++ /Users/jmg/wasm/wasi-libc/sysroot/share/wasm32-wasi/defined-symbols.txt	2022-12-20 11:26:07
@@ -37,6 +37,7 @@
 __des_setkey
 __do_des
 __duplocale
+__emutls_v.errno
 __env_rm_add
 __errno_location
 __exp2f_data
make: *** [check-symbols] Error 1

I have simply cloned wasm-libc, and did a make in the directory. I am not sure why it is failing.

Environment:
macOS Ventura 13.0.1, MBP 14-inch, 2021, M1 Pro, Rosetta 2 is NOT installed, so only native arm binaries.

$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
$ clang --version
clang version 13.0.1
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-13/bin
$ llvm-ar --version
LLVM (http://llvm.org/):
  LLVM version 13.0.1
  Optimized build.
  Default target: arm64-apple-darwin22.1.0
  Host CPU: cyclone
$ llvm-nm --version
llvm-nm, compatible with GNU nm
LLVM (http://llvm.org/):
  LLVM version 13.0.1
  Optimized build.
  Default target: arm64-apple-darwin22.1.0
  Host CPU: cyclone
$ clang -print-targets
  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    amdgcn     - AMD GCN GPUs
    arm        - ARM
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    armeb      - ARM (big endian)
    avr        - Atmel AVR Microcontroller
    bpf        - BPF (host endian)
    bpfeb      - BPF (big endian)
    bpfel      - BPF (little endian)
    hexagon    - Hexagon
    lanai      - Lanai
    mips       - MIPS (32-bit big endian)
    mips64     - MIPS (64-bit big endian)
    mips64el   - MIPS (64-bit little endian)
    mipsel     - MIPS (32-bit little endian)
    msp430     - MSP430 [experimental]
    nvptx      - NVIDIA PTX 32-bit
    nvptx64    - NVIDIA PTX 64-bit
    ppc32      - PowerPC 32
    ppc32le    - PowerPC 32 LE
    ppc64      - PowerPC 64
    ppc64le    - PowerPC 64 LE
    r600       - AMD GPUs HD2XXX-HD6XXX
    riscv32    - 32-bit RISC-V
    riscv64    - 64-bit RISC-V
    sparc      - Sparc
    sparcel    - Sparc LE
    sparcv9    - Sparc V9
    systemz    - SystemZ
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    wasm32     - WebAssembly 32-bit
    wasm64     - WebAssembly 64-bit
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64
    xcore      - XCore

Let me know if you need additional environment information.

Thanks.

@sbc100
Copy link
Member

sbc100 commented Dec 20, 2022

It could be that the expectations were built with llvm 14 and using llvm 13 can produce slightly different results. It looks like we test with 10 and 14:

clang_version: [10.0.0, 14.0.0]

We do make some effort to try to account for different llvm version here:

wasi-libc/Makefile

Lines 621 to 632 in 957c711

@# TODO: Use llvm-nm --extern-only instead of grep. This is blocked on
@# LLVM PR40497, which is fixed in 9.0, but not in 8.0.
@# Ignore certain llvm builtin symbols such as those starting with __mul
@# since these dependencies can vary between llvm versions.
"$(NM)" --defined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libwasi-emulated-*.a "$(SYSROOT_LIB)"/*.o \
|grep ' [[:upper:]] ' |sed 's/.* [[:upper:]] //' |LC_ALL=C sort |uniq > "$(DEFINED_SYMBOLS)"
for undef_sym in $$("$(NM)" --undefined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libc-*.a "$(SYSROOT_LIB)"/*.o \
|grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \
grep -q '\<'$$undef_sym'\>' "$(DEFINED_SYMBOLS)" || echo $$undef_sym; \
done | grep -v "^__mul" > "$(UNDEFINED_SYMBOLS)"
grep '^_*imported_wasi_' "$(UNDEFINED_SYMBOLS)" \
> "$(SYSROOT_LIB)/libc.imports"
, but perhaps we need to add something.

I think its safe to say is not consequential and you can probably ignore it.

@jmgurney
Copy link
Author

So, just tried w/ clang 14 and get the same results (also tested w/ 15 and fails in the same way).

$ clang --version
clang version 14.0.6
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-14/bin
$ llvm-ar --version
LLVM (http://llvm.org/):
  LLVM version 14.0.6
  Optimized build.
  Default target: arm64-apple-darwin22.1.0
  Host CPU: cyclone
$ llvm-nm --version
llvm-nm, compatible with GNU nm
LLVM (http://llvm.org/):
  LLVM version 14.0.6
  Optimized build.
  Default target: arm64-apple-darwin22.1.0
  Host CPU: cyclone

@sunfishcode
Copy link
Member

"__emutls_v" indicates that LLVM's "emulated TLS" feature is getting enabled. Could the Apple-distributed clang have something like -femulated-tls enabled by default? If that's true, I wonder if we could work around the problem by adding -fno-emulated-tls to the wasi-libc build.

@jmgurney
Copy link
Author

Note that these are the MacPort installed versions of clang (installed in /opt), and not Apple's version.

Apple's version of clang does not have wasm support compiled in.

@jmgurney
Copy link
Author

minor note, I did end up compiling wasi-sdk which compiles wasi-libc as part of it because the MacPort's clang is missing the file libclang_rt.builtins-wasm32.a which prevents anything from compiling. I was hoping to avoid having to do that as I already had clang/llvm compiled.

@sunfishcode
Copy link
Member

Does that mean it's MacPorts that's enabling -femulated-tls? If so, then we may need a way to add -fno-emulated-tls in order to disable it.

@jmgurney
Copy link
Author

Not sure. It looks like it's "enabled" for 10.6 and before:
https://github.com/macports/macports-ports/blob/master/lang/llvm-14/Portfile

But that shouldn't made a difference, as I'm not on that version of MacOSX.

So I don't know how/why it's being enabled.

I also don't know HOW to enable emulated tls, so I don't really know where to look.

@GregoryConrad
Copy link

GregoryConrad commented Jan 27, 2023

Not really sure if you're looking for a fix here or a workaround, but wasi-libc builds fine on my M1 Mac using homebrew's llvm (brew install llvm):

# Set up WASI Libc sysroot
LLVM_BIN="/opt/homebrew/opt/llvm/bin"
WASI_VERSION_TAG="wasi-sdk-19"
WASI_LIBC_ROOT=wasi-libc
git clone --recursive https://github.com/WebAssembly/wasi-libc $WASI_LIBC_ROOT
(
    cd $WASI_LIBC_ROOT &&
    git checkout $WASI_VERSION_TAG &&
    make CC=$LLVM_BIN/clang AR=$LLVM_BIN/llvm-ar NM=$LLVM_BIN/llvm-nm THREAD_MODEL=posix # TODO remove THREAD_MODEL?
)

@gian-didom
Copy link

gian-didom commented Nov 14, 2023

On my Mac M1, the build fails. Even when supplying the llvm paths from brew, this is what I get:

In file included from dlmalloc/src/malloc.c:1468:

In file included from dlmalloc/src/malloc.c:1468:
sw/libs/wasi-libc/sysroot/include/stdlib.h:85:13: error: unknown type name 'wchar_t'
   85 | int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
      |             ^
sw/libs/wasi-libc/sysroot/include/stdlib.h:87:18: error: unknown type name 'wchar_t'
   87 | size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
      |                  ^
sw/libs/wasi-libc/sysroot/include/stdlib.h:88:42: error: unknown type name 'wchar_t'
   88 | size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
      |                                          ^
3 errors generated.
make: *** [build/wasm32-wasi/dlmalloc/src/dlmalloc.o] Error 1

Any suggestion?

@sbc100
Copy link
Member

sbc100 commented Nov 14, 2023

Could you share the full failing command line along with the full error output? (Perhaps just re-run make and attache the entire output?)

@gian-didom
Copy link

This is the full output from make, along with system specifications:

MacBook Pro 16", 2021, Apple M1 Pro 16 GB
OS: Sonoma 14.1

Flags have been set with:

  export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
  export LLVM_BIN="/opt/homebrew/opt/llvm/bin"
usr@MBPofUser wasi-libc %  make CC=$LLVM_BIN/clang AR=$LLVM_BIN/llvm-ar NM=$LLVM_BIN/llvm-nm
#
# Install the include files.
#
mkdir -p "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include"
cp -r "libc-bottom-half/headers/public"/* "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include"
# Generate musl's bits/alltypes.h header.
mkdir -p "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/bits"
sed -f libc-top-half/musl/tools/mkalltypes.sed \
            libc-top-half/musl/arch/wasm32/bits/alltypes.h.in \
            libc-top-half/musl/include/alltypes.h.in \
            > "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/bits/alltypes.h"
# Copy in the bulk of musl's public header files.
cp -r "libc-top-half/musl/include"/* "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include"
# Copy in the musl's "bits" header files.
cp -r "libc-top-half/musl"/arch/generic/bits/* "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/bits"
cp -r "libc-top-half/musl"/arch/wasm32/bits/* "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/bits"
# Remove selected header files.
rm -f /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/syscall.h.in" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/alltypes.h.in" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"alltypes.h.in" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"stdarg.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"stddef.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/errno.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/procfs.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/user.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/kd.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/vt.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/soundcard.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/sem.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/shm.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/msg.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/ipc.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/ptrace.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/statfs.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/kd.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/vt.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/soundcard.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/sem.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/shm.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/msg.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/ipc.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/ptrace.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/statfs.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/vfs.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/statvfs.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"syslog.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/syslog.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"wait.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/wait.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"ucontext.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/ucontext.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"paths.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"utmp.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"utmpx.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"lastlog.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/acct.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/cachectl.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/epoll.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/reboot.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/swap.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/sendfile.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/inotify.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/quota.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/klog.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/fsuid.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/io.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/prctl.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/mtio.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/mount.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/fanotify.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/personality.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"elf.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"link.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/link.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"scsi/scsi.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"scsi/scsi_ioctl.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"scsi/sg.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/auxv.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"pwd.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"shadow.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"grp.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"mntent.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"netdb.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"resolv.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"pty.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"dlfcn.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"setjmp.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"ulimit.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/xattr.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"wordexp.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"spawn.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/membarrier.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/signalfd.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"termios.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/termios.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"bits/termios.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"net/if.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"net/if_arp.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"net/ethernet.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"net/route.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"netinet/if_ether.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"netinet/ether.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/timerfd.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"libintl.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"sys/sysmacros.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"aio.h" /path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/"pthread.h"
clang -O2 -DNDEBUG --target=wasm32-wasi -fno-trapping-math -Wall -Wextra -Werror -Wno-null-pointer-arithmetic -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-ignored-attributes -Wno-missing-braces -Wno-ignored-pragmas -Wno-unused-but-set-variable -Wno-unknown-warning-option -mthread-model single -isystem "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include" -Ilibc-bottom-half/headers/private -Ilibc-bottom-half/cloudlibc/src/include -Ilibc-bottom-half/cloudlibc/src -Ilibc-top-half/musl/src/include -Ilibc-top-half/musl/src/internal -fPIC -fvisibility=default -MD -MP -o build/wasm32-wasi/libc-bottom-half/crt/crt1-command.o -c libc-bottom-half/crt/crt1-command.c
clang -O2 -DNDEBUG --target=wasm32-wasi -fno-trapping-math -Wall -Wextra -Werror -Wno-null-pointer-arithmetic -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-ignored-attributes -Wno-missing-braces -Wno-ignored-pragmas -Wno-unused-but-set-variable -Wno-unknown-warning-option -mthread-model single -isystem "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include" -Ilibc-bottom-half/headers/private -Ilibc-bottom-half/cloudlibc/src/include -Ilibc-bottom-half/cloudlibc/src -Ilibc-top-half/musl/src/include -Ilibc-top-half/musl/src/internal -fPIC -fvisibility=default -MD -MP -o build/wasm32-wasi/libc-bottom-half/crt/crt1-reactor.o -c libc-bottom-half/crt/crt1-reactor.c
clang -O2 -DNDEBUG --target=wasm32-wasi -fno-trapping-math -Wall -Wextra -Werror -Wno-null-pointer-arithmetic -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-ignored-attributes -Wno-missing-braces -Wno-ignored-pragmas -Wno-unused-but-set-variable -Wno-unknown-warning-option -mthread-model single -isystem "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include" -Ilibc-bottom-half/headers/private -Ilibc-bottom-half/cloudlibc/src/include -Ilibc-bottom-half/cloudlibc/src -Ilibc-top-half/musl/src/include -Ilibc-top-half/musl/src/internal -fPIC -fvisibility=default -MD -MP -o build/wasm32-wasi/libc-bottom-half/crt/crt1.o -c libc-bottom-half/crt/crt1.c
#
# Install the startup files (crt1.o etc).
#
mkdir -p "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/lib/wasm32-wasi" && \
        cp build/wasm32-wasi/libc-bottom-half/crt/crt1-command.o build/wasm32-wasi/libc-bottom-half/crt/crt1-reactor.o build/wasm32-wasi/libc-bottom-half/crt/crt1.o "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/lib/wasm32-wasi"
clang -O2 -DNDEBUG --target=wasm32-wasi -fno-trapping-math -Wall -Wextra -Werror -Wno-null-pointer-arithmetic -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-ignored-attributes -Wno-missing-braces -Wno-ignored-pragmas -Wno-unused-but-set-variable -Wno-unknown-warning-option -mthread-model single -isystem "/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include" -Idlmalloc/include -MD -MP -o build/wasm32-wasi/dlmalloc/src/dlmalloc.o -c dlmalloc/src/dlmalloc.c
In file included from dlmalloc/src/dlmalloc.c:63:
In file included from dlmalloc/src/malloc.c:1468:
/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/stdlib.h:85:13: error: unknown type name 'wchar_t'
   85 | int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
      |             ^
/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/stdlib.h:87:18: error: unknown type name 'wchar_t'
   87 | size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
      |                  ^
/path/to/wasi/with spaces/sw/libs/wasi-libc/sysroot/include/stdlib.h:88:42: error: unknown type name 'wchar_t'
   88 | size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
      |                                          ^
3 errors generated.
make: *** [build/wasm32-wasi/dlmalloc/src/dlmalloc.o] Error 1

@sbc100
Copy link
Member

sbc100 commented Nov 15, 2023

Can you try running that failing command but adding -E to get the pre-processed output? When I do this and I look at the preprocessed output the first occurrence of wchar_t the I see is:

# 74 "/usr/lib/llvm-14/lib/clang/14.0.6/include/stddef.h" 3
typedef int wchar_t;    

I'm guess you don't see this? Which version of stddef.h is being included in your case? What does the definition of wchar_t look like in that file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants