From 320d39d73ad412e22431a0748dea7e358e8376bc Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Mon, 13 Jan 2020 15:34:44 -0800 Subject: [PATCH 01/10] use compnerd/cmake's build of wasi-libc https://github.com/CraneStation/wasi-libc/pull/154#issuecomment-573383839 --- src/wasi-libc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wasi-libc b/src/wasi-libc index f645f498d..d68f3d385 160000 --- a/src/wasi-libc +++ b/src/wasi-libc @@ -1 +1 @@ -Subproject commit f645f498dfbbbc00a7a97874d33082d3605c3f21 +Subproject commit d68f3d385c442b9fbc50ffe018cc89b349cc5193 From 84071e4b814d64165b4c72cddd619756839cc4de Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 14 Jan 2020 12:11:52 -0800 Subject: [PATCH 02/10] makefile: invoke cmake for wasi-libc --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 712e63745..456853fd3 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,13 @@ build/llvm.BUILT: touch build/llvm.BUILT build/wasi-libc.BUILT: build/llvm.BUILT - $(MAKE) -C $(ROOT_DIR)/src/wasi-libc \ - WASM_CC=$(PREFIX)/bin/clang \ - SYSROOT=$(PREFIX)/share/wasi-sysroot + cmake -G Ninja -B build/wasi-libc \ + -DCMAKE_SYSTEM_NAME=Generic \ + -DCMAKE_AR=$(ROOT_DIR)/bin/llvm-ar \ + -DCMAKE_NM=$(ROOT_DIR)/bin/llvm-nm \ + -DCMAKE_C_COMPILER=$(ROOT_DIR)/bin/clang \ + -S $(ROOT_DIR)/src/wasi-libc \ + --build touch build/wasi-libc.BUILT build/compiler-rt.BUILT: build/llvm.BUILT From a93e176eb2e2653b8a6760f16eed9dc6986923f3 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 14 Jan 2020 14:30:42 -0800 Subject: [PATCH 03/10] fix cmake invocation --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 456853fd3..9da2a831d 100644 --- a/Makefile +++ b/Makefile @@ -52,13 +52,14 @@ build/llvm.BUILT: touch build/llvm.BUILT build/wasi-libc.BUILT: build/llvm.BUILT - cmake -G Ninja -B build/wasi-libc \ + cmake -G Ninja \ + --build \ -DCMAKE_SYSTEM_NAME=Generic \ -DCMAKE_AR=$(ROOT_DIR)/bin/llvm-ar \ -DCMAKE_NM=$(ROOT_DIR)/bin/llvm-nm \ -DCMAKE_C_COMPILER=$(ROOT_DIR)/bin/clang \ - -S $(ROOT_DIR)/src/wasi-libc \ - --build + -B build/wasi-libc \ + -S $(ROOT_DIR)/src/wasi-libc touch build/wasi-libc.BUILT build/compiler-rt.BUILT: build/llvm.BUILT From 011c8212235319cd56f605db62aa89485315ff70 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Tue, 14 Jan 2020 16:04:33 -0800 Subject: [PATCH 04/10] install wasi-libc --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9da2a831d..495fa5e99 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ build/llvm.BUILT: build/wasi-libc.BUILT: build/llvm.BUILT cmake -G Ninja \ - --build \ + --install \ -DCMAKE_SYSTEM_NAME=Generic \ -DCMAKE_AR=$(ROOT_DIR)/bin/llvm-ar \ -DCMAKE_NM=$(ROOT_DIR)/bin/llvm-nm \ From cc17310f2811f8d8e6ac3bd3cef038f8796ee659 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Wed, 15 Jan 2020 15:27:05 -0800 Subject: [PATCH 05/10] makefile: compiler-rt requires libc to be installed to build int_util.c:57 includes stdlib.h, which isnt a new thing. was there just a race that it used to always win? --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 495fa5e99..c43b534d8 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ build/wasi-libc.BUILT: build/llvm.BUILT -S $(ROOT_DIR)/src/wasi-libc touch build/wasi-libc.BUILT -build/compiler-rt.BUILT: build/llvm.BUILT +build/compiler-rt.BUILT: build/wasi-libc.BUILT build/llvm.BUILT mkdir -p build/compiler-rt cd build/compiler-rt; cmake -G Ninja \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ From c24740355dfe8c3c52b8ccd7efebb7c2311e5bb6 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Thu, 16 Jan 2020 17:41:18 -0800 Subject: [PATCH 06/10] makefile: point at actual install loc of tools; drop llvm- on ar and nm thanks dan for pointing out we dont need the prefix --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c43b534d8..8652d6daa 100644 --- a/Makefile +++ b/Makefile @@ -55,9 +55,9 @@ build/wasi-libc.BUILT: build/llvm.BUILT cmake -G Ninja \ --install \ -DCMAKE_SYSTEM_NAME=Generic \ - -DCMAKE_AR=$(ROOT_DIR)/bin/llvm-ar \ - -DCMAKE_NM=$(ROOT_DIR)/bin/llvm-nm \ - -DCMAKE_C_COMPILER=$(ROOT_DIR)/bin/clang \ + -DCMAKE_AR=$(PREFIX)/bin/ar \ + -DCMAKE_NM=$(PREFIX)/bin/nm \ + -DCMAKE_C_COMPILER=$(PREFIX)/bin/clang \ -B build/wasi-libc \ -S $(ROOT_DIR)/src/wasi-libc touch build/wasi-libc.BUILT From 0f1f908673da7d26c4259448deadeedc03c9df1e Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Wed, 22 Jan 2020 20:50:59 -0800 Subject: [PATCH 07/10] makefile: when building libc, insist that C compiler works cmake wont be able to execute the wasm program output by wasi-sdk's clang --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 8652d6daa..66bb58668 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,7 @@ build/wasi-libc.BUILT: build/llvm.BUILT -DCMAKE_AR=$(PREFIX)/bin/ar \ -DCMAKE_NM=$(PREFIX)/bin/nm \ -DCMAKE_C_COMPILER=$(PREFIX)/bin/clang \ + -DCMAKE_C_COMPILER_WORKS=YES \ -B build/wasi-libc \ -S $(ROOT_DIR)/src/wasi-libc touch build/wasi-libc.BUILT From 481c967201bebfe7cac995cc73e92a7e55e5e172 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Thu, 23 Jan 2020 10:03:25 -0800 Subject: [PATCH 08/10] makefile: invoke ninja after cmake i thought that was what --install would do. oh well --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 66bb58668..f9b7731c6 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,6 @@ build/llvm.BUILT: build/wasi-libc.BUILT: build/llvm.BUILT cmake -G Ninja \ - --install \ -DCMAKE_SYSTEM_NAME=Generic \ -DCMAKE_AR=$(PREFIX)/bin/ar \ -DCMAKE_NM=$(PREFIX)/bin/nm \ @@ -61,6 +60,8 @@ build/wasi-libc.BUILT: build/llvm.BUILT -DCMAKE_C_COMPILER_WORKS=YES \ -B build/wasi-libc \ -S $(ROOT_DIR)/src/wasi-libc + ninja $(NINJA_FLAGS) -v -C build/wasi-libc \ + install touch build/wasi-libc.BUILT build/compiler-rt.BUILT: build/wasi-libc.BUILT build/llvm.BUILT From 15675d339eb78d86785760eaf01a3dd9fbdd712e Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Thu, 23 Jan 2020 16:11:16 -0800 Subject: [PATCH 09/10] i have no idea what im doing.jpg --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f9b7731c6..7b648e616 100644 --- a/Makefile +++ b/Makefile @@ -52,14 +52,14 @@ build/llvm.BUILT: touch build/llvm.BUILT build/wasi-libc.BUILT: build/llvm.BUILT - cmake -G Ninja \ + mkdir -p build/wasi-libc + cd build/wasi-libc; cmake -G Ninja \ -DCMAKE_SYSTEM_NAME=Generic \ -DCMAKE_AR=$(PREFIX)/bin/ar \ -DCMAKE_NM=$(PREFIX)/bin/nm \ -DCMAKE_C_COMPILER=$(PREFIX)/bin/clang \ -DCMAKE_C_COMPILER_WORKS=YES \ - -B build/wasi-libc \ - -S $(ROOT_DIR)/src/wasi-libc + $(ROOT_DIR)/src/wasi-libc ninja $(NINJA_FLAGS) -v -C build/wasi-libc \ install touch build/wasi-libc.BUILT From 84211ae264e0fc4c6ce0534aa21bbeead29c6482 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Fri, 24 Jan 2020 20:01:46 -0800 Subject: [PATCH 10/10] manually install wasi-libc --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7b648e616..a303013d8 100644 --- a/Makefile +++ b/Makefile @@ -60,8 +60,9 @@ build/wasi-libc.BUILT: build/llvm.BUILT -DCMAKE_C_COMPILER=$(PREFIX)/bin/clang \ -DCMAKE_C_COMPILER_WORKS=YES \ $(ROOT_DIR)/src/wasi-libc - ninja $(NINJA_FLAGS) -v -C build/wasi-libc \ - install + ninja $(NINJA_FLAGS) -v -C build/wasi-libc + mkdir -p $(PREFIX)/share + cp -R build/wasi-libc/sysroot $(PREFIX)/share/wasi-sysroot touch build/wasi-libc.BUILT build/compiler-rt.BUILT: build/wasi-libc.BUILT build/llvm.BUILT