haskellari / postgresql-libpq

Low-level Haskell bindings for libpq
BSD 3-Clause "New" or "Revised" License
20 stars 25 forks source link

Version compatibility Matrix #61

Closed ropwareJB closed 3 months ago

ropwareJB commented 3 months ago

What versions of libpq does this library link with? I cannot find a version which correctly links.

> cabal run --ghc -v3
...
ld: skipping incompatible /usr/lib/libpq.so when searching for -lpq
...
/nix/store/ds1prvgw3i3ic8c7axyrw4lwm3d0gqab-gcc-wrapper-7.4.0/bin/cc returned
ExitFailure 1 with error message:
/nix/store/2dfjlvp38xzkyylwpavnh61azi0d168b-binutils-2.31.1/bin/ld: warning:
/usr/lib/libpq.so: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/nix/store/2dfjlvp38xzkyylwpavnh61azi0d168b-binutils-2.31.1/bin/ld: warning:
/usr/lib/libpq.so: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
/nix/store/2dfjlvp38xzkyylwpavnh61azi0d168b-binutils-2.31.1/bin/ld:
/usr/lib/libpq.so: unknown type [0x13] section `.relr.dyn'
/nix/store/2dfjlvp38xzkyylwpavnh61azi0d168b-binutils-2.31.1/bin/ld: skipping
incompatible /usr/lib/libpq.so when searching for -lpq
/nix/store/2dfjlvp38xzkyylwpavnh61azi0d168b-binutils-2.31.1/bin/ld: cannot
find -lpq
/nix/store/2dfjlvp38xzkyylwpavnh61azi0d168b-binutils-2.31.1/bin/ld: warning:
/usr/lib/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
/nix/store/2dfjlvp38xzkyylwpavnh61azi0d168b-binutils-2.31.1/bin/ld: warning:
/usr/lib/libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
collect2: error: ld returned 1 exit status
/nix/store/ds1prvgw3i3ic8c7axyrw4lwm3d0gqab-gcc-wrapper-7.4.0/bin/cc -fno-stack-protector /run/user/1000/609203-10.c -o /run/user/1000/609203-11 -c '-D__GLASGOW_HASKELL__=806' '-Dlinux_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' -Idist/build/autogen -Idist/build/cbits -I./cbits -I/usr/include -I. -I/nix/store/m80snlingdn5qgnklzaixscsvw2gsamq-ghc-8.6.5/lib/ghc-8.6.5/unix-2.7.2.2/include -I/nix/store/m80snlingdn5qgnklzaixscsvw2gsamq-ghc-8.6.5/lib/ghc-8.6.5/time-1.8.0.2/include -I/nix/store/m80snlingdn5qgnklzaixscsvw2gsamq-ghc-8.6.5/lib/ghc-8.6.5/bytestring-0.10.8.2/include -I/nix/store/m80snlingdn5qgnklzaixscsvw2gsamq-ghc-8.6.5/lib/ghc-8.6.5/base-4.12.0.0/include -I/nix/store/ghx36mqri406xh8zpk65rn1x7lfiqxpl-gmp-6.1.2-dev/include -I/nix/store/m80snlingdn5qgnklzaixscsvw2gsamq-ghc-8.6.5/lib/ghc-8.6.5/integer-gmp-1.0.2.0/include -I/nix/store/m80snlingdn5qgnklzaixscsvw2gsamq-ghc-8.6.5/lib/ghc-8.6.5/include -I/nix/store/0jl2dhydfh3jbfpkgkrixisqkhj12d4y-libffi-3.2.1-dev/include
CallStack (from HasCallStack):
  die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:1786:34 in Cabal-2.4.0.1:Distribution.Simple.Configure
  checkForeignDeps, called at libraries/Cabal/Cabal/Distribution/Simple.hs:615:7 in Cabal-2.4.0.1:Distribution.Simple
setup: Missing dependency on a foreign library:
* Missing (or bad) C library: pq
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.

CallStack (from HasCallStack):
  withMetadata, called at src/Distribution/Simple/Utils.hs:368:14 in Cabal-3.10.3.0-1vhmrBuGLi1Io7h0G4FK7T:Distribution.Simple.Utils
Error: cabal: Failed to build cql-0.1.0.0 because it depends on cql-0.1.0.0
which itself failed to build.
Failed to build persistent-postgresql-2.13.6.1 because it depends on
persistent-postgresql-2.13.6.1 which itself failed to build.
Failed to build
postgresql-libpq-0.9.5.0-6f147dd55c8a5b52239bf183edf793e1c7ada78c04c8f076c78292d16dc16502
phadej commented 3 months ago

Try enabling use-pkg-config package flag. It's turned off by default because of Windows, but it's probably time to figure out how to make it the default.

ropwareJB commented 3 months ago

I believe this is due to nix's ld - I installed a copy of the package via nix directly nix-shell -p haskellPackages.postgresql-libpq and it seemed to work without issue.