Hi, On Mon, Oct 07, 2024 at 10:37:25AM +0200, Santiago Vila wrote: [..snip..] > emcc: error: --memory-init-file is no longer supported > emcc: error: --memory-init-file is no longer supported
The attached patch fixes this but we then fail with EMCC_CLOSURE_ARGS="--externs /build/olm-3.2.16+dfsg/javascript/externs.js" emcc -O3 -s NO_FILESYSTEM=1 -s INVOKE_RUN=0 -s MODULARIZE=1 -Wno-error=closure \ -s WASM=0 \ --pre-js javascript/olm_pre.js \ --post-js javascript/olm_outbound_group_session.js --post-js javascript/olm_inbound_group_session.js --post-js javascript/olm_pk.js --post-js javascript/olm_sas.js --post-js javascript/olm_post.js \ --extern-pre-js javascript/olm_prefix.js \ --extern-post-js javascript/olm_suffix.js \ -s "EXPORTED_FUNCTIONS=@javascript/exported_functions.json" \ -s "EXPORTED_RUNTIME_METHODS=[ALLOC_STACK,writeAsciiToMemory,intArrayFromString,UTF8ToString,stringToUTF8]" \ -o javascript/olm_legacy.js build/javascript/src/account.o build/javascript/src/base64.o build/javascript/src/cipher.o build/javascript/src/crypto.o build/javascript/src/memory.o build/javascript/src/message.o build/javascript/src/olm.o build/javascript/src/pickle.o build/javascript/src/pk.o build/javascript/src/ratchet.o build/javascript/src/session.o build/javascript/src/utility.o build/javascript/src/ed25519.o build/javascript/src/error.o build/javascript/src/inbound_group_session.o build/javascript/src/megolm.o build/javascript/src/outbound_group_session.o build/javascript/src/pickle_encoding.o build/javascript/src/sas.o build/javascript/lib/crypto-algorithms/sha256.o build/javascript/lib/crypto-algorithms/aes.o build/javascript/lib/curve25519-donna/curve25519-donna.o emcc: warning: LLVM version for clang executable "/usr/bin/clang-18" appears incorrect (seeing "18.1", expected "20") [-Wversion-check] emcc: warning: LLVM version for clang executable "/usr/bin/clang-18" appears incorrect (seeing "18.1", expected "20") [-Wversion-check] wasm-ld-18: error: unknown argument: --no-growable-memory emcc: error: '/usr/bin/wasm-ld-18 @/tmp/emscripten__e_p5v1b.rsp.utf-8' failed (returned 1) make[2]: *** [Makefile:237: javascript/olm_legacy.js] Error 1 make[2]: *** Waiting for unfinished jobs.... { "declares": [ "_emscripten_memcpy_js", "emscripten_resize_heap" ], "globalImports": [ ], "exports": [ "__wasm_call_ctors", "olm_get_library_version", "olm_error", "olm_account_last_error", "_olm_error_to_string", "olm_account_last_error_code", "olm_session_last_error", "olm_session_last_error_code", "olm_utility_last_error", "olm_utility_last_error_code", "olm_account_size", "olm_session_size", "olm_utility_size", "olm_account", "olm_session", "olm_utility", "olm_clear_account", "olm_clear_session", "olm_clear_utility", "olm_pickle_account_length", "olm_pickle_session_length", "olm_pickle_account", "olm_pickle_session", "olm_unpickle_account", "olm_unpickle_session", "olm_create_account_random_length", "olm_create_account", "olm_account_identity_keys_length", "olm_account_identity_keys", "olm_account_signature_length", "olm_account_sign", "olm_account_one_time_keys_length", "olm_account_one_time_keys", "olm_account_mark_keys_as_published", "olm_account_max_number_of_one_time_keys", "olm_account_generate_one_time_keys_random_length", "olm_account_generate_one_time_keys", "olm_account_generate_fallback_key_random_length", "olm_account_generate_fallback_key", "olm_account_fallback_key_length", "olm_account_fallback_key", "olm_account_unpublished_fallback_key_length", "olm_account_unpublished_fallback_key", "olm_account_forget_old_fallback_key", "olm_create_outbound_session_random_length", "olm_create_outbound_session", "olm_create_inbound_session", "olm_create_inbound_session_from", "olm_session_id_length", "olm_session_id", "olm_session_has_received_message", "olm_session_describe", "olm_matches_inbound_session", "olm_matches_inbound_session_from", "olm_remove_one_time_keys", "olm_encrypt_message_type", "olm_encrypt_random_length", "olm_encrypt_message_length", "olm_encrypt", "olm_decrypt_max_plaintext_length", "olm_decrypt", "olm_sha256_length", "olm_sha256", "olm_ed25519_verify", "olm_pk_encryption_last_error", "olm_pk_encryption_last_error_code", "olm_pk_encryption_size", "olm_pk_encryption", "olm_clear_pk_encryption", "olm_pk_encryption_set_recipient_key", "olm_pk_key_length", "olm_pk_ciphertext_length", "olm_pk_mac_length", "olm_pk_encrypt_random_length", "olm_pk_encrypt", "olm_pk_decryption_last_error", "olm_pk_decryption_last_error_code", "olm_pk_decryption_size", "olm_pk_decryption", "olm_clear_pk_decryption", "olm_pk_private_key_length", "olm_pk_generate_key_random_length", "olm_pk_key_from_private", "olm_pk_generate_key", "olm_pickle_pk_decryption_length", "olm_pickle_pk_decryption", "olm_unpickle_pk_decryption", "olm_pk_max_plaintext_length", "olm_pk_decrypt", "olm_pk_get_private_key", "olm_pk_signing_size", "olm_pk_signing", "olm_pk_signing_last_error", "olm_pk_signing_last_error_code", "olm_clear_pk_signing", "olm_pk_signing_seed_length", "olm_pk_signing_public_key_length", "olm_pk_signing_key_from_seed", "olm_pk_signature_length", "olm_pk_sign", "olm_inbound_group_session_size", "olm_inbound_group_session", "olm_clear_inbound_group_session", "olm_inbound_group_session_last_error", "olm_inbound_group_session_last_error_code", "olm_init_inbound_group_session", "olm_import_inbound_group_session", "olm_pickle_inbound_group_session_length", "olm_pickle_inbound_group_session", "olm_unpickle_inbound_group_session", "olm_group_decrypt_max_plaintext_length", "olm_group_decrypt", "olm_inbound_group_session_id_length", "olm_inbound_group_session_id", "olm_inbound_group_session_first_known_index", "olm_inbound_group_session_is_verified", "olm_export_inbound_group_session_length", "olm_export_inbound_group_session", "olm_outbound_group_session_size", "olm_outbound_group_session", "olm_clear_outbound_group_session", "olm_outbound_group_session_last_error", "olm_outbound_group_session_last_error_code", "olm_pickle_outbound_group_session_length", "olm_pickle_outbound_group_session", "olm_unpickle_outbound_group_session", "olm_init_outbound_group_session_random_length", "olm_init_outbound_group_session", "olm_group_encrypt_message_length", "olm_group_encrypt", "olm_outbound_group_session_id_length", "olm_outbound_group_session_id", "olm_outbound_group_session_message_index", "olm_outbound_group_session_key_length", "olm_outbound_group_session_key", "olm_sas_last_error", "olm_sas_last_error_code", "olm_sas_size", "olm_sas", "olm_clear_sas", "olm_create_sas_random_length", "olm_create_sas", "olm_sas_pubkey_length", "olm_sas_get_pubkey", "olm_sas_set_their_key", "olm_sas_is_their_key_set", "olm_sas_generate_bytes", "olm_sas_mac_length", "olm_sas_calculate_mac_fixed_base64", "olm_sas_calculate_mac", "olm_sas_calculate_mac_long_kdf", "malloc", "free", "__get_temp_ret", "__set_temp_ret", "_emscripten_stack_restore", "_emscripten_stack_alloc", "emscripten_stack_get_current" ], "namedGlobals": { }, "invokeFuncs": [ ], "mainReadsParams": 0, "features": [ "--enable-mutable-globals", "--enable-sign-ext" ] } warning: JS library symbol '$ALLOC_STACK' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated] warning: JS library symbol '$writeAsciiToMemory' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated] emcc: warning: warnings in JS library compilation [-Wjs-compiler] Unknown option '--no-stack-ir' emcc: error: 'wasm-opt --strip-target-features --post-emscripten -O3 --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable --no-stack-ir javascript/olm.wasm -o javascript/olm.wasm --mvp-features --enable-mutable-globals --enable-sign-ext' failed (returned 1) make[2]: *** [Makefile:226: javascript/olm.js] Error 1 make[2]: Leaving directory '/build/olm-3.2.16+dfsg' make[1]: *** [debian/rules:56: debian/js/olm.js] Error 2 make[1]: Leaving directory '/build/olm-3.2.16+dfsg' make: *** [debian/rules:116: binary] Error 2 --no-stack-ir can be worked around by lowering the optimization from -O3 as it's triggered by https://sources.debian.org/src/emscripten/3.1.66~dfsg-2/tools/link.py/?hl=434#L434 --no-growable-memory shouldn't be passed as we have ALLOW_MEMORY_GROWTH and >= llvm-19 should even support it but emscripten depends on llvm-18 is that intentional (see the version check warning above)? Cheers, -- Guido