[Haskell-cafe] Troubles with PostgreSQL, Persistent and Apple M1

Branimir Maksimovic branimir.maksimovic at gmail.com
Tue Sep 21 21:47:56 UTC 2021

seems you are using ghc for different architecture:
bmaxa at Branimirs-Air ~ % brew search ghc
==> Formulae
ghc ✔         ghc at 8.6       ghc at 8.8       ghc at 9         gh            ghq           ghi           ghz           ghr           grc           gcc ✔         shc

If you meant "ghc" specifically:
It was migrated from homebrew/cask to homebrew/core.
bmaxa at Branimirs-Air ~ % ghc -v
Glasgow Haskell Compiler, Version 8.10.7, stage 2 booted by GHC version 8.10.7
*** initializing package database:
Using binary package database: /opt/homebrew/Cellar/ghc/8.10.7/lib/ghc-8.10.7/package.conf.d/package.cache
package flags []
loading package database /opt/homebrew/Cellar/ghc/8.10.7/lib/ghc-8.10.7/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.6.1
wired-in package integer-wired-in mapped to integer-gmp-
wired-in package base mapped to base-
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-
wired-in package ghc mapped to ghc-8.10.7
!!! initializing package database: finished in 10.92 milliseconds, allocated 8.308 megabytes

Greetings, Branimir.

> On 21.09.2021., at 22:47, Geraldus <heraldhoi at gmail.com> wrote:
> Hi, dear Cafe!
> I'm having trouble compiling an application which uses PostgreSQL on a macbook with an M1 chip.  
> Postgre itself seems to work fine.  It is installed via `homebrew` (if I'm not mistaken this is the only way on Mac to get pg_config, which is required for `persistent-postgresql`).  The error message is following: 
> ```
> persistent-postgresql> <command line>: dlopen(/Users/arthurfayzrakhmanov/.stack/snapshots/x86_64-osx/36432054bd8d13c1da6134758733286b536c65d34222dcf10ecb29bd437c8117/8.10.7/lib/x86_64-osx-ghc-8.10.7/libHSpostgresql-libpq-, 5): Symbol not found: _PQclear
> persistent-postgresql>   Referenced from: /Users/arthurfayzrakhmanov/.stack/snapshots/x86_64-osx/36432054bd8d13c1da6134758733286b536c65d34222dcf10ecb29bd437c8117/8.10.7/lib/x86_64-osx-ghc-8.10.7/libHSpostgresql-libpq-
> persistent-postgresql>   Expected in: flat namespace
> persistent-postgresql>  in /Users/arthurfayzrakhmanov/.stack/snapshots/x86_64-osx/36432054bd8d13c1da6134758733286b536c65d34222dcf10ecb29bd437c8117/8.10.7/lib/x86_64-osx-ghc-8.10.7/libHSpostgresql-libpq-
> ```
> The minimal setup to reproduce is following: 
> ```
> dependencies:
> - base >= 4.7 && < 5
> - persistent >= && < 3
> - persistent-postgresql >= && < 3
> ```
> Digging around gave me just a few clues.  It seems that `libpq` I have is compiled some other way it expected, and missing some symbols required `persistent-postgresql` to work.  I believe this is not a bug, rather that a local configuration issue.  
> Does anyone know which is right setup to build persistent-postgresql on Macs with M1 chip? Thanks in advance.
> Sincerely.  
> Arthur.
> P.S. Please apologize if this is not a right place to ask such questions.  Asked already in Yesod Google Groups and Stack Overflow.  But didn't received any feedback.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210921/3e95b1e0/attachment.html>

More information about the Haskell-Cafe mailing list