pin new wamr commit + add .text.wamr_mmap section to linker.ld
This commit is contained in:
904
flake.nix
904
flake.nix
@ -12,527 +12,539 @@ rec {
|
|||||||
flake-utils,
|
flake-utils,
|
||||||
}:
|
}:
|
||||||
# Create a shell (and possibly package) for each possible system, not only x86_64-linux
|
# Create a shell (and possibly package) for each possible system, not only x86_64-linux
|
||||||
flake-utils.lib.eachDefaultSystem (system: let
|
flake-utils.lib.eachDefaultSystem (
|
||||||
# =========================================================================================
|
system: let
|
||||||
# Define pkgs/stdenvs
|
# =========================================================================================
|
||||||
# =========================================================================================
|
# Define pkgs/stdenvs
|
||||||
pkgs = import nixpkgs {
|
# =========================================================================================
|
||||||
inherit system;
|
pkgs = import nixpkgs {
|
||||||
config.allowUnfree = true;
|
|
||||||
overlays = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
i386_pkgs = import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
config.allowUnfree = true;
|
|
||||||
overlays = [];
|
|
||||||
|
|
||||||
# Build crosscompiler
|
|
||||||
crossSystem = {
|
|
||||||
config = "i386-elf";
|
|
||||||
libc = "newlib";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
boost_pkgs =
|
|
||||||
import (builtins.fetchTarball {
|
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/824421b1796332ad1bcb35bc7855da832c43305f.tar.gz";
|
|
||||||
sha256 = "sha256:1w6cjnakz1yi66rs8c6nmhymsr7bj82vs2hz200ipi1sfiq8dy4y";
|
|
||||||
}) {
|
|
||||||
inherit system;
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
overlays = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
libdwarf_pkgs =
|
i386_pkgs = import nixpkgs {
|
||||||
import (builtins.fetchTarball {
|
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/f597e7e9fcf37d8ed14a12835ede0a7d362314bd.tar.gz";
|
|
||||||
sha256 = "sha256:1l79hh7jh7m8yc5mvc8dbg6s8rf30bgm994kf07xriqbzwfn158r";
|
|
||||||
}) {
|
|
||||||
inherit system;
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
overlays = [];
|
||||||
|
|
||||||
|
# Build crosscompiler
|
||||||
|
crossSystem = {
|
||||||
|
config = "i386-elf";
|
||||||
|
libc = "newlib";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit (pkgs) lib stdenv;
|
boost_pkgs =
|
||||||
|
import
|
||||||
|
(builtins.fetchTarball {
|
||||||
|
url = "https://github.com/NixOS/nixpkgs/archive/824421b1796332ad1bcb35bc7855da832c43305f.tar.gz";
|
||||||
|
sha256 = "sha256:1w6cjnakz1yi66rs8c6nmhymsr7bj82vs2hz200ipi1sfiq8dy4y";
|
||||||
|
})
|
||||||
|
{
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
|
||||||
# =========================================================================================
|
libdwarf_pkgs =
|
||||||
# Define shell environment
|
import
|
||||||
# =========================================================================================
|
(builtins.fetchTarball {
|
||||||
|
url = "https://github.com/NixOS/nixpkgs/archive/f597e7e9fcf37d8ed14a12835ede0a7d362314bd.tar.gz";
|
||||||
|
sha256 = "sha256:1l79hh7jh7m8yc5mvc8dbg6s8rf30bgm994kf07xriqbzwfn158r";
|
||||||
|
})
|
||||||
|
{
|
||||||
|
inherit system;
|
||||||
|
};
|
||||||
|
|
||||||
# Setup the shell when entering the "nix develop" environment (bash script).
|
inherit (pkgs) lib stdenv;
|
||||||
shellHook = let
|
|
||||||
mkCmakeScript = type: let
|
|
||||||
typeLower = lib.toLower type;
|
|
||||||
in
|
|
||||||
pkgs.writers.writeFish "cmake-${typeLower}.fish" ''
|
|
||||||
cd $FLAKE_PROJECT_ROOT
|
|
||||||
|
|
||||||
echo "Removing build directory ./cmake-build-${typeLower}/"
|
# =========================================================================================
|
||||||
rm -rf ./cmake-build-${typeLower}
|
# Define shell environment
|
||||||
|
# =========================================================================================
|
||||||
|
|
||||||
echo "Creating build directory"
|
# Setup the shell when entering the "nix develop" environment (bash script).
|
||||||
mkdir cmake-build-${typeLower}
|
shellHook = let
|
||||||
cd cmake-build-${typeLower}
|
mkCmakeScript = type: let
|
||||||
|
typeLower = lib.toLower type;
|
||||||
|
in
|
||||||
|
pkgs.writers.writeFish "cmake-${typeLower}.fish" ''
|
||||||
|
cd $FLAKE_PROJECT_ROOT
|
||||||
|
|
||||||
echo "Running cmake"
|
echo "Removing build directory ./cmake-build-${typeLower}/"
|
||||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="${type}" -DCMAKE_EXPORT_COMPILE_COMMANDS="On" ..
|
rm -rf ./cmake-build-${typeLower}
|
||||||
|
|
||||||
echo "Linking compile_commands.json"
|
echo "Creating build directory"
|
||||||
cd ..
|
mkdir cmake-build-${typeLower}
|
||||||
ln -sf ./cmake-build-${typeLower}/compile_commands.json ./compile_commands.json
|
cd cmake-build-${typeLower}
|
||||||
|
|
||||||
|
echo "Running cmake"
|
||||||
|
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="${type}" -DCMAKE_EXPORT_COMPILE_COMMANDS="On" ..
|
||||||
|
|
||||||
|
echo "Linking compile_commands.json"
|
||||||
|
cd ..
|
||||||
|
ln -sf ./cmake-build-${typeLower}/compile_commands.json ./compile_commands.json
|
||||||
|
'';
|
||||||
|
|
||||||
|
cmakeDebug = mkCmakeScript "Debug";
|
||||||
|
cmakeRelease = mkCmakeScript "Release";
|
||||||
|
|
||||||
|
mkBuildScript = type: let
|
||||||
|
typeLower = lib.toLower type;
|
||||||
|
in
|
||||||
|
pkgs.writers.writeFish "cmake-build.fish" ''
|
||||||
|
cd $FLAKE_PROJECT_ROOT/cmake-build-${typeLower}
|
||||||
|
|
||||||
|
echo "Running cmake"
|
||||||
|
cmake --build .
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildDebug = mkBuildScript "Debug";
|
||||||
|
buildRelease = mkBuildScript "Release";
|
||||||
|
|
||||||
|
# Add project-local fish abbrs here
|
||||||
|
abbrs = {
|
||||||
|
fail = "perl ./scripts/menu.pl";
|
||||||
|
|
||||||
|
# C/C++:
|
||||||
|
# cmake-debug = "${cmakeDebug}";
|
||||||
|
# cmake-release = "${cmakeRelease}";
|
||||||
|
# build-debug = "${buildDebug}";
|
||||||
|
# build-release = "${buildRelease}";
|
||||||
|
};
|
||||||
|
|
||||||
|
eraseAbbr = name: value: "abbr --erase ${name} 2>/dev/null";
|
||||||
|
createAbbr = name: value: ''abbr -a ${name} "${value}"'';
|
||||||
|
|
||||||
|
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets unset
|
||||||
|
unloadProjectShell = pkgs.writers.writeFish "unload-shell.fish" ''
|
||||||
|
echo "Unloading \"${description}\" environment..."
|
||||||
|
|
||||||
|
${builtins.concatStringsSep "\n" (lib.mapAttrsToList eraseAbbr abbrs)}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cmakeDebug = mkCmakeScript "Debug";
|
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets set
|
||||||
cmakeRelease = mkCmakeScript "Release";
|
initProjectShell = pkgs.writers.writeFish "init-shell.fish" ''
|
||||||
|
# Unload just in case, to not have redefinition errors
|
||||||
|
source ${unloadProjectShell}
|
||||||
|
|
||||||
mkBuildScript = type: let
|
echo "Sourcing \"${description}\" environment..."
|
||||||
typeLower = lib.toLower type;
|
|
||||||
in
|
|
||||||
pkgs.writers.writeFish "cmake-build.fish" ''
|
|
||||||
cd $FLAKE_PROJECT_ROOT/cmake-build-${typeLower}
|
|
||||||
|
|
||||||
echo "Running cmake"
|
${builtins.concatStringsSep "\n" (lib.mapAttrsToList createAbbr abbrs)}
|
||||||
cmake --build .
|
|
||||||
'';
|
'';
|
||||||
|
in
|
||||||
|
builtins.concatStringsSep "\n" [
|
||||||
|
# Launch into pure fish shell
|
||||||
|
''
|
||||||
|
# Can't do the "exec" with nix-direnv
|
||||||
|
# - The "exec fish" would call direnv again => Infinite loop
|
||||||
|
# - The shellHook is Bash/POSIX, so fish syntax doesn't work
|
||||||
|
# exec "$(type -p fish)" -C "source ${initProjectShell} && abbr -a menu '${pkgs.bat}/bin/bat "${initProjectShell}"'"
|
||||||
|
|
||||||
buildDebug = mkBuildScript "Debug";
|
# Determine the project root, used e.g. in cmake scripts
|
||||||
buildRelease = mkBuildScript "Release";
|
export FLAKE_PROJECT_ROOT="$(git rev-parse --show-toplevel)"
|
||||||
|
export INIT_PROJECT_SHELL="${initProjectShell}"
|
||||||
|
export UNLOAD_PROJECT_SHELL="${unloadProjectShell}"
|
||||||
|
''
|
||||||
|
];
|
||||||
|
|
||||||
# Add project-local fish abbrs here
|
# ===========================================================================================
|
||||||
abbrs = {
|
# Define custom dependencies
|
||||||
fail = "perl ./scripts/menu.pl";
|
# ===========================================================================================
|
||||||
|
|
||||||
# C/C++:
|
python = pkgs.python314.withPackages (
|
||||||
# cmake-debug = "${cmakeDebug}";
|
p:
|
||||||
# cmake-release = "${cmakeRelease}";
|
with p; [
|
||||||
# build-debug = "${buildDebug}";
|
setuptools
|
||||||
# build-release = "${buildRelease}";
|
flask
|
||||||
|
flask-mysqldb
|
||||||
|
pyyaml
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
# perl = pkgs.perl.withPackages (p:
|
||||||
|
# with p; [
|
||||||
|
# # Those are already installed system-wide
|
||||||
|
# # PLS
|
||||||
|
# # PerlTidy
|
||||||
|
#
|
||||||
|
# NetOpenSSH
|
||||||
|
# ]);
|
||||||
|
|
||||||
|
libpcl = stdenv.mkDerivation rec {
|
||||||
|
pname = "libpcl1";
|
||||||
|
version = "1.12-2";
|
||||||
|
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
url = "http://launchpadlibrarian.net/521269537/${pname}_${version}_amd64.deb";
|
||||||
|
hash = "sha256-GL3mjPAccAtRMAJPnDMCHiDf6xNvGi4oUWylOIqBjP0=";
|
||||||
|
};
|
||||||
|
|
||||||
|
dontBuild = true;
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
dpkg
|
||||||
|
autoPatchelfHook
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out/lib
|
||||||
|
cp -rv usr/lib/x86_64-linux-gnu/* $out/lib/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
eraseAbbr = name: value: ''abbr --erase ${name} 2>/dev/null'';
|
wasi-sdk = stdenv.mkDerivation rec {
|
||||||
createAbbr = name: value: ''abbr -a ${name} "${value}"'';
|
pname = "wasi-sdk";
|
||||||
|
version = "29";
|
||||||
|
|
||||||
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets unset
|
src = let
|
||||||
unloadProjectShell = pkgs.writers.writeFish "unload-shell.fish" ''
|
baseurl = "https://github.com/WebAssembly/wasi-sdk/releases/download";
|
||||||
echo "Unloading \"${description}\" environment..."
|
in
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url = "${baseurl}/${pname}-${version}/${pname}-${version}.0-x86_64-linux.tar.gz";
|
||||||
|
sha256 = "sha256:16afis71iqfvwiny4dz0lk9f7wbary0wa67ybwyhywr8g57ss6hq";
|
||||||
|
};
|
||||||
|
|
||||||
${builtins.concatStringsSep "\n" (lib.mapAttrsToList eraseAbbr abbrs)}
|
nativeBuildInputs = with pkgs; [
|
||||||
'';
|
autoPatchelfHook
|
||||||
|
];
|
||||||
|
|
||||||
# This will be sourced by the global fish config if INIT_PROJECT_SHELL gets set
|
buildInputs = with pkgs; [
|
||||||
initProjectShell = pkgs.writers.writeFish "init-shell.fish" ''
|
libgcc.lib
|
||||||
# Unload just in case, to not have redefinition errors
|
];
|
||||||
source ${unloadProjectShell}
|
|
||||||
|
|
||||||
echo "Sourcing \"${description}\" environment..."
|
dontBuild = true;
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
${builtins.concatStringsSep "\n" (lib.mapAttrsToList createAbbr abbrs)}
|
mkdir -p $out
|
||||||
'';
|
cp -rv ./* $out/
|
||||||
in
|
|
||||||
builtins.concatStringsSep "\n" [
|
|
||||||
# Launch into pure fish shell
|
|
||||||
''
|
|
||||||
# Can't do the "exec" with nix-direnv
|
|
||||||
# - The "exec fish" would call direnv again => Infinite loop
|
|
||||||
# - The shellHook is Bash/POSIX, so fish syntax doesn't work
|
|
||||||
# exec "$(type -p fish)" -C "source ${initProjectShell} && abbr -a menu '${pkgs.bat}/bin/bat "${initProjectShell}"'"
|
|
||||||
|
|
||||||
# Determine the project root, used e.g. in cmake scripts
|
runHook postInstall
|
||||||
export FLAKE_PROJECT_ROOT="$(git rev-parse --show-toplevel)"
|
'';
|
||||||
export INIT_PROJECT_SHELL="${initProjectShell}"
|
|
||||||
export UNLOAD_PROJECT_SHELL="${unloadProjectShell}"
|
|
||||||
''
|
|
||||||
];
|
|
||||||
|
|
||||||
# ===========================================================================================
|
|
||||||
# Define custom dependencies
|
|
||||||
# ===========================================================================================
|
|
||||||
|
|
||||||
python = pkgs.python314.withPackages (p:
|
|
||||||
with p; [
|
|
||||||
setuptools
|
|
||||||
flask
|
|
||||||
flask-mysqldb
|
|
||||||
pyyaml
|
|
||||||
]);
|
|
||||||
|
|
||||||
# perl = pkgs.perl.withPackages (p:
|
|
||||||
# with p; [
|
|
||||||
# # Those are already installed system-wide
|
|
||||||
# # PLS
|
|
||||||
# # PerlTidy
|
|
||||||
#
|
|
||||||
# NetOpenSSH
|
|
||||||
# ]);
|
|
||||||
|
|
||||||
libpcl = stdenv.mkDerivation rec {
|
|
||||||
pname = "libpcl1";
|
|
||||||
version = "1.12-2";
|
|
||||||
|
|
||||||
src = pkgs.fetchurl {
|
|
||||||
url = "http://launchpadlibrarian.net/521269537/${pname}_${version}_amd64.deb";
|
|
||||||
hash = "sha256-GL3mjPAccAtRMAJPnDMCHiDf6xNvGi4oUWylOIqBjP0=";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
dontBuild = true;
|
iwasm = stdenv.mkDerivation rec {
|
||||||
nativeBuildInputs = with pkgs; [
|
pname = "iwasm";
|
||||||
dpkg
|
version = "2.4.4";
|
||||||
autoPatchelfHook
|
|
||||||
];
|
|
||||||
|
|
||||||
installPhase = ''
|
src = let
|
||||||
runHook preInstall
|
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
|
||||||
|
in
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz";
|
||||||
|
sha256 = "sha256:05irihz3yf7hpc0a59qz9i62imhrsni9xy9nxwsn6b8s92c1yzrp";
|
||||||
|
};
|
||||||
|
|
||||||
mkdir -p $out/lib
|
nativeBuildInputs = with pkgs; [
|
||||||
cp -rv usr/lib/x86_64-linux-gnu/* $out/lib/
|
autoPatchelfHook
|
||||||
|
];
|
||||||
|
|
||||||
runHook postInstall
|
buildInputs = with pkgs; [
|
||||||
'';
|
libz
|
||||||
};
|
zstd
|
||||||
|
libgcc.lib
|
||||||
|
];
|
||||||
|
|
||||||
wasi-sdk = stdenv.mkDerivation rec {
|
dontBuild = true;
|
||||||
pname = "wasi-sdk";
|
installPhase = ''
|
||||||
version = "29";
|
runHook preInstall
|
||||||
|
|
||||||
src = let
|
mkdir -p $out/bin
|
||||||
baseurl = "https://github.com/WebAssembly/wasi-sdk/releases/download";
|
cp -rv ./* $out/bin/
|
||||||
in
|
|
||||||
builtins.fetchTarball {
|
|
||||||
url = "${baseurl}/${pname}-${version}/${pname}-${version}.0-x86_64-linux.tar.gz";
|
|
||||||
sha256 = "sha256:16afis71iqfvwiny4dz0lk9f7wbary0wa67ybwyhywr8g57ss6hq";
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
runHook postInstall
|
||||||
autoPatchelfHook
|
'';
|
||||||
];
|
};
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
wamrc = stdenv.mkDerivation rec {
|
||||||
libgcc.lib
|
pname = "wamrc";
|
||||||
];
|
version = "2.4.4";
|
||||||
|
|
||||||
dontBuild = true;
|
src = let
|
||||||
installPhase = ''
|
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
|
||||||
runHook preInstall
|
in
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz";
|
||||||
|
sha256 = "sha256:0264arh03gc35z0zdvw07qdvqgfvsxr3qgl1aszghwicmdmh4sqj";
|
||||||
|
};
|
||||||
|
|
||||||
mkdir -p $out
|
nativeBuildInputs = with pkgs; [
|
||||||
cp -rv ./* $out/
|
autoPatchelfHook
|
||||||
|
];
|
||||||
|
|
||||||
runHook postInstall
|
buildInputs = with pkgs; [
|
||||||
'';
|
libz
|
||||||
};
|
zstd
|
||||||
|
libgcc.lib
|
||||||
|
];
|
||||||
|
|
||||||
iwasm = stdenv.mkDerivation rec {
|
dontBuild = true;
|
||||||
pname = "iwasm";
|
installPhase = ''
|
||||||
version = "2.4.4";
|
runHook preInstall
|
||||||
|
|
||||||
src = let
|
mkdir -p $out/bin
|
||||||
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
|
cp -rv ./* $out/bin/
|
||||||
in
|
|
||||||
builtins.fetchTarball {
|
|
||||||
url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz";
|
|
||||||
sha256 = "sha256:05irihz3yf7hpc0a59qz9i62imhrsni9xy9nxwsn6b8s92c1yzrp";
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
runHook postInstall
|
||||||
autoPatchelfHook
|
'';
|
||||||
];
|
};
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
wamr_src = pkgs.fetchFromGitea {
|
||||||
libz
|
domain = "gitea.local.chriphost.de";
|
||||||
zstd
|
owner = "christoph";
|
||||||
libgcc.lib
|
# domain = "git.cs.tu-dortmund.de";
|
||||||
];
|
# owner = "christoph.urlacher";
|
||||||
|
repo = "wamr";
|
||||||
|
|
||||||
dontBuild = true;
|
# With mmap_space in .text.wamr_mmap
|
||||||
installPhase = ''
|
rev = "f618cfffaf5ac344fa39abcd16c35278cdacee15";
|
||||||
runHook preInstall
|
hash = "sha256-nOLQLIVImPoClGWvmqgMFeC8s5MHLzkTSl/M03eQDaA=";
|
||||||
|
|
||||||
mkdir -p $out/bin
|
# With fail_marker_group1 in wasm_set_exception_local
|
||||||
cp -rv ./* $out/bin/
|
# rev = "177fe78618ce3f74ed497c13ea80e8fbad779e82";
|
||||||
|
# hash = "sha256-H+ubCmL1YkI7kG7pYBs1+vpROm0hy2sryi0MWeQO3Bs=";
|
||||||
|
|
||||||
runHook postInstall
|
# With mmap_space in .text.wamr_aot
|
||||||
'';
|
# rev = "cda2009deb85511089b04b0ac736ad4da2d07e58";
|
||||||
};
|
# hash = "sha256-CN6xTiwzF4Jbrpf21TF5c/C03Xb3urwkibRuIXjoU/w=";
|
||||||
|
|
||||||
wamrc = stdenv.mkDerivation rec {
|
# Without mmap_space in .text.wamr_aot
|
||||||
pname = "wamrc";
|
# rev = "4e7aed33fe53bf3ee4a3f2fe582c74816f850759";
|
||||||
version = "2.4.4";
|
# hash = "sha256-/4BKwoFDRfkA+DmbWagxdtkCDAED5rxbz5e4xvjvVWU=";
|
||||||
|
};
|
||||||
|
|
||||||
src = let
|
wamr = stdenv.mkDerivation {
|
||||||
baseurl = "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download";
|
pname = "wamr";
|
||||||
in
|
|
||||||
builtins.fetchTarball {
|
|
||||||
url = "${baseurl}/WAMR-${version}/${pname}-${version}-x86_64-ubuntu-22.04.tar.gz";
|
|
||||||
sha256 = "sha256:0264arh03gc35z0zdvw07qdvqgfvsxr3qgl1aszghwicmdmh4sqj";
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
autoPatchelfHook
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
libz
|
|
||||||
zstd
|
|
||||||
libgcc.lib
|
|
||||||
];
|
|
||||||
|
|
||||||
dontBuild = true;
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp -rv ./* $out/bin/
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
wamr_src = pkgs.fetchFromGitea {
|
|
||||||
domain = "gitea.local.chriphost.de";
|
|
||||||
owner = "christoph";
|
|
||||||
# domain = "git.cs.tu-dortmund.de";
|
|
||||||
# owner = "christoph.urlacher";
|
|
||||||
repo = "wamr";
|
|
||||||
|
|
||||||
# With fail_marker_group1 in wasm_set_exception_local
|
|
||||||
rev = "177fe78618ce3f74ed497c13ea80e8fbad779e82";
|
|
||||||
hash = "sha256-H+ubCmL1YkI7kG7pYBs1+vpROm0hy2sryi0MWeQO3Bs=";
|
|
||||||
|
|
||||||
# With mmap_space in .text.wamr_aot
|
|
||||||
# rev = "cda2009deb85511089b04b0ac736ad4da2d07e58";
|
|
||||||
# hash = "sha256-CN6xTiwzF4Jbrpf21TF5c/C03Xb3urwkibRuIXjoU/w=";
|
|
||||||
|
|
||||||
# Without mmap_space in .text.wamr_aot
|
|
||||||
# rev = "4e7aed33fe53bf3ee4a3f2fe582c74816f850759";
|
|
||||||
# hash = "sha256-/4BKwoFDRfkA+DmbWagxdtkCDAED5rxbz5e4xvjvVWU=";
|
|
||||||
};
|
|
||||||
|
|
||||||
wamr = stdenv.mkDerivation {
|
|
||||||
pname = "wamr";
|
|
||||||
version = "2.4.4";
|
|
||||||
src = wamr_src;
|
|
||||||
|
|
||||||
dontBuild = true;
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
mkdir -p $out
|
|
||||||
cp -rv ./* $out/
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
mkLibiwasm = {
|
|
||||||
buildenv,
|
|
||||||
platform,
|
|
||||||
buildtype,
|
|
||||||
cflags,
|
|
||||||
extraCmakeFlags ? [],
|
|
||||||
}:
|
|
||||||
buildenv.mkDerivation {
|
|
||||||
pname = "libiwasm";
|
|
||||||
version = "2.4.4";
|
version = "2.4.4";
|
||||||
src = wamr_src;
|
src = wamr_src;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [cmake];
|
dontBuild = true;
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
dontStrip = true;
|
mkdir -p $out
|
||||||
cmakeBuildType = buildtype;
|
cp -rv ./* $out/
|
||||||
cmakeFlags =
|
|
||||||
extraCmakeFlags
|
|
||||||
++ [
|
|
||||||
"-DCMAKE_VERBOSE_MAKEFILE=ON"
|
|
||||||
"-DCMAKE_COLOR_DIAGNOSTICS=ON"
|
|
||||||
|
|
||||||
"-DWAMR_BUILD_PLATFORM=${platform}"
|
runHook postInstall
|
||||||
"-DWAMR_BUILD_TARGET=X86_32"
|
'';
|
||||||
"-DWAMR_BUILD_AOT=1"
|
|
||||||
"-DWAMR_BUILD_WAMR_COMPILER=0"
|
|
||||||
"-DWAMR_BUILD_INTERP=1"
|
|
||||||
"-DWAMR_BUILD_FAST_INTERP=0"
|
|
||||||
"-DWAMR_BUILD_JIT=0"
|
|
||||||
"-DWAMR_BUILD_FAST_JIT=0"
|
|
||||||
"-DWAMR_BUILD_LIBC_BUILTIN=1"
|
|
||||||
"-DWAMR_BUILD_LIBC_WASI=0"
|
|
||||||
"-DWAMR_BUILD_SIMD=0"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Since GCC 15, implicit declarations are an error. Disable this.
|
|
||||||
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration " + cflags;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
libiwasm-baremetal-debug = mkLibiwasm {
|
mkLibiwasm = {
|
||||||
buildenv = i386_pkgs.stdenv;
|
buildenv,
|
||||||
platform = "baremetal";
|
platform,
|
||||||
buildtype = "Debug";
|
buildtype,
|
||||||
cflags = "-O0 -ggdb3";
|
cflags,
|
||||||
extraCmakeFlags = [
|
extraCmakeFlags ? [],
|
||||||
"-DCMAKE_SYSTEM_NAME=Generic"
|
}:
|
||||||
"-DCMAKE_SYSTEM_PROCESSOR=i386"
|
buildenv.mkDerivation {
|
||||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
pname = "libiwasm";
|
||||||
];
|
version = "2.4.4";
|
||||||
};
|
src = wamr_src;
|
||||||
libiwasm-baremetal-release = mkLibiwasm {
|
|
||||||
buildenv = i386_pkgs.stdenv;
|
|
||||||
platform = "baremetal";
|
|
||||||
buildtype = "MinSizeRel";
|
|
||||||
cflags = "-O2 -ggdb3 -DNDEBUG";
|
|
||||||
extraCmakeFlags = [
|
|
||||||
"-DCMAKE_SYSTEM_NAME=Generic"
|
|
||||||
"-DCMAKE_SYSTEM_PROCESSOR=i386"
|
|
||||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
libiwasm-linux-debug = mkLibiwasm {
|
nativeBuildInputs = with pkgs; [cmake];
|
||||||
buildenv = pkgs.multiStdenv;
|
|
||||||
platform = "linux";
|
|
||||||
buildtype = "Debug";
|
|
||||||
cflags = "-O0 -ggdb3";
|
|
||||||
};
|
|
||||||
libiwasm-linux-release = mkLibiwasm {
|
|
||||||
buildenv = pkgs.multiStdenv;
|
|
||||||
platform = "linux";
|
|
||||||
buildtype = "MinSizeRel";
|
|
||||||
cflags = "-O2 -ggdb3 -DNDEBUG";
|
|
||||||
};
|
|
||||||
|
|
||||||
# ===========================================================================================
|
dontStrip = true;
|
||||||
# Specify dependencies
|
cmakeBuildType = buildtype;
|
||||||
# https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview
|
cmakeFlags =
|
||||||
# Just for a "nix develop" shell, buildInputs can be used for everything.
|
extraCmakeFlags
|
||||||
# ===========================================================================================
|
++ [
|
||||||
|
"-DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||||
|
"-DCMAKE_COLOR_DIAGNOSTICS=ON"
|
||||||
|
|
||||||
# Add dependencies to nativeBuildInputs if they are executed during the build:
|
"-DWAMR_BUILD_PLATFORM=${platform}"
|
||||||
# - Those which are needed on $PATH during the build, for example cmake and pkg-config
|
"-DWAMR_BUILD_TARGET=X86_32"
|
||||||
# - Setup hooks, for example makeWrapper/autoPatchelfHook
|
"-DWAMR_BUILD_AOT=1"
|
||||||
# - Interpreters needed by patchShebangs for build scripts (with the --build flag), which can be the case for e.g. perl
|
"-DWAMR_BUILD_WAMR_COMPILER=0"
|
||||||
nativeBuildInputs = with pkgs; [
|
"-DWAMR_BUILD_INTERP=1"
|
||||||
just
|
"-DWAMR_BUILD_FAST_INTERP=0"
|
||||||
gdb
|
"-DWAMR_BUILD_JIT=0"
|
||||||
xxd
|
"-DWAMR_BUILD_FAST_JIT=0"
|
||||||
wabt
|
"-DWAMR_BUILD_LIBC_BUILTIN=1"
|
||||||
grub2
|
"-DWAMR_BUILD_LIBC_WASI=0"
|
||||||
xorriso
|
"-DWAMR_BUILD_SIMD=0"
|
||||||
mariadb.client
|
];
|
||||||
# dbeaver-bin
|
|
||||||
# beekeeper-studio
|
|
||||||
# tableplus
|
|
||||||
lazysql
|
|
||||||
iwasm
|
|
||||||
wamrc
|
|
||||||
fail-bin
|
|
||||||
php
|
|
||||||
|
|
||||||
# perl
|
# Since GCC 15, implicit declarations are an error. Disable this.
|
||||||
|
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration " + cflags;
|
||||||
|
};
|
||||||
|
|
||||||
# Don't install to not pollute our PATH. Just export as environment variable.
|
libiwasm-baremetal-debug = mkLibiwasm {
|
||||||
# wasi-sdk
|
buildenv = i386_pkgs.stdenv;
|
||||||
# libiwasm_debug
|
platform = "baremetal";
|
||||||
# libiwasm_release
|
buildtype = "Debug";
|
||||||
];
|
cflags = "-O0 -ggdb3";
|
||||||
|
extraCmakeFlags = [
|
||||||
|
"-DCMAKE_SYSTEM_NAME=Generic"
|
||||||
|
"-DCMAKE_SYSTEM_PROCESSOR=i386"
|
||||||
|
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
libiwasm-baremetal-release = mkLibiwasm {
|
||||||
|
buildenv = i386_pkgs.stdenv;
|
||||||
|
platform = "baremetal";
|
||||||
|
buildtype = "MinSizeRel";
|
||||||
|
cflags = "-O2 -ggdb3 -DNDEBUG";
|
||||||
|
extraCmakeFlags = [
|
||||||
|
"-DCMAKE_SYSTEM_NAME=Generic"
|
||||||
|
"-DCMAKE_SYSTEM_PROCESSOR=i386"
|
||||||
|
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime:
|
libiwasm-linux-debug = mkLibiwasm {
|
||||||
# - Libraries used by compilers, for example zlib
|
buildenv = pkgs.multiStdenv;
|
||||||
# - Interpreters needed by patchShebangs for scripts which are installed, which can be the case for e.g. perl
|
platform = "linux";
|
||||||
buildInputs = with pkgs; [];
|
buildtype = "Debug";
|
||||||
|
cflags = "-O0 -ggdb3";
|
||||||
|
};
|
||||||
|
libiwasm-linux-release = mkLibiwasm {
|
||||||
|
buildenv = pkgs.multiStdenv;
|
||||||
|
platform = "linux";
|
||||||
|
buildtype = "MinSizeRel";
|
||||||
|
cflags = "-O2 -ggdb3 -DNDEBUG";
|
||||||
|
};
|
||||||
|
|
||||||
# ===========================================================================================
|
# ===========================================================================================
|
||||||
# Define buildable + installable packages
|
# Specify dependencies
|
||||||
# ===========================================================================================
|
# https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-dependencies-overview
|
||||||
|
# Just for a "nix develop" shell, buildInputs can be used for everything.
|
||||||
fail-bin = stdenv.mkDerivation {
|
# ===========================================================================================
|
||||||
pname = "fail";
|
|
||||||
version = "1.0.0";
|
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
|
# Add dependencies to nativeBuildInputs if they are executed during the build:
|
||||||
|
# - Those which are needed on $PATH during the build, for example cmake and pkg-config
|
||||||
|
# - Setup hooks, for example makeWrapper/autoPatchelfHook
|
||||||
|
# - Interpreters needed by patchShebangs for build scripts (with the --build flag), which can be the case for e.g. perl
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
autoPatchelfHook
|
just
|
||||||
|
gdb
|
||||||
|
xxd
|
||||||
|
wabt
|
||||||
|
grub2
|
||||||
|
xorriso
|
||||||
|
mariadb.client
|
||||||
|
# dbeaver-bin
|
||||||
|
# beekeeper-studio
|
||||||
|
# tableplus
|
||||||
|
lazysql
|
||||||
|
iwasm
|
||||||
|
wamrc
|
||||||
|
fail-bin
|
||||||
|
php
|
||||||
|
|
||||||
|
# perl
|
||||||
|
|
||||||
|
# Don't install to not pollute our PATH. Just export as environment variable.
|
||||||
|
# wasi-sdk
|
||||||
|
# libiwasm_debug
|
||||||
|
# libiwasm_release
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
# Add dependencies to buildInputs if they will end up copied or linked into the final output or otherwise used at runtime:
|
||||||
# FAIL runtime dependencies
|
# - Libraries used by compilers, for example zlib
|
||||||
python # bochs-experiment-runner.py, resultbrowser.py
|
# - Interpreters needed by patchShebangs for scripts which are installed, which can be the case for e.g. perl
|
||||||
|
buildInputs = with pkgs; [];
|
||||||
|
|
||||||
# For old VSS FAIL
|
# ===========================================================================================
|
||||||
# alsa-lib # libasound.so.2
|
# Define buildable + installable packages
|
||||||
# boost_pkgs.boost174 # libboost_coroutine.so.1.74.0, libboost_regex.so.1.74.0, libboost_thread.so.1.74.0
|
# ===========================================================================================
|
||||||
# capstone_4 # libcapstone.so.4
|
|
||||||
# libdwarf_pkgs.libdwarf # libdwarf.so.1
|
|
||||||
# elfutils # libelf.so.1
|
|
||||||
# mariadb # libmariadb.so.3
|
|
||||||
# libpcl # libpcl.so.1
|
|
||||||
# protobuf_21 # libprotobuf.so.32
|
|
||||||
# SDL # libSDL-1.2.so.0
|
|
||||||
# libx11 # libX11.so.6
|
|
||||||
# libxrandr # libXrandr.so.2
|
|
||||||
# libz # libz.so.1
|
|
||||||
|
|
||||||
# For current FAIL
|
fail-bin = stdenv.mkDerivation {
|
||||||
boost183
|
pname = "fail";
|
||||||
capstone # libcapstone.so.5
|
version = "1.0.0";
|
||||||
libdwarf_pkgs.libdwarf # libdwarf.so.1
|
src = ./.;
|
||||||
elfutils # libelf.so.1
|
|
||||||
mariadb # libmariadb.so.3
|
|
||||||
protobuf_21 # libprotobuf.so.32
|
|
||||||
libz # libz.so.1
|
|
||||||
];
|
|
||||||
|
|
||||||
installPhase = ''
|
nativeBuildInputs = with pkgs; [
|
||||||
runHook preInstall
|
autoPatchelfHook
|
||||||
|
];
|
||||||
|
|
||||||
mkdir -p $out
|
buildInputs = with pkgs; [
|
||||||
cp -rv ./fail/bin $out/bin
|
# FAIL runtime dependencies
|
||||||
cp -rv ./fail/share $out/share
|
python # bochs-experiment-runner.py, resultbrowser.py
|
||||||
|
|
||||||
runHook postInstall
|
# For old VSS FAIL
|
||||||
'';
|
# alsa-lib # libasound.so.2
|
||||||
};
|
# boost_pkgs.boost174 # libboost_coroutine.so.1.74.0, libboost_regex.so.1.74.0, libboost_thread.so.1.74.0
|
||||||
in {
|
# capstone_4 # libcapstone.so.4
|
||||||
# Provide package for "nix build"
|
# libdwarf_pkgs.libdwarf # libdwarf.so.1
|
||||||
packages = {
|
# elfutils # libelf.so.1
|
||||||
default = fail-bin;
|
# mariadb # libmariadb.so.3
|
||||||
fail = fail-bin;
|
# libpcl # libpcl.so.1
|
||||||
wasi-sdk = wasi-sdk;
|
# protobuf_21 # libprotobuf.so.32
|
||||||
iwasm = iwasm;
|
# SDL # libSDL-1.2.so.0
|
||||||
wamrc = wamrc;
|
# libx11 # libX11.so.6
|
||||||
};
|
# libxrandr # libXrandr.so.2
|
||||||
apps = {
|
# libz # libz.so.1
|
||||||
default = flake-utils.lib.mkApp {drv = fail-bin;};
|
|
||||||
fail = fail-bin;
|
|
||||||
wasi-sdk = wasi-sdk;
|
|
||||||
iwasm = iwasm;
|
|
||||||
wamrc = wamrc;
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells = {
|
# For current FAIL
|
||||||
# Provide default environment for "nix develop".
|
boost183
|
||||||
# Other environments can be added below.
|
capstone # libcapstone.so.5
|
||||||
default = pkgs.mkShell {
|
libdwarf_pkgs.libdwarf # libdwarf.so.1
|
||||||
inherit nativeBuildInputs buildInputs shellHook;
|
elfutils # libelf.so.1
|
||||||
name = description;
|
mariadb # libmariadb.so.3
|
||||||
|
protobuf_21 # libprotobuf.so.32
|
||||||
|
libz # libz.so.1
|
||||||
|
];
|
||||||
|
|
||||||
# =========================================================================================
|
installPhase = ''
|
||||||
# Define environment variables
|
runHook preInstall
|
||||||
# =========================================================================================
|
|
||||||
|
|
||||||
# Dynamic libraries from buildinputs:
|
mkdir -p $out
|
||||||
# LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
cp -rv ./fail/bin $out/bin
|
||||||
|
cp -rv ./fail/share $out/share
|
||||||
|
|
||||||
JUST_WORKING_DIRECTORY = "/home/christoph/Notes/TU/MastersThesis/FailNix";
|
runHook postInstall
|
||||||
JUST_JUSTFILE = "/home/christoph/Notes/TU/MastersThesis/FailNix/scripts/nixos.just";
|
'';
|
||||||
|
|
||||||
# Those are read by the justfile
|
|
||||||
FAIL_SHARE = "${fail-bin}/share";
|
|
||||||
WASI_ROOT = wasi-sdk;
|
|
||||||
WAMR_ROOT = wamr;
|
|
||||||
LIBIWASM_DEBUG = "${libiwasm-baremetal-debug}/lib";
|
|
||||||
LIBIWASM_RELEASE = "${libiwasm-baremetal-release}/lib";
|
|
||||||
LIBIWASM_LINUX_DEBUG = "${libiwasm-linux-debug}/lib";
|
|
||||||
LIBIWASM_LINUX_RELEASE = "${libiwasm-linux-release}/lib";
|
|
||||||
CROSS_CC = "${i386_pkgs.stdenv.cc}/bin/i386-elf-gcc";
|
|
||||||
CROSS_CXX = "${i386_pkgs.stdenv.cc}/bin/i386-elf-g++";
|
|
||||||
LINUX_CC = "${pkgs.multiStdenv.cc}/bin/gcc";
|
|
||||||
LINUX_CXX = "${pkgs.multiStdenv.cc}/bin/g++";
|
|
||||||
};
|
};
|
||||||
};
|
in {
|
||||||
});
|
# Provide package for "nix build"
|
||||||
|
packages = {
|
||||||
|
default = fail-bin;
|
||||||
|
fail = fail-bin;
|
||||||
|
wasi-sdk = wasi-sdk;
|
||||||
|
iwasm = iwasm;
|
||||||
|
wamrc = wamrc;
|
||||||
|
};
|
||||||
|
apps = {
|
||||||
|
default = flake-utils.lib.mkApp {drv = fail-bin;};
|
||||||
|
fail = fail-bin;
|
||||||
|
wasi-sdk = wasi-sdk;
|
||||||
|
iwasm = iwasm;
|
||||||
|
wamrc = wamrc;
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells = {
|
||||||
|
# Provide default environment for "nix develop".
|
||||||
|
# Other environments can be added below.
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
inherit nativeBuildInputs buildInputs shellHook;
|
||||||
|
name = description;
|
||||||
|
|
||||||
|
# =========================================================================================
|
||||||
|
# Define environment variables
|
||||||
|
# =========================================================================================
|
||||||
|
|
||||||
|
# Dynamic libraries from buildinputs:
|
||||||
|
# LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
||||||
|
|
||||||
|
JUST_WORKING_DIRECTORY = "/home/christoph/Notes/TU/MastersThesis/FailNix";
|
||||||
|
JUST_JUSTFILE = "/home/christoph/Notes/TU/MastersThesis/FailNix/scripts/nixos.just";
|
||||||
|
|
||||||
|
# Those are read by the justfile
|
||||||
|
FAIL_SHARE = "${fail-bin}/share";
|
||||||
|
WASI_ROOT = wasi-sdk;
|
||||||
|
WAMR_ROOT = wamr;
|
||||||
|
LIBIWASM_DEBUG = "${libiwasm-baremetal-debug}/lib";
|
||||||
|
LIBIWASM_RELEASE = "${libiwasm-baremetal-release}/lib";
|
||||||
|
LIBIWASM_LINUX_DEBUG = "${libiwasm-linux-debug}/lib";
|
||||||
|
LIBIWASM_LINUX_RELEASE = "${libiwasm-linux-release}/lib";
|
||||||
|
CROSS_CC = "${i386_pkgs.stdenv.cc}/bin/i386-elf-gcc";
|
||||||
|
CROSS_CXX = "${i386_pkgs.stdenv.cc}/bin/i386-elf-g++";
|
||||||
|
LINUX_CC = "${pkgs.multiStdenv.cc}/bin/gcc";
|
||||||
|
LINUX_CXX = "${pkgs.multiStdenv.cc}/bin/g++";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,12 @@ SECTIONS {
|
|||||||
/* . += 16; /\* padding after data, workaround for import-trace *\/ */
|
/* . += 16; /\* padding after data, workaround for import-trace *\/ */
|
||||||
|
|
||||||
KEEP (*(".text.startup"))
|
KEEP (*(".text.startup"))
|
||||||
|
*(".text.wamr_aot")
|
||||||
*(".text*")
|
*(".text*")
|
||||||
|
. = ALIGN(4096);
|
||||||
|
_wamr_mmap_start = .;
|
||||||
|
*(".text.wamr_mmap")
|
||||||
|
_wamr_mmap_end = .;
|
||||||
*(".rodata*")
|
*(".rodata*")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user