jedisct1 / libsodium

A modern, portable, easy to use crypto library.

Home Page:https://libsodium.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests failed on arch arm64v8 in Docker (M1)

alexsoyes opened this issue · comments

commented

Says the test FAIL: pwhash_scrypt.

I might need some help, it drives me crazy :)

Any clue on that?

I do have a M1 with M1 Pro.

Thanks!

 => [11/15] RUN apt-get update && apt-get install -y yarn                                                                                                                                                       16.7s 
 => [12/15] WORKDIR /app                                                                                                                                                                                         0.0s 
 => ERROR [13/15] RUN yarn add sodium                                                                                                                                                                          495.0s 
------                                                                                                                                                                                                                
 > [13/15] RUN yarn add sodium:                                                                                                                                                                                       
#17 2.125 yarn add v1.22.17                                                                                                                                                                                           
#17 2.228 info No lockfile found.                                                                                                                                                                                     
#17 2.340 [1/4] Resolving packages...                                                                                                                                                                                 
#17 3.771 [2/4] Fetching packages...                                                                                                                                                                                  
#17 7.789 [3/4] Linking dependencies...
#17 8.788 [4/4] Building fresh packages...
#17 494.9 error /app/node_modules/sodium: Command failed.
#17 494.9 Exit code: 1
#17 494.9 Command: node install.js --preinstall
#17 494.9 Arguments: 
#17 494.9 Directory: /app/node_modules/sodium
#17 494.9 Output:
#17 494.9 Static libsodium was not found at /app/node_modules/sodium/deps/build/lib/libsodium so compiling libsodium from source.
#17 494.9 autoreconf: Entering directory `.'
...
...
...
#17 494.9 PASS: pwhash_scrypt_ll
#17 494.9 PASS: siphashx24
#17 494.9 PASS: xchacha20
#17 494.9 ../../build-aux/test-driver: line 109: 77678 Killed                  "$@" > $log_file 2>&1
#17 494.9 FAIL: pwhash_scrypt
#17 494.9 ============================================================================
#17 494.9 Testsuite summary for libsodium 1.0.16
#17 494.9 ============================================================================
#17 494.9 # TOTAL: 72
#17 494.9 # PASS:  71
#17 494.9 # SKIP:  0
#17 494.9 # XFAIL: 0
#17 494.9 # FAIL:  1
#17 494.9 # XPASS: 0
#17 494.9 # ERROR: 0
#17 494.9 ============================================================================
#17 494.9 See test/default/test-suite.log
#17 494.9 Please report to https://github.com/jedisct1/libsodium/issues
#17 494.9 ============================================================================
#17 494.9 make[5]: *** [Makefile:1847: test-suite.log] Error 1
#17 494.9 make[5]: Leaving directory '/app/node_modules/sodium/deps/libsodium/test/default'
#17 494.9 make[4]: *** [Makefile:1955: check-TESTS] Error 2
#17 494.9 make[4]: Leaving directory '/app/node_modules/sodium/deps/libsodium/test/default'
#17 494.9 make[3]: *** [Makefile:2526: check-am] Error 2
#17 494.9 make[3]: Leaving directory '/app/node_modules/sodium/deps/libsodium/test/default'
#17 494.9 make[2]: *** [Makefile:403: check-recursive] Error 1
#17 494.9 make[2]: Leaving directory '/app/node_modules/sodium/deps/libsodium/test'
#17 494.9 make[1]: *** [Makefile:518: check-recursive] Error 1
#17 494.9 make[1]: Leaving directory '/app/node_modules/sodium/deps/libsodium'
#17 494.9 make: *** [Makefile:65: libsodium] Error 2
#17 494.9 /app/node_modules/sodium/install.js:293
#17 494.9             throw new Error(cmdLine + ' exited with code ' + code);
#17 494.9             ^
#17 494.9 
#17 494.9 Error: make libsodium exited with code 2
#17 494.9     at ChildProcess.<anonymous> (/app/node_modules/sodium/install.js:293:19)
#17 494.9     at ChildProcess.emit (node:events:520:28)
#17 494.9     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
#17 494.9 info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
------
executor failed running [/bin/sh -c yarn add sodium]: exit code: 1

Here is a simple Dockerfile.

# Arch for M1
FROM arm64v8/debian:latest

# M1 yarn installation with node
RUN apt-get update && apt-get install -y build-essential jq autoconf libtool automake gcc g++ make python3 python3-pip libfontconfig libsodium-dev dumb-init wait-for-it libssl-dev git unzip gettext-base
RUN apt-get update && apt-get upgrade -y && apt-get install -y curl gnupg && curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt update && apt-get remove -y nodejs nodejs-doc && apt-get install -y nodejs
RUN apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
RUN apt install wget && wget https://download.docker.com/linux/ubuntu/gpg && apt-key add gpg
RUN apt update && apt install -y apt-transport-https ca-certificates curl software-properties-common
RUN wget https://dl.yarnpkg.com/debian/pubkey.gpg
RUN cat pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y yarn

WORKDIR /app
RUN yarn add sodium
RUN yarn install
CMD ["start"]

Interesting, can confirm on my M1 Pro here...

Testsuite summary for libsodium 1.0.16

1.0.16 is very old, and predates the existence of Apple M1.

This npm module is maintained independently, and I'm not very familiar with it.

But if you are using is the latest version of that module, you should ask the author to update the embedded version of libsodium to 1.0.18-stable. Or maybe the module has an option to use the library when it's already installed system-wide?

Unfortunately, there's not much that can be done here, as this is a different project.

Duplicate of #721