Dashlane / pqc.js

JS bindings and playground of post-quantum asymmetric ciphers
https://dashlane.github.io/pqc.js/
Apache License 2.0
25 stars 5 forks source link

emcc: error: --memory-init-file is no longer supported #4

Open TamaraFinogina opened 1 month ago

TamaraFinogina commented 1 month ago

Hi! I'm trying to do the build on macOS 14.5 with emscripten: stable 3.1.64 (bottled). However, I'm getting the following: emcc: error: --memory-init-file is no longer supported

Is there anything I can do?

Mikescops commented 1 month ago

Hello,

Can you try to remove this option, it appears twice in the Makefile: https://github.com/Dashlane/pqc.js/blob/c102abd01970be83768b6dc26f3edceeb30e03a1/src/Makefile#L9

TamaraFinogina commented 1 month ago

Hi,

I have tried it. It leads to another error, which is easily fixable: emcc: error: attempt to set ``INVOKE_RUN`` to ``false``; use 1/0 to set boolean settings

However, after fixing that, I'm getting another error, which I don't know how to fix:

node_modules/webpack/types.d.ts:7283:5 - error TS2315: Type 'ServerOptions' is not generic.

7283   | ServerOptionsImport<typeof IncomingMessage>
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/webpack/types.d.ts:13046:41 - error TS2315: Type 'ServerOptions' is not generic.

13046 > = SecureContextOptions & TlsOptions & ServerOptionsImport<Request, Response>;
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 2 errors in the same file, starting at: node_modules/webpack/types.d.ts:7283 

I'm trying to downgrade emscripten and build again. So far it's not working.

Mikescops commented 1 month ago

I took a Sonoma 14.5 to make a working branch for you. Also used the brew emscripten. https://github.com/Dashlane/pqc.js/tree/alternative/macos-arm-ready The issues were mostly due to sed working differently on mac and some webpack configuration that has changed. Seed changes: https://github.com/Dashlane/pqc.js/commit/b97040dd6608e0050546ca6b68d9ff313c5c8010

Let me know if that works for you.

TamaraFinogina commented 1 month ago

Hi,

Thank you so much!

It's getting closer, but make kem-kyber512 still runs into errors:

ERROR in ./dist/kem.asm.js 12:59-75
Module not found: Error: Can't resolve 'module' in '<path>/pqc.js/dist'
 @ ./dist/kem.js 2:0-51 17:24-47 27:28-51

ERROR in ./dist/kem.asm.js 24:59-89
Module not found: Error: Can't resolve './' in '<path>/pqc.js/dist'
 @ ./dist/kem.js 2:0-51 17:24-47 27:28-51

ERROR in ./dist/kem.wasm.js 12:59-75
Module not found: Error: Can't resolve 'module' in '<path>/pqc.js/dist'
 @ ./dist/kem.js 1:0-54 22:28-53

ERROR in ./dist/kem.wasm.js 27:59-89
Module not found: Error: Can't resolve './' in '<path>/pqc.js/dist'
 @ ./dist/kem.js 1:0-54 22:28-53

4 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.93.0 compiled with 4 errors in 838 ms
make: *** [kem-kyber512] Error 1

P.S. Btw, I think PQClean removed many of the schemes make all tries to build.

Mikescops commented 1 month ago

@TamaraFinogina Sorry I forgot to push some files, here you are and I updated the supported algorithms as you suggested!

TamaraFinogina commented 1 month ago

Hi,

Thank you! It works now. I had to install few extra npm packages, but it works!!! Thanks again!