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

Build instructions don't work #4

Open
jedisct1 opened this issue Jun 5, 2023 · 2 comments
Open

Build instructions don't work #4

jedisct1 opened this issue Jun 5, 2023 · 2 comments
Assignees

Comments

@jedisct1
Copy link

jedisct1 commented Jun 5, 2023

I tried to build wasix-libc as documented:

make CC='zig cc -target wasm32-freestanding` AR=`zig ar` NM=`zig nm`

But that fails with:

find: ‘libc-bottom-half/getpid’: No such file or directory
find: ‘build/-wasi’: No such file or directory
#
# Install the include files.
#
mkdir -p "/tmp/wasix-libc/sysroot/include"
cp -r "libc-bottom-half/headers/public"/* "/tmp/wasix-libc/sysroot/include"
# Generate musl's bits/alltypes.h header.
mkdir -p "/tmp/wasix-libc/sysroot/include/bits"
sed -f libc-top-half/musl/tools/mkalltypes.sed \
    libc-top-half/musl/arch//bits/alltypes.h.in \
    libc-top-half/musl/include/alltypes.h.in \
    > "/tmp/wasix-libc/sysroot/include/bits/alltypes.h"
sed: can't read libc-top-half/musl/arch//bits/alltypes.h.in: No such file or directory
make: *** [Makefile:611: include_dirs] Error 2

The build32.sh script fails on macOS due to GNUisms. On Linux, it successfully completes.
But then, the sysroot folder contains headers, but lib/wasm32-wasi folder is empty.

How to build wasix-libc?

@waikuen2010
Copy link

waikuen2010 commented Jun 9, 2023

I face similar issue as you did. It took me quite a while to build the wasix sysroot. I believe the build instruction need to be updated. Here is what I found.

First, there is not need to run build32.sh and build64.sh. What these script did (except the final make step, because /sysroot is in the .gitignore file) is already reflect in the current commit of the repo.

Second I found some issues in the Makefile, as the output suggest

find: ‘libc-bottom-half/getpid’: No such file or directory
find: ‘build/-wasi’: No such file or directory

The first line is complaining about not finding getpid.c which is not in /libc-bottom-half but inside /libc-bottom-half/sources
Correcting the Makefile get me through this part.

The second line is caused by missing environment variables.

# or wasm64
export TARGET_ARCH=wasm32
export TARGET_OS=wasix

Finally, I use wasi-sdk to build the sysroot

CC=${WASI_SDK_PATH}/bin/clang AR=${WASI_SDK_PATH}/bin/llvm-ar NM=${WASI_SDK_PATH}/bin/llvm-nm make -j $NUM_OF_CPUS

@lauler1
Copy link

lauler1 commented Oct 11, 2023

# or wasm64
export TARGET_ARCH=wasm32
export TARGET_OS=wasix

Finally, I use wasi-sdk to build the sysroot

CC=${WASI_SDK_PATH}/bin/clang AR=${WASI_SDK_PATH}/bin/llvm-ar NM=${WASI_SDK_PATH}/bin/llvm-nm make -j $NUM_OF_CPUS

Worked!!!!

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

4 participants