Skip to content

Commit

Permalink
fix wasmtime to 17.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Feb 9, 2024
1 parent 8736fbb commit 442cce6
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 67 deletions.
111 changes: 56 additions & 55 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ else
fi
fi

# base wasm features pure is "mvp" , "bi" is bigint

if [ -f /mvp ]
then
export WASM_FLAVOUR=mvp
export WASM_EXTRA="-sMIN_SAFARI_VERSION=120000"
export WASM_PURE=true
else
export WASM_FLAVOUR=bi

# extra features. Safari 14 is expected to have BIGINT, ignore the emsdk warnings.
export WASM_EXTRA="-sWASM_BIGINT -sMIN_SAFARI_VERSION=140100"

# tell to not normalize modules.
export WASM_PURE=false
fi



# ============ emscripten ==============

# stable
Expand All @@ -54,6 +73,12 @@ fi
#export EMFLAVOUR=${EMFLAVOUR:latest}
export EMFLAVOUR=${EMFLAVOUR:-tot}

#temp fix for oom on CI (Error: Process completed with exit code 143.)
export EMSDK_NUM_CORES=1

# for shared modules
export PYDK_PYTHON_HOST_PLATFORM=wasm32-${WASM_FLAVOUR}-emscripten

# ============== wasi sdk ===============

# stable
Expand All @@ -76,64 +101,40 @@ NIM_URL=https://github.com/nim-lang/Nim
NIMSDK=${NIMSDK:-"${SDKROOT}/nimsdk"}


# base wasm features pure is "mvp" , "bi" is bigint

if [ -f /mvp ]
then
export WASM_FLAVOUR=mvp
export WASM_EXTRA="-sMIN_SAFARI_VERSION=120000"
export WASM_PURE=true
else
export WASM_FLAVOUR=bi

# extra features. Safari 14 is expected to have BIGINT, ignore the emsdk warnings.
export WASM_EXTRA="-sWASM_BIGINT -sMIN_SAFARI_VERSION=140100"

# tell to not normalize modules.
export WASM_PURE=false
fi
#OLDPATH=${PATH}

#temp fix for oom on CI (Error: Process completed with exit code 143.)
export EMSDK_NUM_CORES=1
PATH=/usr/bin:/bin
for extrabin in /usr/local/bin /opt/bin
do
if echo $PATH|grep -q ":$extrabin"
then
continue
fi

export PYDK_PYTHON_HOST_PLATFORM=wasm32-${WASM_FLAVOUR}-emscripten
if [ -d $extrabin ]
then
PATH=$extrabin:$PATH
fi
done


# this is python used for emsdk : ${SYS_PYTHON} -> ${EMSDK_PYTHON}
for py in 10 9 8 7
do
if command -v python${PYMAJOR}.${py} >/dev/null
then
export SYS_PYTHON=$(command -v python${PYMAJOR}.${py})
break
else
# sane default
export SYS_PYTHON=$(command -v python${PYMAJOR})
fi
done

export GITGET="git clone --recursive --no-tags --depth 1 --single-branch --branch"
export LD_LIBRARY_PATH="${HOST_PREFIX}/lib:$LD_LIBRARY_PATH"
export PATH="${HOST_PREFIX}/bin:$PATH"

if echo $LD_LIBRARY_PATH |grep -q ${HOST_PREFIX}/lib
then
# config already set
echo -n
else
OLDPATH=${PATH}

PATH=/usr/bin:/bin
for extrabin in /usr/local/bin /opt/bin
do
if echo $PATH|grep -q ":$extrabin"
then
continue
fi

if [ -d $extrabin ]
then
PATH=$extrabin:$PATH
fi
done


# this is python used for emsdk : ${SYS_PYTHON} -> ${EMSDK_PYTHON}
for py in 10 9 8 7
do
if command -v python${PYMAJOR}.${py} >/dev/null
then
export SYS_PYTHON=$(command -v python${PYMAJOR}.${py})
break
else
# sane default
export SYS_PYTHON=$(command -v python${PYMAJOR})
fi
done

export GITGET="git clone --recursive --no-tags --depth 1 --single-branch --branch"
export LD_LIBRARY_PATH="${HOST_PREFIX}/lib:$LD_LIBRARY_PATH"
export PATH="${HOST_PREFIX}/bin:$PATH:$OLDPATH"
fi
19 changes: 10 additions & 9 deletions python-nim-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pushd ${NIMSDK}
pushd $NIM_VERSION
chmod +x *sh
CC=clang CXX=clang++ ./build_all.sh
rm -rf build csources_v2 nimcache
popd
fi
fi
Expand All @@ -62,13 +63,15 @@ echo fmt" ==== Panda3D: generic config {ARCH=} from {SDKROOT=} ===="
--cc:clang
--os:linux
--define:usemalloc
--noCppExceptions
--define:noCppExceptions
#--noCppExceptions
--exceptions:quirky
--define:noCppExceptions
#--define:usemalloc
# gc : bohem => need libgc.so.1
--gc:orc
--mm:orc
--define:noSignalHandler
#
Expand Down Expand Up @@ -99,7 +102,7 @@ when defined(wasi):
switch("passC", fmt"-m32 -Djmp_buf=int")
switch("passC", "-Os -g3 -mllvm -inline-threshold=1")
switch("passC", "-O0 -g3 -mllvm -inline-threshold=1")
switch("passL","-lstdc++ ")
Expand Down Expand Up @@ -138,8 +141,6 @@ switch("cincludes", fmt"{SDKROOT}/devices/{ARCH}/usr/include/panda3d")
switch("out", fmt"out.{ARCH}")
END

cat > nimsdk_env.sh <<END
Expand All @@ -151,7 +152,7 @@ then
. $WASISDK/wasisdk_env.sh
export XDG_CONFIG_HOME=${NIMSDK}
export NIMBLE_DIR=${NIMSDK}/pkg
export PATH=${NIMSDK}/${NIM_VERSION}/bin:$PATH
export PATH=${NIMSDK}/${NIM_VERSION}/bin:\${WASI_SDK_PREFIX}/bin:$PATH
echo "
* using nimsdk from \$(realpath \${NIMSDK}/\${NIM_VERSION}/bin)
Expand All @@ -164,7 +165,7 @@ then
SDKROOT=$SDKROOT
NIMSDK=$NIMSDK
NIMBLE_DIR=\$NIMBLE_DIR
PATH=$PATH
PATH=\$PATH
clang=\$(which clang)
clang++=\$(which clang++)
Expand Down
15 changes: 12 additions & 3 deletions python-wasi-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,18 @@ END

CPU=wasm32 TARGET=wasi \
PYDK_PYTHON_HOST_PLATFORM=wasm32-wasi \
PREFIX=/opt/python-wasm-sdk/devices/wasi/usr \
PREFIX=/opt/python-wasm-sdk/devices/wasisdk/usr \
./scripts/make-shells.sh

cat >> $ROOT/wasm32-wasi-shell.sh <<END
#!/bin/bash
. ${SDKROOT}/wasisdk/wasisdk_env.sh
. ${WASISDK}/wasisdk_env.sh
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="[PyDK:wasi] \[\e[32m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]\$ "
export PS1="[PyDK:wasisdk] \w $ "
END

Expand All @@ -202,5 +206,10 @@ END
fi
done


wget https://github.com/bytecodealliance/wasmtime/releases/download/v17.0.1/wasmtime-v17.0.1-x86_64-linux.tar.xz -O- xzcat | tar xfv -
mv -vf $(find wasmtime*|grep /wasmtime$) ${WASISDK}/bin/


exit 0

0 comments on commit 442cce6

Please sign in to comment.