Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack build failure on M1 chip macos #243

Closed
ssong-iohk opened this issue Aug 9, 2022 · 1 comment
Closed

stack build failure on M1 chip macos #243

ssong-iohk opened this issue Aug 9, 2022 · 1 comment
Labels
server Issues which regard the server

Comments

@ssong-iohk
Copy link

I am trying to build cardano-ogmios-5.5.2 version in my M1 chip apple machine.
Firstly, I got build failure on building bitcoin-core's secp256k1 at the step of sudo make install ,

$ sudo make install                                                                                                                                                                                                                                                  [10:17:45]
Password:
/Applications/Xcode.app/Contents/Developer/usr/bin/make  install-am
 ./build-aux/install-sh -c -d '/usr/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libsecp256k1.la '/usr/lib'
libtool: install: /usr/bin/install -c .libs/libsecp256k1.0.dylib /usr/lib/libsecp256k1.0.dylib
install: /usr/lib/libsecp256k1.0.dylib: Operation not permitted
make[2]: *** [install-libLTLIBRARIES] Error 71
make[1]: *** [install-am] Error 2
make: *** [install] Error 2
FAIL: 2

Following google search, the macOS doesn't allow edit access to /usr/lib and suggested to use /local/usr/lib alternatively.
So I did manage to add symbolic links and libraries at /local/usr/lib

drwxr-xr-x  3 root   wheel    96B  4 May 21:23 docker
-rwxr-xr-x  1 ssong  admin   1.3M 21 Jul 16:57 libsecp256k1.0.dylib
-rw-r--r--  1 ssong  admin   1.5M 21 Jul 16:57 libsecp256k1.a
lrwxr-xr-x  1 ssong  admin    20B 21 Jul 16:57 libsecp256k1.dylib -> libsecp256k1.0.dylib
-rwxr-xr-x  1 ssong  admin   933B 21 Jul 16:57 libsecp256k1.la
-rwxr-xr-x  1 root   admin   544K 19 May 15:27 libsodium.23.dylib
-rw-r--r--  1 root   admin   2.0M 19 May 15:27 libsodium.a
lrwxr-xr-x  1 root   admin    18B 19 May 15:27 libsodium.dylib -> libsodium.23.dylib
-rwxr-xr-x  1 root   admin   943B 19 May 15:27 libsodium.la
drwxrwxr-x  4 ssong  admin   128B 21 Jul 16:29 pkgconfig

However, these don't seem to be lookup-able. so when I ran stack build ogmios, I got below errors around cardano-crypto-class

$ stack build ogmios                                                                                                                                                                                                                                                
/Users/ssong/Cardano/ogmios-5.5.2/server/modules/fast-bech32/fast-bech32.cabal was modified manually. Ignoring /Users/ssong/Cardano/ogmios-5.5.2/server/modules/fast-bech32/package.yaml in favor of the cabal file.
If you want to use the package.yaml file instead of the cabal file,
then please delete the cabal file.
Cabal file warning in/Users/ssong/Cardano/ogmios-5.5.2/server/modules/git-th/git-th.cabal@74:3: The field "build-tools" is deprecated in the Cabal specification version 2.0. Please use 'build-tool-depends' field
Cabal file warning in/Users/ssong/Cardano/ogmios-5.5.2/server/ogmios.cabal@121:3: The field "build-tools" is deprecated in the Cabal specification version 2.0. Please use 'build-tool-depends' field
WARNING: Ignoring ouroboros-consensus-byron's bounds on cryptonite (>=0.25 && <0.28); using cryptonite-0.29.
Reason: trusting snapshot over cabal file dependency information.
WARNING: Ignoring ouroboros-consensus-byron's bounds on formatting (>=6.3 && <6.4); using formatting-7.1.3.
Reason: trusting snapshot over cabal file dependency information.
cardano-crypto-class        > configure
cardano-crypto-class        > Configuring cardano-crypto-class-2.0.0...
cardano-crypto-class        > build
cardano-crypto-class        > Preprocessing library for cardano-crypto-class-2.0.0..
cardano-crypto-class        > compiling .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/Cardano/Crypto/SECP256K1/Constants_hsc_make.c failed (exit code 1)
cardano-crypto-class        > rsp file was: ".stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/Cardano/Crypto/SECP256K1/hsc2hscall80611-0.rsp"
cardano-crypto-class        > command was: /usr/bin/gcc -c .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/Cardano/Crypto/SECP256K1/Constants_hsc_make.c -o .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/Cardano/Crypto/SECP256K1/Constants_hsc_make.o -D__GLASGOW_HASKELL__=810 -Ddarwin_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Ddarwin_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -I/usr/local/include -I/usr/local/include -DSECP256K1 -I.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/autogen -I.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/global-autogen -include .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/autogen/cabal_macros.h -I/usr/local/include -I/Users/ssong/.stack/snapshots/x86_64-osx/d231d8e0d0b24f43fb1568e6b77c3375725606c9b2008428b8fde26c213c6503/8.10.7/lib/x86_64-osx-ghc-8.10.7/vector-0.12.3.1-2QhxFayEJrmJ3PNYTgAmQ3/include -I/Users/ssong/.stack/programs/x86_64-osx/ghc-8.10.7/lib/ghc-8.10.7/unix-2.7.2.2/include -I/Users/ssong/.stack/programs/x86_64-osx/ghc-8.10.7/lib/ghc-8.10.7/time-1.9.3/include -I/Users/ssong/.stack/snapshots/x86_64-osx/d231d8e0d0b24f43fb1568e6b77c3375725606c9b2008428b8fde26c213c6503/8.10.7/lib/x86_64-osx-ghc-8.10.7/primitive-0.7.3.0-HMedJdQUTCQ79SiIUfisnA/include -I/Users/ssong/.stack/programs/x86_64-osx/ghc-8.10.7/lib/ghc-8.10.7/bytestring-0.10.12.0/include -I/Users/ssong/.stack/programs/x86_64-osx/ghc-8.10.7/lib/ghc-8.10.7/base-4.14.3.0/include -I/Users/ssong/.stack/programs/x86_64-osx/ghc-8.10.7/lib/ghc-8.10.7/integer-gmp-1.0.3.0/include -I/Users/ssong/.stack/programs/x86_64-osx/ghc-8.10.7/lib/ghc-8.10.7/include -I/Users/ssong/.stack/programs/x86_64-osx/ghc-8.10.7/lib/ghc-8.10.7/include/
cardano-crypto-class        > error: Constants.hsc:11:10: fatal error: 'secp256k1_extrakeys.h' file not found
cardano-crypto-class        > #include <secp256k1_extrakeys.h>
cardano-crypto-class        >          ^~~~~~~~~~~~~~~~~~~~~~~
cardano-crypto-class        > 1 error generated.
cardano-crypto-class        >
Progress 1/27
--  While building package cardano-crypto-class-2.0.0 (scroll up to its section to see the error) using:
      /Users/ssong/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.7 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.2.1.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

Can anybody help me to build ogmios server successfully? will be much appreciated.

@KtorZ
Copy link
Member

KtorZ commented Aug 9, 2022

Stack is used for development mainly, if you need a production build I'd recommend sticking to Nix or to cabal. Note that none of this may actually solve your problem.

Building for ARM architecture has been discussed in the past in #189. Perhaps @renesecur can chip in on the matter? Are you able to share any hint that'd help with building on ARM?

@KtorZ KtorZ added question server Issues which regard the server labels Aug 9, 2022
@KtorZ KtorZ closed this as completed Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Issues which regard the server
Projects
None yet
Development

No branches or pull requests

2 participants