PostgREST / postgrest

REST API for any Postgres database
https://postgrest.org
MIT License
23.45k stars 1.03k forks source link

Support Enterprise Linux 6 #285

Closed mc-soi closed 9 years ago

mc-soi commented 9 years ago

The binary does not work on Scientific Linux 6. Please support SL, CentOS, or RHEL 6 by providing build and install instructions or a rpm.

There are problems with: 1) The binary provided. 2) Building from the distribution's version of Haskell. 3) Building the latest version of Haskell. 4) Installing Stack with GHC 7.6

1) The binary errors out with: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory

2) The build (using packages from EPEL) fails with: cabal install postgrest.cabal Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it. Resolving dependencies... cabal: cannot configure postgrest-0.2.11.1. It requires MissingH -any, Ranged-sets -any, aeson >=0.8, base >=4.6 && <5, base64-string -any, bcrypt

=0.0.6, blaze-builder -any, case-insensitive -any, cassava -any, convertible -any, hasql >=0.7.3 && <0.8, hasql-backend >=0.4.1 && <0.5, hasql-postgres =0.10.4 && <0.11, http-types -any, jwt -any, network >=2.6, network-uri =2.6, optparse-applicative ==0.11.*, regex-tdfa -any, resource-pool -any, scientific -any, split -any, string-conversions -any, stringsearch -any, unordered-containers -any, vector -any, wai >=3.0.1, wai-cors -any, wai-extra -any, wai-middleware-static >=0.6.0 and warp >=3.0.2

cabal install --constraint 'mono-traversable >= 0.9' stack Resolving dependencies... cabal: cannot configure stack-0.1.4.1. It requires base >=4.7 && <5 For the dependency on base >=4.7 && <5 there are these packages: base-4.7.0.0, base-4.7.0.1, base-4.7.0.2, base-4.8.0.0 and base-4.8.1.0. However none of them are available. base-4.7.0.0 was excluded because of the top level dependency base -any base-4.7.0.1 was excluded because of the top level dependency base -any base-4.7.0.2 was excluded because of the top level dependency base -any base-4.8.0.0 was excluded because of the top level dependency base -any base-4.8.1.0 was excluded because of the top level dependency base -any

yum list installed | grep haskell ghc-haskell-platform-devel.x86_64 2011.4.0.0-6.el6 @epel ghc-haskell-src.x86_64 1.0.1.4-10.el6 @epel ghc-haskell-src-devel.x86_64 1.0.1.4-10.el6 @epel ghc-haskell2010.x86_64 1.0.0.0-46.el6 @epel ghc-haskell2010-devel.x86_64 1.0.0.0-46.el6 @epel ghc-haskell98.x86_64 1.1.0.1-46.el6 @epel ghc-haskell98-devel.x86_64 1.1.0.1-46.el6 @epel ghc-template-haskell.x86_64 2.5.0.0-46.el6 @epel ghc-template-haskell-devel.x86_64 2.5.0.0-46.el6 @epel haskell-platform.x86_64 2011.4.0.0-6.el6 @epel

3) Building with Haskell fails with due to ambiguous variables / name space collisions. https://www.madboa.com/blog/2014/10/07/haskell-platform-centos-6/ Modified script to use more recent versions due to failures with older versions: HPVER="2014.2.0.0" GHCVER="7.8.4" CVER="1.22.4.0" CIVER="1.22.6.0"

I fixed one name space collision in Win.hs and got another:

[25 of 28] Compiling GhcDist ( src/GhcDist.hs, dist/build/hptool/hptool-tmp/GhcDist.o )

src/GhcDist.hs:104:38: No instance for (CmdString t0) arising from a use of ‘command’ The type variable ‘t0’ is ambiguous Note: there are several potential instances: instance CmdString () -- Defined in ‘Development.Shake.Command’ instance CmdString Data.ByteString.Lazy.Internal.ByteString -- Defined in ‘Development.Shake.Command’ instance CmdString Data.ByteString.Internal.ByteString -- Defined in ‘Development.Shake.Command’ ...plus one other

4) Installing Haskell with GHC 7.6 failed to install stack: https://gist.github.com/shangaslammi/7672315

cabal install stack Warning:~/.cabal/config: Unrecognized stanza on line 80 Resolving dependencies... cabal: Could not resolve dependencies: trying: stack-0.1.4.1 (user goal) next goal: base (dependency of stack-0.1.4.1) rejecting: base-4.6.0.1/installed-8aa... (conflict: stack => base>=4.7 && <5) rejecting: base-4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires installed instance) Dependency tree exhaustively searched.

If you will not support EL 6, please document the minimum requirements correctly. Enterprise users do not use software that abandons all but the latest platform release.

begriffs commented 9 years ago

Thank you for the detailed description of the problem. It's my goal to create proper binaries for all these Linux distributions but that's not ready yet.

For now you could try building with Stack rather than cabal. Stack installs necessary dependencies automatically. Check out the postgrest wiki building from source. Let me know if that helps.

mc-soi commented 9 years ago

Thank you for your quick reply!

In 2 & 4, cabal install is avaliable, but it could not install stack. Is there a way to build without stack, or maybe a different way of installing stack?

begriffs commented 9 years ago

I think you can install Stack directly rather than trying to use cabal to install it:

https://github.com/commercialhaskell/stack/wiki/Downloads#centos--red-hat--amazon-linux

mc-soi commented 9 years ago

Thanks! That did it. Unfortunately, I do not have the steps necessary to reproduce this yet. Maybe later.

Continued from one of the options above:

Download PostgreSQL 9.5, configure, compile, and install world. Patch init script, initdb, set peer method for Unix sockets in HBA conf, and start. sudo yum remove postgresql export PATH=/usr/local/pgsql/bin:$PATH export LIBRARY_PATH=$(pg_config --libdir)

curl -sSL https://s3.amazonaws.com/download.fpcomplete.com/centos/6/fpco.repo | sudo tee /etc/yum.repos.d/fpco.repo sudo yum install stack cabal update ? stack upgrade ?

stack build

sudo su - postgres $HASKELL_DIR/postgrest/.stack-work/install/x86_64-linux/lts-3.1/7.10.2/bin/postgrest --db-host /tmp --db-port 5432 --db-name test2 --db-user postgres --db-pool 200 --anonymous postgres --port 3000 --v1schema public

curl -d '' http://localhost:3000/rpc/test_sp;echo curl http://localhost:3000/table1?id=gt.299992;echo

cabal -V cabal-install version 1.22.6.0 using version 1.22.4.0 of the Cabal library

stack --version Version 0.1.4.0 (UNKNOWN commits) X86_64

Very impressive. The use of schemas and the search_path as a versioned API, (schema and stored procedure code) is very interesting. I have been using schemas to separate namespaces from different extensions and applications, but maybe this does not need to be exposed to/by PostgREST.

You can close this if you would like, but someone else trying to get this running on EL 6 is going to have an interesting Haskell & stack experience.

begriffs commented 9 years ago

Excellent, glad it worked! It'll be better once the binary is precompiled for EL 6 of course.

While it's still fresh in your mind you could update the troubleshooting wiki with what you learned. I'll close this issue.