Failing to build project with `persistent-postgresql` on Mac with M1 chip

Skip to first unread message

Arthur Fayzrakhmanov

Sep 12, 2021, 7:42:43 AM9/12/21
to Yesod Web Framework
Hi folks!

I'm trying to build my Yesod web app with GHC 9.0.1 (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-, 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-
  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-

I have PostgreSQL 13 installed via `brew`.

Have no idea how to deal with this, Googling around didn't help.  Is there someone who managed to use PostgreSQL with `persistent` on Macs with M1 chip?

Thanks in advance.

Dec 3, 2021, 5:05:59 PM12/3/21
to Yesod Web Framework
For me it looks like stack tries to compile the postgresql bindings to a (lib postgresql shared object library).

Maybe the Haskell bindings that you use (nightly resolver) is too new for your systems

I'd use an lts resolver and on your Mac system maybe an older one. Or you have to use some new postgresql-dev via brew (in case libpq doesn't come with postgresql directly)?

 - Jakob

Arthur Fayzrakhmanov

Dec 19, 2021, 5:51:24 AM12/19/21
to Yesod Web Framework
Hi Jakob!  I've managed to build everything using PostgreSQL, stack and GHC from brew

суббота, 4 декабря 2021 г. в 03:05:59 UTC+5,
Reply all
Reply to author
0 new messages