emsdk compilation. what flags do i needfor sucsess?

251 views Asked by At

Here are my compiler logs I don't quite understand what to do

$ emmake make CFLAGS="-fstack-protector-strong" LDFLAGS="-fstack-protector-strong"

make: make CFLAGS=-fstack-protector-strong LDFLAGS=-fstack-protector-strong

emcc -fstack-protector-strong -fstack-protector-strong -o mkp224o.tmp main.c.o worker.c.o yaml.c.o vec.c.o cpucount.c.o base32_to.c.o base32_from.c.o base64_to.c.o base64_from.c.o ioutil.c.o keccak.c.o -lpthread -lsodium && mv mkp224o.tmp mkp224o

wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard

emcc: error: '/usr/bin/wasm-ld-13 -o mkp224o.wasm main.c.o worker.c.o yaml.c.o vec.c.o cpucount.c.o base32_to.c.o base32_from.c.o base64_to.c.o base64_from.c.o ioutil.c.o keccak.c.o /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a -L/usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__stdio_exit --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export=malloc --export=free --export=emscripten_main_thread_process_queued_calls --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (returned 1) make: *** [GNUmakefile:99: mkp224o] Error 1 emmake: error: 'make CFLAGS=-fstack-protector-strong LDFLAGS=-fstack-protector-strong' failed (returned 2)

1

There are 1 answers

0
Ryufuz On

The problem is solved, but I did not track at what step it was done, since I walked in circles many times.

From the moment it didn't work for me, I did:

-installed bison and gawk

sudo apt install bison gawk

-copied the "c++" folder from the Include folder to the /usr/share/emscripten/cache/sysroot/include directory.

  • switched to providing python, with the commands:

    python3 '/usr/share/emscripten/emconfigure.py' ./configure --prefix="$(pwd)/install"

    python3 '/usr/share/emscripten/emmake.py' make clean

    python3 '/usr/share/emscripten/emmake.py' make

  • when code errors occur, set

    sudo apt install python3-pysodium

  • after I solved a couple of compilation errors (from a very long list of errors) and corrected by type in terminal:

    emcc -Wall -Wno-error -Wextra -Wno-unused-function -Wmissing-prototypes -Wstrict-prototypes -x c++ -g -O2 -lm -ldl -Wall -Wpointer-arith -finline-functions -ffast-math -DED25519_donna -fPIE -DSTATISTICS -DPASSPHRASE -DVERSION='"unknown"' -D'CRYPTO_NAMESPACETOP=crypto_sign_ed25519_donna' -D'_CRYPTO_NAMESPACETOP=crypto_sign_ed25519_donna' -D'CRYPTO_NAMESPACE(name)=crypto_sign_ed25519_donna##name' -D'_CRYPTO_NAMESPACE(name)=crypto_sign_ed25519_donna ##name' -c -o main.c.o.tmp main.c && mv main.c.o.tmp main.c.o

and then finished compiling

 python3 '/usr/share/emscripten/emmake.py' make