From 6fb7f1559ffea895b330375074747027a82a8734 Mon Sep 17 00:00:00 2001 From: pmp-p Date: Tue, 3 Dec 2024 14:07:42 +0100 Subject: [PATCH] 24.0.5 --- config | 3 ++- lang/rustsdk.sh | 5 ++++- scripts/cpython-build-host.sh | 13 ++++++------- scripts/cpython-build-wasisdk.sh | 5 ++++- scripts/cpython-fetch.sh | 25 +++++++++++++++---------- support/__EMSCRIPTEN__.sh | 4 ++-- support/hostpic.diff | 13 +++++++++++++ 7 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 support/hostpic.diff diff --git a/config b/config index 0e643a0..dc8b257 100644 --- a/config +++ b/config @@ -60,7 +60,8 @@ EXTRABINS="/usr/local/bin /opt/bin" # stable==latest dev==tot export EMFLAVOUR=${EMFLAVOUR:latest} export EMSDK_QUIET=1 - +export EMSDK_NOTTY=0 +export EMSDK_VERBOSE=0 #temp fix for oom on CI (Error: Process completed with exit code 143.) export EMSDK_NUM_CORES=1 diff --git a/lang/rustsdk.sh b/lang/rustsdk.sh index a45b208..90f1996 100755 --- a/lang/rustsdk.sh +++ b/lang/rustsdk.sh @@ -1,4 +1,4 @@ -#!/bin/bash +*#!/bin/bash export SDKROOT=${SDKROOT:-/tmp/sdk} @@ -17,4 +17,7 @@ rustup target add wasm32-unknown-unknown rustup target add wasm32-unknown-emscripten rustup target add wasm32-wasip1 +# error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35` +# LLVM_CONFIG_PATH=${SDKROOT}/wasisdk/upstream/bin/llvm-config cargo install c2rust + diff --git a/scripts/cpython-build-host.sh b/scripts/cpython-build-host.sh index c6c60bb..6712365 100755 --- a/scripts/cpython-build-host.sh +++ b/scripts/cpython-build-host.sh @@ -54,7 +54,6 @@ then unset CPPFLAGS unset LDFLAGS -#export OPT="$CPOPTS -DNDEBUG -fwrapv" mkdir -p $ROOT/src/cpython${PYBUILD}/Tools/wasm cat > $ROOT/src/cpython${PYBUILD}/Tools/wasm/config.host-wasm32-emscripten <&2 else echo "CPython $PYTHON_FOR_BUILD failed to install" 1>&2 - exit 117 + exit 114 fi else echo " @@ -121,7 +120,7 @@ failed to build $PYTHON_FOR_BUILD CC=clang CXX=clang++ $CNF " 1>&2 - exit 125 + exit 122 fi else echo " @@ -134,7 +133,7 @@ CC=clang CXX=clang++ $CNF ========================================================================== " 1>&2 - exit 149 + exit 135 fi popd diff --git a/scripts/cpython-build-wasisdk.sh b/scripts/cpython-build-wasisdk.sh index b77b4a0..f14688d 100755 --- a/scripts/cpython-build-wasisdk.sh +++ b/scripts/cpython-build-wasisdk.sh @@ -92,6 +92,9 @@ END fi popd +# now libmpdec.a is correctly linked in libpython. +if false +then pushd ${SDKROOT}/wasisdk if [ -f libpython${PYBUILD}.a ] then @@ -113,7 +116,7 @@ END wasi-c -nostdlib -fpic -r -Wl,--whole-archive -o libpython${PYBUILD}.o $LINKALL llvm-ar rcs ${PREFIX}/lib/libpython${PYBUILD}.a libpython${PYBUILD}.o popd - +fi else echo cannot find PYTHON_FOR_BUILD=$PYTHON_FOR_BUILD diff --git a/scripts/cpython-fetch.sh b/scripts/cpython-fetch.sh index 555ff25..9ed047e 100755 --- a/scripts/cpython-fetch.sh +++ b/scripts/cpython-fetch.sh @@ -8,7 +8,7 @@ echo " mkdir -p src -pushd src 2>&1 >/dev/null +pushd src NOPATCH=false PYPATCH=true @@ -22,7 +22,7 @@ if echo $PYBUILD |grep -q 15$ then if [ -d cpython${PYBUILD} ] then - pushd cpython${PYBUILD} 2>&1 >/dev/null + pushd cpython${PYBUILD} # put the tree back to original state so we can pull # Programs/python.c Modules/readline.c git restore . @@ -44,9 +44,9 @@ fi if echo $PYBUILD |grep -q 14$ then - wget -c https://www.python.org/ftp/python/3.14.0/Python-3.14.0a1.tar.xz - tar xf Python-3.14.0a1.tar.xz - ln -s Python-3.14.0a1 cpython${PYBUILD} + wget -c https://www.python.org/ftp/python/3.14.0/Python-3.14.0a2.tar.xz + tar xf Python-3.14.0a2.tar.xz + ln -s Python-3.14.0a2 cpython${PYBUILD} mkdir $ROOT/devices/emsdk/usr/lib $ROOT/devices/$(arch)/usr/lib -p @@ -133,9 +133,9 @@ popd # 3.10 is not wasm stable if [ -f support/__EMSCRIPTEN__.patches/${PYBUILD}-host.diff ] then - pushd src/cpython${PYBUILD} 2>&1 >/dev/null + pushd src/cpython${PYBUILD} patch -p1 < ../../support/__EMSCRIPTEN__.patches/${PYBUILD}-host.diff - popd 2>&1 >/dev/null + popd fi @@ -147,10 +147,15 @@ if $NOPATCH then echo "finally there" else - # do some patching for 3.11+ to allow more shared libs - pushd src/cpython${PYBUILD} 2>&1 >/dev/null + pushd src/cpython${PYBUILD} + + # do some patching for 3.11+ to allow shared libs and move js to pymain patch -p1 < ../../support/__EMSCRIPTEN__.embed/cpython${PYBUILD}.diff - popd 2>&1 >/dev/null + + # patch host to be PIC + patch -p1 < ../../support/hostpic.diff + + popd fi echo " diff --git a/support/__EMSCRIPTEN__.sh b/support/__EMSCRIPTEN__.sh index 84aaad8..6a15911 100755 --- a/support/__EMSCRIPTEN__.sh +++ b/support/__EMSCRIPTEN__.sh @@ -40,7 +40,7 @@ END #include "Python.h" -#if __PYDK__ +#if defined(__PYGBAG__) #include "pycore_call.h" // _PyObject_CallNoArgs() #include "pycore_initconfig.h" // _PyArgv #include "pycore_interp.h" // _PyInterpreterState.sysdict @@ -108,7 +108,7 @@ main(int argc, char **argv) return Py_BytesMain(argc, argv); } -#endif //#if __PYDK__ +#endif // __PYGBAG__ END popd diff --git a/support/hostpic.diff b/support/hostpic.diff new file mode 100644 index 0000000..076a6ef --- /dev/null +++ b/support/hostpic.diff @@ -0,0 +1,13 @@ +--- cpython3.13/Makefile.pre.in 2024-12-03 07:51:52.083841661 +0100 ++++ cpython3.13-pic/Makefile.pre.in 2024-12-03 07:54:00.742976111 +0100 +@@ -34,8 +34,8 @@ + abs_builddir= @abs_builddir@ + + +-CC= @CC@ +-CXX= @CXX@ ++CC=@CC@ -fPIC ++CXX=@CXX@ -fPIC + LINKCC= @LINKCC@ + AR= @AR@ + READELF= @READELF@