cardano-foundation / cardano-wallet

HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
Apache License 2.0
762 stars 213 forks source link

cabal build all uses the -msse2 FLAG = Compiling on arm64 - how to reconfigure #2578

Closed whosystem closed 2 years ago

whosystem commented 3 years ago

Context

==================== compile uses the -msse2 FLAG ===================== Compiling on arm64 !!!! using: cabal-install-3.4.0.0 vbox@it4us:~$ cabal --version cabal-install version 3.4.0.0 compiled using version 3.4.0.0 of the Cabal library

Essential Information

cat /home/vbox/.cabal/logs/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1.log : /usr/bin/gcc '-fuse-ld=gold' -Wl,-z,noexecstack /tmp/137041-10.c -o /tmp/137041-11 -E '-D__GLASGOW_HASKELL__=810' '-Dlinux_BUILD_OS=1' '-Daarch64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Daarch64_HOST_ARCH=1' -Idist/build/autogen -Idist/build/cbits -I./cbits -I. -msse2 -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/unix-2.7.2.2/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/time-1.9.3/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bytestring-0.10.12.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/base-4.14.1.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/integer-gmp-1.0.3.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/include /usr/bin/gcc returned ExitFailure 1 with error message: gcc: error: unrecognized command line option ‘-msse2’

cabal-3.4.0.0: Missing dependency on a foreign library:

  1. cabal build all
  2. cabal --disable-nix --extra-include-dirs=/usr/include --extra-lib-dirs=/usr/lib -v3 v2-build all >> /tmp/2021-03-24.err !!!!!!!!!!!!!^^^^^^^^^^^^^ looks like this works - no it does not !!!!! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ image /usr/bin/gcc returned ExitFailure 1 with error message: gcc: error: unrecognized command line option ‘-msse2’

cabal-3.4.0.0: Missing dependency on a foreign library:

=====Provided The Following environment settings ================= export LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:" export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" export CI_PROJECT_DIR=/home/vbox export OS=aarch64 ============re-ran with the command line below ======= cabal --extra-include-dirs=/usr/include --extra-lib-dirs=/usr/lib build all

Expected behavior

Actual behavior

should build anything with scrypt: have installed those libraries and include files as shown below vbox@it4us:~/src/cardano-wallet$ find /usr -name 'scrypt' /usr/local/include/sodium/crypto_pwhash_scryptsalsa208sha256.h /usr/lib/libscrypt.so /usr/lib/libscrypt.so.0 /usr/lib/python3/dist-packages/cryptography/hazmat/primitives/kdf/scrypt.py /usr/lib/python3/dist-packages/cryptography/hazmat/primitives/kdf/pycache/scrypt.cpython-38.pyc /usr/lib/python3/dist-packages/nacl/pwhash/scrypt.py /usr/lib/python3/dist-packages/nacl/pwhash/pycache/scrypt.cpython-38.pyc /usr/lib/libscrypt.a /usr/bin/scrypt find: ‘/usr/share/jicofo/.java/.userPrefs’: Permission denied /usr/share/menu/scrypt /usr/share/doc/scrypt /usr/share/doc/libscrypt-dev /usr/share/doc/libscrypt0 /usr/share/man/man1/scrypt.1.gz /usr/share/man/man7/scrypt.7ssl.gz /usr/src/linux-raspi-headers-5.4.0-1030/include/linux/fscrypt.h /usr/src/linux-raspi-headers-5.4.0-1030/include/uapi/linux/fscrypt.h /usr/src/linux-raspi-headers-5.4.0-1032/include/linux/fscrypt.h /usr/src/linux-raspi-headers-5.4.0-1032/include/uapi/linux/fscrypt.h /usr/include/linux/fscrypt.h vbox@it4us:~/src/cardano-wallet$ find /usr -name 'scrypt' /usr/local/include/sodium/crypto_pwhash_scryptsalsa208sha256.h /usr/lib/libscrypt.so <====== /usr/lib/libscrypt.so.0 <====== /usr/lib/python3/dist-packages/cryptography/hazmat/primitives/kdf/scrypt.py <====== /usr/lib/python3/dist-packages/cryptography/hazmat/primitives/kdf/pycache/scrypt.cpython-38.pyc /usr/lib/python3/dist-packages/nacl/pwhash/scrypt.py /usr/lib/python3/dist-packages/nacl/pwhash/pycache/scrypt.cpython-38.pyc /usr/lib/libscrypt.a <====== /usr/bin/scrypt <====== find: ‘/usr/share/jicofo/.java/.userPrefs’: Permission denied /usr/share/menu/scrypt <====== /usr/share/doc/scrypt<====== /usr/share/doc/libscrypt-dev <====== /usr/share/doc/libscrypt0 <====== /usr/share/man/man1/scrypt.1.gz <====== /usr/share/man/man7/scrypt.7ssl.gz <====== /usr/src/linux-raspi-headers-5.4.0-1030/include/linux/fscrypt.h /usr/src/linux-raspi-headers-5.4.0-1030/include/uapi/linux/fscrypt.h /usr/src/linux-raspi-headers-5.4.0-1032/include/linux/fscrypt.h /usr/src/linux-raspi-headers-5.4.0-1032/include/uapi/linux/fscrypt.h /usr/include/linux/fscrypt.h /usr/include/libscrypt.h <======


Resolution

non-arm related flags are set arm64 related flags not discovered/configured/configurable This may be refined as the investigation progresses. need to set aarch64 flag in c-compiler =====Provided The Following environment settings ================= export LD_LIBRARY_PATH="/usr/local/lib:/usr/lib:" export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" export CI_PROJECT_DIR=/home/vbox export OS=aarch64 ============re-ran with the command line below ======= cabal --extra-include-dirs=/usr/include --extra-lib-dirs=/usr/lib build all

QA

Not built/tested on arm processor ============================!!!!NOTE!!!!================================== ./dist-newstyle/src/cardano-n_-156536db9a177fb0/cardano-node/ChangeLog.md says and I quote: <-

ledger changes

description: This package provides bindings to Colin Percival's scrypt implementation (http://www.tarsnap.com/scrypt.html). Scrypt is a key derivation function designed to be far more secure against hardware brute-force attacks than alternative functions such as PBKDF2 or bcrypt. . Details of the scrypt key derivation function are given in a paper by Colin Percival, Stronger Key Derivation via Sequential Memory-Hard Functions: http://www.tarsnap.com/scrypt/scrypt.pdf.

category: Cryptography build-type: Simple extra-source-files: README.markdown cbits/crypto_scrypt.h cbits/sha256.h cbits/sysendian.h

source-repository head type: git location: http://github.com/informatikr/scrypt

library exposed-modules: Crypto.Scrypt cc-options: -msse2 c-sources: cbits/crypto_scrypt-sse.c cbits/sha256.c

hs-source-dirs: src include-dirs: cbits includes: crypto_scrypt.h install-includes: crypto_scrypt.h ghc-options: -Wall ghc-prof-options: -auto-all build-depends: base (>=4 && <5) && ==4.14.1.0, base64-bytestring >=0.1 && ==1.1.0.0, bytestring >=0.9 && ==0.10.12.0, entropy >=0.2 && ==0.4.1.6

test-suite scrypt-test type: exitcode-stdio-1.0 main-is: Test.hs hs-source-dirs: test ghc-options: -Wall ghc-prof-options: -auto-all build-depends: HUnit >=1.2, QuickCheck >=2 && <3, base (>=4 && <5) && ==4.14.1.0, bytestring >=0.9 && ==0.10.12.0, scrypt, test-framework >=0.6, test-framework-hunit >=0.2, test-framework-quickcheck2 >=0.2 Expanding glob 'README.markdown' in directory './.'. Expanding glob 'cbits/crypto_scrypt.h' in directory './.'. Expanding glob 'cbits/sha256.h' in directory './.'. Expanding glob 'cbits/sysendian.h' in directory './.'. Dependency base ==4.14.1.0: using base-4.14.1.0 Dependency base64-bytestring ==1.1.0.0: using base64-bytestring-1.1.0.0 Dependency bytestring ==0.10.12.0: using bytestring-0.10.12.0 Dependency entropy ==0.4.1.6: using entropy-0.4.1.6 Searching for alex in path. Cannot find alex on the path Searching for ar in path. Found ar at /usr/bin/ar Searching for c2hs in path. Cannot find c2hs on the path Searching for cpphs in path. Cannot find cpphs on the path Searching for doctest in path. Cannot find doctest on the path Searching for gcc in path. Found gcc at /usr/bin/gcc /usr/bin/gcc -dumpversion /usr/bin/gcc is version 9 Searching for ghcjs in path. Cannot find ghcjs on the path Searching for ghcjs-pkg in path. Cannot find ghcjs-pkg on the path Searching for greencard in path. Cannot find greencard on the path looking for tool haddock near compiler in /home/vbox/.ghcup/bin candidate locations: ["/home/vbox/.ghcup/bin/haddock-ghc-8.10.4","/home/vbox/.ghcup/bin/haddock-8.10.4","/home/vbox/.ghcup/bin/haddock","/home/vbox/.ghcup/ghc/8.10.4/bin/haddock-ghc-8.10.4","/home/vbox/.ghcup/ghc/8.10.4/bin/haddock-8.10.4","/home/vbox/.ghcup/ghc/8.10.4/bin/haddock"] found haddock in /home/vbox/.ghcup/bin/haddock-8.10.4 /home/vbox/.ghcup/bin/haddock-8.10.4 --version /home/vbox/.ghcup/bin/haddock-8.10.4 is version 2.24.0 Searching for happy in path. Cannot find happy on the path Searching for hmake in path. Cannot find hmake on the path looking for tool hpc near compiler in /home/vbox/.ghcup/bin candidate locations: ["/home/vbox/.ghcup/bin/hpc-ghc-8.10.4","/home/vbox/.ghcup/bin/hpc-8.10.4","/home/vbox/.ghcup/bin/hpc","/home/vbox/.ghcup/ghc/8.10.4/bin/hpc-ghc-8.10.4","/home/vbox/.ghcup/ghc/8.10.4/bin/hpc-8.10.4","/home/vbox/.ghcup/ghc/8.10.4/bin/hpc"] found hpc in /home/vbox/.ghcup/bin/hpc-8.10.4 /home/vbox/.ghcup/bin/hpc-8.10.4 version /home/vbox/.ghcup/bin/hpc-8.10.4 is version 0.68 looking for tool hsc2hs near compiler in /home/vbox/.ghcup/bin candidate locations: ["/home/vbox/.ghcup/bin/hsc2hs-ghc-8.10.4","/home/vbox/.ghcup/bin/hsc2hs-8.10.4","/home/vbox/.ghcup/bin/hsc2hs","/home/vbox/.ghcup/ghc/8.10.4/bin/hsc2hs-ghc-8.10.4","/home/vbox/.ghcup/ghc/8.10.4/bin/hsc2hs-8.10.4","/home/vbox/.ghcup/ghc/8.10.4/bin/hsc2hs"] found hsc2hs in /home/vbox/.ghcup/bin/hsc2hs-8.10.4 /home/vbox/.ghcup/bin/hsc2hs-8.10.4 --version /home/vbox/.ghcup/bin/hsc2hs-8.10.4 is version 0.68.7 Searching for HsColour in path. Cannot find HsColour on the path Searching for jhc in path. Cannot find jhc on the path Searching for ld.gold in path. Found ld.gold at /usr/bin/ld.gold Environment: [("DBUS_SESSION_BUS_ADDRESS","unix:path=/run/user/1001/bus"),("HASKELL_DIST_DIR","dist"),("HOME","/home/vbox"),("LANG","C.UTF-8"),("LD_LIBRARY_PATH","/usr/local/lib:"),("LESSCLOSE","/usr/bin/lesspipe %s %s"),("LESSOPEN","| /usr/bin/lesspipe %s"),("LOGNAME","vbox"),("LS_COLORS","rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:*.xspf=00;36:"),("MOTD_SHOWN","pam"),("OLDPWD","/usr/include"),("PATH","/home/vbox/.local/bin:/home/vbox/.cabal/bin:/home/vbox/.ghcup/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/vbox/.cabal/bin"),("PKG_CONFIG_PATH","/usr/local/lib/pkgconfig:"),("PWD","/home/vbox/src/cardano-wallet"),("SHELL","/bin/bash"),("SHLVL","2"),("SSH_CLIENT","192.168.0.138 57172 22"),("SSH_CONNECTION","192.168.0.138 57172 192.168.0.136 22"),("SSH_TTY","/dev/pts/4"),("TERM","xterm-256color"),("USER","vbox"),("XDG_DATA_DIRS","/usr/local/share:/usr/share:/var/lib/snapd/desktop"),("XDG_RUNTIME_DIR","/run/user/1001"),("XDG_SESSION_CLASS","user"),("XDG_SESSION_ID","38"),("XDG_SESSIONTYPE","tty"),("","/home/vbox/.ghcup/bin/cabal")] /home/vbox/.ghcup/bin/ghc-8.10.4 -hide-all-packages -c /tmp/206414-0.c -o /tmp/206414-1.o -hide-all-packages /usr/bin/ld.gold -x -r /tmp/206414-1.o -o /tmp/206414-2.o Searching for pkg-config in path. Found pkg-config at /usr/bin/pkg-config /usr/bin/pkg-config --version /usr/bin/pkg-config is version 0.29.1 looking for tool runghc near compiler in /home/vbox/.ghcup/bin candidate locations: ["/home/vbox/.ghcup/bin/runghc-ghc-8.10.4","/home/vbox/.ghcup/bin/runghc-8.10.4","/home/vbox/.ghcup/bin/runghc","/home/vbox/.ghcup/ghc/8.10.4/bin/runghc-ghc-8.10.4","/home/vbox/.ghcup/ghc/8.10.4/bin/runghc-8.10.4","/home/vbox/.ghcup/ghc/8.10.4/bin/runghc"] found runghc in /home/vbox/.ghcup/bin/runghc-8.10.4 /home/vbox/.ghcup/bin/runghc-8.10.4 --version /home/vbox/.ghcup/bin/runghc-8.10.4 is version 8.10.4 Searching for strip in path. Found strip at /usr/bin/strip /usr/bin/strip --version /usr/bin/strip is version 2.34 Searching for tar in path. Found tar at /usr/bin/tar /usr/bin/tar --help Searching for uhc in path. Cannot find uhc on the path Source component graph: component lib Configured component graph: component scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1 include base-4.14.1.0 include base64-bytestring-1.1.0.0-c0daccf83be46305c0ad726e5454703a7861bd5dfbc0c537db7a2219ba7f1cb3 include bytestring-0.10.12.0 include entropy-0.4.1.6-dcacce33066287d1e698ba0fe0b4d4d4ab043f6088cbc0fc59db736d78399eb7 Linked component graph: unit scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1 include base-4.14.1.0 include base64-bytestring-1.1.0.0-c0daccf83be46305c0ad726e5454703a7861bd5dfbc0c537db7a2219ba7f1cb3 include bytestring-0.10.12.0 include entropy-0.4.1.6-dcacce33066287d1e698ba0fe0b4d4d4ab043f6088cbc0fc59db736d78399eb7 Crypto.Scrypt=scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1:Crypto.Scrypt Ready component graph: definite scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1 depends base-4.14.1.0 depends base64-bytestring-1.1.0.0-c0daccf83be46305c0ad726e5454703a7861bd5dfbc0c537db7a2219ba7f1cb3 depends bytestring-0.10.12.0 depends entropy-0.4.1.6-dcacce33066287d1e698ba0fe0b4d4d4ab043f6088cbc0fc59db736d78399eb7 Using Cabal-3.4.0.0 compiled by ghc-8.10 Using compiler: ghc-8.10.4 Using install prefix: /home/vbox/.cabal/store/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1 Executables installed in: /home/vbox/.cabal/store/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1/bin Libraries installed in: /home/vbox/.cabal/store/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1/lib Dynamic Libraries installed in: /home/vbox/.cabal/store/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1/lib Private executables installed in: /home/vbox/.cabal/store/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1/libexec Data files installed in: /home/vbox/.cabal/store/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1/share Documentation installed in: /home/vbox/.cabal/store/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1/share/doc Configuration files installed in: /home/vbox/.cabal/store/ghc-8.10.4/scrypt-0.5.0-f1ad902c29f7d19711cbc85c86cd3df6a7b960ac14a11a79852460a14b8b51c1/etc No alex found Using ar found on system at: /usr/bin/ar No c2hs found No cpphs found No doctest found Using gcc version 9 found on system at: /usr/bin/gcc Using ghc version 8.10.4 given by user at: /home/vbox/.ghcup/bin/ghc-8.10.4 Using ghc-pkg version 8.10.4 given by user at: /home/vbox/.ghcup/bin/ghc-pkg-8.10.4 No ghcjs found No ghcjs-pkg found No greencard found Using haddock version 2.24.0 found on system at: /home/vbox/.ghcup/bin/haddock-8.10.4 No happy found Using haskell-suite found on system at: haskell-suite-dummy-location Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location No hmake found Using hpc version 0.68 found on system at: /home/vbox/.ghcup/bin/hpc-8.10.4 Using hsc2hs version 0.68.7 found on system at: /home/vbox/.ghcup/bin/hsc2hs-8.10.4 No hscolour found No jhc found Using ld found on system at: /usr/bin/ld.gold Using pkg-config version 0.29.1 found on system at: /usr/bin/pkg-config Using runghc version 8.10.4 found on system at: /home/vbox/.ghcup/bin/runghc-8.10.4 Using strip version 2.34 found on system at: /usr/bin/strip Using tar found on system at: /usr/bin/tar No uhc found /usr/bin/gcc '-fuse-ld=gold' -Wl,-z,noexecstack /tmp/206414-4.c -o /tmp/206414-5 '-DGLASGOW_HASKELL=810' '-Dlinux_BUILD_OS=1' '-Daarch64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Daarch64_HOST_ARCH=1' -Idist/build/autogen -Idist/build/cbits -I./cbits -I. -msse2 -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/unix-2.7.2.2/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/time-1.9.3/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bytestring-0.10.12.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/base-4.14.1.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/integer-gmp-1.0.3.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/include -msse2 -L/home/vbox/.cabal/store/ghc-8.10.4/entropy-0.4.1.6-dcacce33066287d1e698ba0fe0b4d4d4ab043f6088cbc0fc59db736d78399eb7/lib -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/unix-2.7.2.2 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/time-1.9.3 -L/home/vbox/.cabal/store/ghc-8.10.4/base64-bytestring-1.1.0.0-c0daccf83be46305c0ad726e5454703a7861bd5dfbc0c537db7a2219ba7f1cb3/lib -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bytestring-0.10.12.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/deepseq-1.4.4.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/array-0.5.4.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/base-4.14.1.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/integer-gmp-1.0.3.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/ghc-prim-0.6.1 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/rts /usr/bin/gcc returned ExitFailure 1 with error message: gcc: error: unrecognized command line option ‘-msse2’ gcc: error: unrecognized command line option ‘-msse2’ /usr/bin/gcc '-fuse-ld=gold' -Wl,-z,noexecstack /tmp/206414-6.c -o /tmp/206414-7 -L/home/vbox/.cabal/store/ghc-8.10.4/entropy-0.4.1.6-dcacce33066287d1e698ba0fe0b4d4d4ab043f6088cbc0fc59db736d78399eb7/lib -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/unix-2.7.2.2 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/time-1.9.3 -L/home/vbox/.cabal/store/ghc-8.10.4/base64-bytestring-1.1.0.0-c0daccf83be46305c0ad726e5454703a7861bd5dfbc0c537db7a2219ba7f1cb3/lib -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bytestring-0.10.12.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/deepseq-1.4.4.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/array-0.5.4.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/base-4.14.1.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/integer-gmp-1.0.3.0 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/ghc-prim-0.6.1 -L/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/rts /usr/bin/gcc '-fuse-ld=gold' -Wl,-z,noexecstack /tmp/206414-8.c -o /tmp/206414-9 -c '-DGLASGOW_HASKELL=810' '-Dlinux_BUILD_OS=1' '-Daarch64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Daarch64_HOST_ARCH=1' -Idist/build/autogen -Idist/build/cbits -I./cbits -I. -msse2 -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/unix-2.7.2.2/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/time-1.9.3/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bytestring-0.10.12.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/base-4.14.1.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/integer-gmp-1.0.3.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/include -msse2 /usr/bin/gcc returned ExitFailure 1 with error message: gcc: error: unrecognized command line option ‘-msse2’ gcc: error: unrecognized command line option ‘-msse2’ /usr/bin/gcc '-fuse-ld=gold' -Wl,-z,noexecstack /tmp/206414-10.c -o /tmp/206414-11 -E '-D__GLASGOW_HASKELL__=810' '-Dlinux_BUILD_OS=1' '-Daarch64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Daarch64_HOST_ARCH=1' -Idist/build/autogen -Idist/build/cbits -I./cbits -I. -msse2 -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/unix-2.7.2.2/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/time-1.9.3/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/bytestring-0.10.12.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/base-4.14.1.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/integer-gmp-1.0.3.0/include -I/home/vbox/.ghcup/ghc/8.10.4/lib/ghc-8.10.4/include /usr/bin/gcc returned ExitFailure 1 with error message: gcc: error: unrecognized command line option ‘-msse2’

cabal-3.4.0.0: Missing dependency on a foreign library:

Jira ticket

ADP-842

rvl commented 3 years ago

Hi, this issue seems to be related to the Haskell build environment on your Raspberry Pi, and nothing to do with cardano-wallet. We can't really help you with that.

In any case, at present, we do not build and test cardano-wallet for aarch64. It's not certain that an aarch64 build will work without code changes.


However... It may almost be possible use Nix to cross-compile for your rpi4 from your PC. But I have not tried it recently. You might be interested in trying. It will take a long time to build, because it will also need to build a cross-compiling toolchain. The first step is to apply the patch below and run:

nix-build release.nix -A aarch64.cardano-wallet.x86-64-linux`
diff --git a/release.nix b/release.nix
index 2b077673e..1ebba1039 100644
--- a/release.nix
+++ b/release.nix
@@ -97,10 +97,12 @@ let
   ############################################################################
   # Mapping the default.nix derivations to build platforms

-  inherit (systems.examples) mingwW64 musl64;
+  inherit (systems.examples) mingwW64 musl64 aarch64-multiplatform-musl;

   mappedJobs = optionalAttrs buildNative {
     native = mapTestOn (filterMappedNative (packagePlatformsOrig (filterJobsNative project)));
+    aarch64 = mapTestOnCross aarch64-multiplatform-musl
+      (packagePlatformsCross (filterJobsCross project));
   } // optionalAttrs buildWindows {
     "${mingwW64.config}" = mapTestOnCross mingwW64
       (packagePlatformsCross (filterJobsWindows project));
whosystem commented 3 years ago

I understand that it is not guaranteed - But I added to the issue with more data and logs and it appears that scrypt is natively available on arm. So the build dependency needs to be removed and the executable has to be linked with the libscrypt-dev package. So this has nothing to do per se with arm - the builds might be better off linking with native material rather bringing in sources from other builds/dependencies.

And yes - this is done without nix The reason to run on ARM is, it is much cheaper - uses 7.5W, has micro sd up to 512GB - has 8 GB and is pretty quick.

I got cardano node and cli compiled with hardly any changes - this is encouraging -

rvl commented 3 years ago

OK. See if you can get the https://github.com/informatikr/scrypt Haskell package to build first, then try cardano-wallet.

whosystem commented 3 years ago

Thank you for the pointer. The package you pointed to me is completely unsuitable and unnecessary for inclusion in the arm architecture. I am new to this environment and have the following difficulties: The documentation on cabal is voluminous but does not point out how to debug cabal scripts/setups for example - how to I know the value of os() being used? how do I know the evaluation of a if condition - the 'cabal repl' runs here without any interactivity Then it helps me force linkage to existing libraries How do I specify in cabal that I want - instead of including a module, link it to an existing module??? Answers to these questions would help greatly.

So far I have not been able to get a running copy compiled of cardano-wallet in any architecture including supported architectures . I am in urgent need to get that done.

I prefer not use 'nix' if at all possible

rvl commented 3 years ago

cardano-wallet needs scrypt because it's used for wallet spending passwords. So if scrypt (Haskell wrapper) won't build then cardano-wallet won't build. See informatikr/scrypt#8.

It's often not simple to diagnose cabal build failures. In the case of scrypt.cabal, it does not provide an option to link with an external scrypt library. It will always use its own. This can be fixed with a little bit of hacking.

whosystem commented 3 years ago

That is what I thought - the scrypt included is intel architecture specific - it is not just a wrapper - it is the whole library from what I gathered inspecting the code - and an arm replacement is available that does not need the sse sub-processor.

Do I need to do the 'hacking'.

mark-stopka commented 3 years ago

cardano-wallet needs scrypt because it's used for wallet spending passwords. So if scrypt (Haskell wrapper) won't build then cardano-wallet won't build. See informatikr/scrypt#8.

It's often not simple to diagnose cabal build failures. In the case of scrypt.cabal, it does not provide an option to link with an external scrypt library. It will always use its own. This can be fixed with a little bit of hacking.

Have you guys considered moving to cryptonite? It is multi-platform, has Scrypt support and is already used at least in cardano-wallet-core.

mark-stopka commented 3 years ago

Even Scrypt library "maintainer" recommends to move on...

https://github.com/cdepillabout/password/issues/15#issuecomment-624475279

rvl commented 3 years ago

Oh right - it's in cryptonite, thanks @mark-stopka. We can use that then, unless there was some particular reason that the scrypt package needed to be used, which I doubt.

ghost commented 3 years ago

Any progress on this issue? I'd be fantastic to run cardano-wallet on a RPi.

rvl commented 3 years ago

Please try the flag in PR #2767.

ghost commented 3 years ago

I gave the PR a try. Unfortunately it still fails (see below).. not sure if it is related:

[ 7 of 20] Compiling Plutus.V1.Ledger.Scripts ( src/Plutus/V1/Ledger/Scripts.hs, dist/build/Plutus/V1/Ledger/Scripts.o, dist/build/Plutus/V1/Ledger/Scripts.dyn_o )

src/Plutus/V1/Ledger/Scripts.hs:102:21: error:

src/Plutus/V1/Ledger/Scripts.hs:105:10: error:

src/Plutus/V1/Ledger/Scripts.hs:155:30: error:

: warning: [-Wunused-packages] The following packages were specified via -package or -package-id flags, but were not needed for compilation: - newtype-generics-0.6 - cardano-crypto-1.1.0 cabal: Failed to build cardano-api-1.27.0 because it depends on cardano-api-1.27.0 which itself failed to build. Failed to build cardano-ledger-alonzo-0.1.0.0 because it depends on cardano-ledger-alonzo-0.1.0.0 which itself failed to build. Failed to build cardano-wallet-2021.6.11 because it depends on cardano-wallet-2021.6.11 which itself failed to build. Failed to build cardano-wallet-2021.6.11 because it depends on cardano-wallet-2021.6.11 which itself failed to build. Failed to build cardano-wallet-cli-2021.6.11 because it depends on cardano-wallet-cli-2021.6.11 which itself failed to build. Failed to build cardano-wallet-core-2021.6.11 because it depends on cardano-wallet-core-2021.6.11 which itself failed to build. Failed to build ouroboros-consensus-cardano-0.1.0.0 because it depends on ouroboros-consensus-cardano-0.1.0.0 which itself failed to build. Failed to build ouroboros-consensus-shelley-0.1.0.0 because it depends on ouroboros-consensus-shelley-0.1.0.0 which itself failed to build. Failed to build plutus-ledger-api-0.1.0.0-8e3e9851008651aad46caf699b9b0d76f70efb12e626cbd044a743e487a4731e.
HeinrichApfelmus commented 3 years ago

I gave the PR a try. Unfortunately it still fails (see below).. not sure if it is related:

[ 7 of 20] Compiling Plutus.V1.Ledger.Scripts ( src/Plutus/V1/Ledger/Scripts.hs, dist/build/Plutus/V1/Ledger/Scripts.o, dist/build/Plutus/V1/Ledger/Scripts.dyn_o )

src/Plutus/V1/Ledger/Scripts.hs:102:21: error:

  • Overlapping instances for Flat.Flat [a] arising from a use of Flat.flat' Matching instances: instance [overlappable] Flat.Flat a => Flat.Flat [a] -- Defined inFlat.Instances.Base' instance [overlapping] Flat.Flat [Haskell.Char] -- Defined in Flat.Instances.Base' (The choice depends on the instantiation ofa' To pick the first instance above, use IncoherentInstances when compiling the other instance declarations)
  • In the first argument of (.)', namelyFlat.flat' In the second argument of (.)', namelyFlat.flat . unScript' In the expression: encode . Flat.flat . unScript | 102 | encode = encode . Flat.flat . unScript | ^^^^^^^^^ […]

This seems to be unrelated. Which compiler version are you using? The original poster used GHC 8.10.4.

ghost commented 3 years ago

I've tested it with ghc-8.10.5 and ghc-8.10.4.. For both versions, compilation fails in the same way. Let me know if there is something I can test/run for you to help tracking this down. Thx!

rvl commented 3 years ago

Oops, looks like the Cabal build is broken again. We generally use stack.

Some package is missing a version bound. We'll fix it when we update to cardano-node 1.28.0.

ghost commented 3 years ago

Thanks! What's your prediction when cardano-node 1.28.0 will be released? Just roughly, should I wait a few days, weeks.. Thanks!

ghost commented 3 years ago

I saw that there is already a 1.28.0 tag: https://github.com/input-output-hk/cardano-node/tree/1.28.0 Is that already worth testing? Cheers!

ghost commented 3 years ago

I've built stack for arm64. Could you share how to pass the -f-scrypt flag to stack?

rvl commented 3 years ago

This should do it:

stack build --no-test --no-bench --flag cardano-wallet-core:-scrypt cardano-wallet:exe:cardano-wallet

And here we shall later fix the Cabal build - PR #2763 (cc @Anviking).

ghost commented 3 years ago

Unfortunately, the stack build fails as well during the compilation of "prettyprinter":

prettyprinter > [20 of 28] Compiling Data.Text.Prettyprint.Doc.Render.Tutorials.StackMachineTutorial
prettyprinter > prettyprinter > /tmp/stack-38055d87f44d1aa4/prettyprinter-1.7.0/src/Data/Text/Prettyprint/Doc/Render/Tutorials/StackMachineTutorial.hs:14:1: warning: [-Wdeprecations] prettyprinter > Module `Prettyprinter.Render.Tutorials.StackMachineTutorial' is deprecated:
prettyprinter > Writing your own stack machine is probably more efficient and customizable; also cProgress 1/290

: commitAndReleaseBuffer: invalid argument (invalid character) pi@raspberrypi:~/cardano_build/cardano-wallet $ Exporting the language via export LANG=C.UTF-8 does not seem to fix it, see https://stackoverflow.com/questions/63746826/what-might-cause-commitandreleasebuffer-invalid-argument-invalid-character
ghost commented 3 years ago

Ok, so I figured the previous bug out.. I had to regenerate the locales on the RP.

Next stop: It's still trying to compile scrypt despite using the newly introduced flag to turn it off:

~/.cabal/bin/stack build -v --no-test --no-bench --jobs=1 --flag cardano-wallet-core:-scrypt cardano-wallet:exe:cardano-wallet --ghc-options "--jobs=1 -v"

2021-07-23 23:01:43.973629: [debug] Run process within /tmp/stack-d1b572ce6b083c87/scrypt-0.5.0/: /home/pi/.stack/setup-exe-cache/aarch64-linux/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.5 --builddir=.stack-work/dist/aarch64-linux/Cabal-3.2.1.0 configure --user --package-db=clear --package-db=global --package-db=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/pkgdb --libdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/lib --bindir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/bin --datadir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/share --libexecdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/libexec --sysconfdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/etc --docdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/doc/scrypt-0.5.0 --htmldir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/doc/scrypt-0.5.0 --haddockdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/doc/scrypt-0.5.0 --dependency=base=base-4.14.2.0 --dependency=base64-bytestring=base64-bytestring-1.1.0.0-Czka7JQqcrB3bbdQKqpLyp --dependency=bytestring=bytestring-0.10.12.0 --dependency=entropy=entropy-0.4.1.6-1VFD0iPK5YrEEa867ydvGz --exact-configuration --ghc-option=-fhide-source-paths 2021-07-23 23:01:46.721489: [info] scrypt > Configuring scrypt-0.5.0...
2021-07-23 23:01:47.334114: [warn] scrypt > Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.5: Missing dependency on a foreign
2021-07-23 23:01:47.334665: [warn] scrypt > library: 2021-07-23 23:01:47.335417: [warn] scrypt > * Missing (or bad) header file: crypto_scrypt.h
2021-07-23 23:01:47.335766: [warn] scrypt > This problem can usually be solved by installing the system package that
2021-07-23 23:01:47.336516: [warn] scrypt > provides this library (you may need the "-dev" version). If the library is
2021-07-23 23:01:47.337709: [warn] scrypt > already installed but in a non-standard location then you can use the flags
2021-07-23 23:01:47.339108: [warn] scrypt > --extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
2021-07-23 23:01:47.339968: [warn] scrypt > library file does exist, it may contain errors that are caught by the C
2021-07-23 23:01:47.340818: [warn] scrypt > compiler at the preprocessing stage. In this case you can re-run configure
2021-07-23 23:01:47.341553: [warn] scrypt > with the verbosity flag -v3 to see the error messages.
2021-07-23 23:01:47.342216: [warn] scrypt > If the header file does exist, it may contain errors that are caught by the C
2021-07-23 23:01:47.342939: [warn] scrypt > compiler at the preprocessing stage. In this case you can re-run configure
2021-07-23 23:01:47.343598: [warn] scrypt > with the verbosity flag -v3 to see the error messages.
2021-07-23 23:01:47.344072: [warn] scrypt > Progress 1/263 2021-07-23 23:01:47.360497: [error] -- While building package scrypt-0.5.0 (scroll up to its section to see the error) using:
/home/pi/.stack/setup-exe-cache/aarch64-linux/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.5 --builddir=.stack-work/dist/aarch64-linux/Cabal-3.2.1.0 configure --user --package-db=clear --package-db=global --package-db=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/pkgdb --libdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/lib --bindir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/bin --datadir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/share --libexecdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/libexec --sysconfdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/etc --docdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/doc/scrypt-0.5.0 --htmldir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/doc/scrypt-0.5.0 --haddockdir=/home/pi/.stack/snapshots/aarch64-linux/dfa28b579eaf899f0f1064ced5e463f244c2634eb5ae96a3577e3e2e1757e5c1/8.10.5/doc/scrypt-0.5.0 --dependency=base=base-4.14.2.0 --dependency=base64-bytestring=base64-bytestring-1.1.0.0-Czka7JQqcrB3bbdQKqpLyp --dependency=bytestring=bytestring-0.10.12.0 --dependency=entropy=entropy-0.4.1.6-1VFD0iPK5YrEEa867ydvGz --exact-configuration --ghc-option=-fhide-source-paths
Process exited with code: ExitFailure 1

Is there a way to list the dependency tree to track down where this is pulled in?

ghost commented 3 years ago

It appears "cardano-wallet-core-integration" -> "scrypt" is still pulling in scrypt. It looks like --flag cardano-wallet-core-internal:-scrypt is required too.

ghost commented 3 years ago

The integration code is still using Crypto.Scrypt. Could you adjust the PR? That'd be awesome.. I think I'm almost there to run it on the RaspPi and I'll share a docker image!

cardano-wallet-core-integration> build (lib) cardano-wallet-core-integration> Preprocessing library for cardano-wallet-core-integration-2021.6.11.. cardano-wallet-core-integration> Building library for cardano-wallet-core-integration-2021.6.11.. cardano-wallet-core-integration> [ 6 of 36] Compiling Test.Integration.Framework.DSL cardano-wallet-core-integration> cardano-wallet-core-integration> /home/pi/cardano_build/cardano-wallet/lib/core-integration/src/Test/Integration/Framework/DSL.hs:442:1: error: cardano-wallet-core-integration> Could not find module ‘Crypto.Scrypt’ cardano-wallet-core-integration> Use -v (or :set -v in ghci) to see a list of the files searched for. cardano-wallet-core-integration> | cardano-wallet-core-integration> 442 | import qualified Crypto.Scrypt as Scrypt cardano-wallet-core-integration> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cardano-wallet-core-integration>

rvl commented 2 years ago

Hi @ghost, @whosystem, would you be able to retest the build on latest master?

Disable the scrypt flag first with:

cabal configure -f-scrypt && cabal build all
cedliang commented 2 years ago

I've built it successfully based on the latest master and have a native cardano-wallet binary working on Apple Silicon with performance that's qualitatively an order of magnitude better! I'm new to working with cabal so I'm not sure if the following is bad practice, but it worked for me:

cabal configure --disable-tests --disable-benchmarks -f-scrypt -O2 && cabal build cardano-wallet:exe:cardano-wallet --ghc-options -O2

image