Add patch that prevents expat in Poco from causing trouble with WASM
As we build a single statically linked bunary for WASM, we will end up with just one copy of each function in it. Both LO core and Poco include expat. Upstream Poco builds one of the expat source files as C++. That causes trouble as it then isn't compatible with what LO core wants to call. Or something like that. You get "RuntimeError: null function or function signature mismatch". (The "signature" concept in WASM is orthogonal to C++ name mangling.) Signed-off-by: Tor Lillqvist <tml@collabora.com> Change-Id: Iacf75ed34eea98611cb6aa6867e460697ea1fc4apull/5718/head
parent
f8819137c5
commit
d9024e8955
|
@ -54,8 +54,8 @@ Then build libzstd:
|
|||
podman run -v /data/lo/zstd-1.5.2:/data/lo/zstd-1.5.2:rw --security-opt=label=disable -ti public.ecr.aws/allotropia/libo-builders/wasm /bin/bash -c 'source /home/builder/emsdk/emsdk_env.sh && cd /data/lo/zstd-1.5.2/ && emmake make -j8 lib-nomt ZSTD_NO_ASM=1'
|
||||
|
||||
Then build POCO:
|
||||
* this requires a patch (currently exists patch for 1.12.4 and untested "devel"
|
||||
branch)
|
||||
* this requires two patches (currently exists patch for 1.12.4 and untested "devel"
|
||||
branch) plus renaming one source file (which actually is from expat but Poco includes)
|
||||
* note that the header Poco/Platform.h maps EMSCRIPTEN to POCO_OS_LINUX
|
||||
* it has both Makefiles and CMake but i couldn't get CMake to use CXXFLAGS to
|
||||
disable some Linux-specific code; i tried variations on:
|
||||
|
@ -65,6 +65,8 @@ Then build POCO:
|
|||
tar -xjvf ~/Downloads/poco-1.12.4-all.tar.bz2
|
||||
cd poco-1.12.4-all
|
||||
patch -p1 < $HOME/lo/online/wasm/poco-1.12.4-emscripten.patch
|
||||
mv XML/src/xmlparse.cpp XML/src/xmlparse.c
|
||||
patch < $HOME/lo/online/wasm/poco-no-special-expat-sauce.diff
|
||||
podman run -v /data/lo/poco-1.12.4-all:/data/lo/poco-1.12.4-all:rw --security-opt=label=disable -ti public.ecr.aws/allotropia/libo-builders/wasm /bin/bash -c 'source /home/builder/emsdk/emsdk_env.sh && cd /data/lo/poco-1.12.4-all && emconfigure ./configure --static --no-samples --no-tests --omit=Crypto,NetSSL_OpenSSL,JWT,Data,Data/SQLite,Data/ODBC,Data/MySQL,Data/PostgreSQL,Zip,PageCompiler,PageCompiler/File2Page,MongoDB,Redis,ActiveRecord,ActiveRecord/Compiler,Prometheus && emmake make -j8 CC=/home/builder/emsdk/upstream/emscripten/emcc CXX=/home/builder/emsdk/upstream/emscripten/em++ LD=/home/builder/emsdk/upstream/emscripten/em++ CXXFLAGS="-DPOCO_NO_LINUX_IF_PACKET_H -pthread -s USE_PTHREADS=1 -s DISABLE_EXCEPTION_CATCHING=0" && make -j8 install INSTALLDIR=/data/lo/poco-1.12.4-all/install'
|
||||
|
||||
== Build Online with manually built dependencies ==
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
--- /tmp/poco-poco-1.12.4-release/XML/src/xmlparse.cpp 2022-10-31 19:41:19.000000000 +0200
|
||||
+++ XML/src/xmlparse.c 2022-12-14 12:50:31.845361409 +0200
|
||||
@@ -84,10 +84,7 @@
|
||||
|
||||
#define EXPAT_POCO 1
|
||||
|
||||
-#if defined(EXPAT_POCO)
|
||||
-# include "Poco/RandomStream.h"
|
||||
-# include "Poco/BinaryReader.h"
|
||||
-#elif defined(_WIN32)
|
||||
+#ifdef _WIN32
|
||||
# define getpid GetCurrentProcessId
|
||||
#else
|
||||
# include <sys/time.h> /* gettimeofday() */
|
||||
@@ -746,8 +743,6 @@
|
||||
'\0'};
|
||||
|
||||
|
||||
-#if ! defined(EXPAT_POCO)
|
||||
-
|
||||
/* To avoid warnings about unused functions: */
|
||||
#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
|
||||
|
||||
@@ -901,8 +896,6 @@
|
||||
|
||||
#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */
|
||||
|
||||
-#endif /* ! defined(EXPAT_POCO) */
|
||||
-
|
||||
static unsigned long
|
||||
ENTROPY_DEBUG(const char *label, unsigned long entropy) {
|
||||
if (getDebugLevel("EXPAT_ENTROPY_DEBUG", 0) >= 1u) {
|
||||
@@ -916,12 +909,7 @@
|
||||
generate_hash_secret_salt(XML_Parser parser) {
|
||||
unsigned long entropy;
|
||||
(void)parser;
|
||||
-#if defined(EXPAT_POCO)
|
||||
- Poco::RandomInputStream rstr;
|
||||
- Poco::BinaryReader rrdr(rstr);
|
||||
- rrdr >> entropy;
|
||||
- return ENTROPY_DEBUG("RandomInputStream", entropy);
|
||||
-#else
|
||||
+
|
||||
/* "Failproof" high quality providers: */
|
||||
#if defined(HAVE_ARC4RANDOM_BUF)
|
||||
arc4random_buf(&entropy, sizeof(entropy));
|
||||
@@ -958,7 +946,6 @@
|
||||
entropy * (unsigned long)2305843009213693951ULL);
|
||||
}
|
||||
#endif
|
||||
-#endif /* defined(EXPAT_POCO) */
|
||||
}
|
||||
|
||||
static unsigned long
|
Loading…
Reference in New Issue