Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

339
Visualizações
Failing to build Haskell project with `persistent-postgresql` on Mac with M1 chip

I'm trying to build my Yesod web app with GHC 9.0.1 via stack

resolver: nightly-2021-09-02

My application uses PostgreSQL database. There are custom persist fields in my code derived via derivePersistField. Build failing with following error message:

<command line>: dlopen(/Users/arthurfayzrakhmanov/.stack/snapshots/x86_64-osx/b9ed0f8360016ada5efeb53015219761394cfd2d563da5d48a402d192c951f0a/9.0.1/lib/x86_64-osx-ghc-9.0.1/libHSpostgresql-libpq-0.9.4.3-4UpE2VczKgl8p7NC0fd3Q8-ghc9.0.1.dylib, 5): Symbol not found: _PQclear
  Referenced from: /Users/arthurfayzrakhmanov/.stack/snapshots/x86_64-osx/b9ed0f8360016ada5efeb53015219761394cfd2d563da5d48a402d192c951f0a/9.0.1/lib/x86_64-osx-ghc-9.0.1/libHSpostgresql-libpq-0.9.4.3-4UpE2VczKgl8p7NC0fd3Q8-ghc9.0.1.dylib
  Expected in: flat namespace       
 in /Users/arthurfayzrakhmanov/.stack/snapshots/x86_64-osx/b9ed0f8360016ada5efeb53015219761394cfd2d563da5d48a402d192c951f0a/9.0.1/lib/x86_64-osx-ghc-9.0.1/libHSpostgresql-libpq-0.9.4.3-4UpE2VczKgl8p7NC0fd3Q8-ghc9.0.1.dylib

I have PostgreSQL 13 installed via brew.

What is proper setup for PostgreSQL use with persistent on Macs with M1 chip?

Thanks in advance.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I was able to build persistent-postgresql having:

  • PostgreSQL installed via brew install postgresql
  • GHC v8.10.7 and cabal-install installed via brew install ghc cabal-install
  • stack installed via brew install haskell-stack
    (previously I had manually installed stack and upgraded it to latest git version)
  • Switched my project resolver to LTS-18.10 to match compiler version to system one (8.10.7)
  • Using stack build --system-ghc to build my project with stack.
  • or cabal build.

There some drawbacks with this approach:

  • brewed stack unable to install any GHC and stuck to use system compiler

    > stack setup
    I don't know how to install GHC for (OSX,AArch64), please install manually

  • brew install ghc@9 fails with recommendation to build it from source, which is unsupported and it fails indeed:

    ==> make
    Last 15 lines from /Users/arthurfayzrakhmanov/Library/Logs/Homebrew/ghc@9/04.make:
    adc %eax, %eax
    ^
    tmp-add_n.s:179:6: error: invalid operand
    adc %eax, %eax
    ^
    make[4]: *** [add_n.lo] Error 1
    make[3]: *** [all-recursive] Error 1
    make[2]: *** [all] Error 2
    make[1]: *** [libraries/ghc-bignum/gmp/gmp.h] Error 2

    <... CUT ....>

    make: *** [all] Error 2

    Do not report this issue to Homebrew/brew or Homebrew/core!

Generally speaking, stack build tool is not needed thanks to cabal-install 3+ and nix-style store. However, in my real use case stack is required for Yesod development (yesod devel relies on stack).


Some credits

Originally, Branimir Maksimovic answered me in Haskell Cafe and suggested to use cabal instead of stack, and install GHC and cabal via homebrew.

This indeed worked, however my real use case required stack. I supposed that brewed stack could also work. In fact, this is no quite right, because stack uses system GHC to work.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda