-
Notifications
You must be signed in to change notification settings - Fork 129
fix(nix): Use wasi-sdk 12 to provide barretenberg-wasm in overlay #315
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9aa4359
fix(nix): Use wasi-sdk 12 to provide barretenberg-wasm in overlay
phated 77c94f6
chore: Remove the wasm stuff from main package
phated 8f47886
chore(nix): Switch the default llvm to 11
phated 8b8887c
chore(nix): Add transcript00 to the overlay
phated 3f4b717
Use hash for each platform
phated b11c5bf
avoid symlinks
phated 9cd2417
try wasi-sdk that someone wrote on github
phated 36af9b7
fix hash for linux
phated b6011a3
try to ignore libstdc++
phated bfa271e
need the whole name
phated 05ad1ec
try to include std lib instead of ignore
phated e7b02d0
cleanup and nix flake check
phated 1159aa2
chore(ci): Check the nix flake in CI
phated 12957ac
run default build instead of llvm12
phated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { stdenv, cmake, ninja, binaryen, callPackage }: | ||
| let | ||
| toolchain_file = ./cpp/cmake/toolchains/wasm32-wasi.cmake; | ||
| wasi-sdk = callPackage ./wasi-sdk.nix { }; | ||
| in | ||
| stdenv.mkDerivation | ||
| { | ||
| pname = "barretenberg.wasm"; | ||
| version = "0.1.0"; | ||
|
|
||
| src = ./cpp; | ||
|
|
||
| nativeBuildInputs = [ cmake ninja binaryen wasi-sdk ]; | ||
|
|
||
| buildInputs = [ ]; | ||
|
|
||
| cmakeFlags = [ | ||
| "-DTESTING=OFF" | ||
| "-DBENCHMARKS=OFF" | ||
| "-DCMAKE_TOOLCHAIN_FILE=${toolchain_file}" | ||
| "-DCMAKE_C_COMPILER=${wasi-sdk}/bin/clang" | ||
| "-DCMAKE_CXX_COMPILER=${wasi-sdk}/bin/clang++" | ||
| "-DCMAKE_AR=${wasi-sdk}/bin/llvm-ar" | ||
| "-DCMAKE_RANLIB=${wasi-sdk}/bin/llvm-ranlib" | ||
| "-DCMAKE_SYSROOT=${wasi-sdk}/share/wasi-sysroot" | ||
| "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER" | ||
| "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY" | ||
| "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY" | ||
| "-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY" | ||
| "-DCMAKE_C_COMPILER_WORKS=ON" | ||
| "-DCMAKE_CXX_COMPILER_WORKS=ON" | ||
| ]; | ||
|
|
||
| enableParallelBuilding = true; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Copied from https://github.com/ereslibre/nixities/blob/2c60af777fc863f90e6e4eeffcf3465def93a1f3/packages/wasi-sdk/default.nix | ||
| # with a fix for the autoPatchelfHook needing libstdc++.so and some refactor | ||
| { lib, pkgs, stdenv }: | ||
| let | ||
| pname = "wasi-sdk"; | ||
| version = "12"; | ||
| in | ||
| pkgs.stdenv.mkDerivation { | ||
| inherit pname version; | ||
|
|
||
| sourceRoot = "${pname}-${version}.0"; | ||
| dontBuild = true; | ||
| dontConfigure = true; | ||
| dontStrip = true; | ||
|
|
||
| nativeBuildInputs = | ||
| lib.optional stdenv.isLinux (with pkgs; [ autoPatchelfHook ]); | ||
|
|
||
| # Needed by autoPatchelfHook to have libstdc++ | ||
| # see https://discourse.nixos.org/t/autopatchelfhook-not-patching-all-dependencies/14634/6 | ||
| buildInputs = | ||
| lib.optional stdenv.isLinux [ stdenv.cc.cc.lib ]; | ||
|
|
||
| installPhase = '' | ||
| mkdir -p $out/{bin,lib,share} | ||
| mv bin/* $out/bin/ | ||
| mv lib/* $out/lib/ | ||
| mv share/* $out/share/ | ||
| ''; | ||
|
|
||
| src = | ||
| let | ||
| tarball = | ||
| if stdenv.hostPlatform.isDarwin then { | ||
| suffix = "macos"; | ||
| hash = "sha256-juJfnD/eYY/upcV62tOFFSYmeEtra1L7Vj5e2DK/U+8="; | ||
| } else { | ||
| suffix = "linux"; | ||
| hash = "sha256-+kdpTXW/b86Y++eScZMpiyXuA9reJ/ykU9fdUwN4lzo="; | ||
| }; | ||
| in | ||
|
|
||
| pkgs.fetchurl { | ||
| url = | ||
| "https://github.com/WebAssembly/${pname}/releases/download/${pname}-${version}/${pname}-${version}.0-${tarball.suffix}.tar.gz"; | ||
| hash = tarball.hash; | ||
| }; | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.