hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.14k stars 2.77k forks source link

Not able to build server code #4871

Closed SumeetMoray closed 1 year ago

SumeetMoray commented 4 years ago

Hello guys ... I am trying to follow your contributor guide https://github.com/hasura/graphql-engine/blob/master/server/CONTRIBUTING.md and trying to setup Hasura to run manually on ubuntu 20.04 but i am getting this error. When i am running the command cabal new-build

Can anyone throw some light on what could be wrong in this situation ?

cabal new-build

Resolving dependencies... cabal: Could not resolve dependencies: [0] trying: ci-info-0.1.0.0 (user goal) [1] next goal: base (dependency of ci-info) [1] rejecting: base-4.13.0.0/installed-4.13.0.0 (constraint from project config TODO requires ==4.14.0.0) [1] rejecting: base-4.14.0.0 (constraint from non-upgradeable package requires installed instance) [1] rejecting: base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from project config TODO requires ==4.14.0.0) [1] fail (backjumping, conflict set: base, ci-info) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: base, ci-info

hgiasac commented 4 years ago

@SumeetMoray master code was upgraded to GHC 8.10 already. Maybe you are using older GHC version

SumeetMoray commented 4 years ago

thanks for suggestion ... my GHC version was lower than 8.10 so i have upgraded GHC to version 8.10 ... but still the problem is not resolved

ghc -v

Glasgow Haskell Compiler, Version 8.10.1, stage 2 booted by GHC version 8.6.5 initializing package database: Using binary package database: /root/.ghcup/ghc/8.10.1/lib/ghc-8.10.1/package.conf.d/package.cache package flags [] loading package database /root/.ghcup/ghc/8.10.1/lib/ghc-8.10.1/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-1.0.3.0 wired-in package base mapped to base-4.14.0.0 wired-in package rts mapped to rts wired-in package template-haskell mapped to template-haskell-2.16.0.0 wired-in package ghc mapped to ghc-8.10.1 !!! initializing package database: finished in 28.59 milliseconds, allocated 8.088 megabytes Deleting temp files: Deleting: *** Deleting temp dirs: Deleting: ghc: no input files Usage: For basic information, try the `--help' option.

SumeetMoray commented 4 years ago

sudo cabal new-build

Warning: Parsing the index cache failed (01-index.cache: unexpected magic marker encountered: 891426084510914466). Trying to regenerate the index cache... Resolving dependencies... cabal: Could not resolve dependencies: [0] trying: ci-info-0.1.0.0 (user goal) [1] next goal: base (dependency of ci-info) [1] rejecting: base-4.12.0.0/installed-4.1... (constraint from project config TODO requires ==4.14.0.0) [1] rejecting: base-4.14.0.0 (constraint from non-upgradeable package requires installed instance) [1] rejecting: base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from project config TODO requires ==4.14.0.0) [1] fail (backjumping, conflict set: base, ci-info) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: base, ci-info

SumeetMoray commented 4 years ago

@hgiasac

Getting the similar issue when executing command

cabal install

cabal: Could not resolve dependencies: [0] trying: ci-info-0.1.0.0 (user goal) [1] trying: base-4.14.0.0/installed-4.14.0.0 (dependency of ci-info) [2] next goal: graphql-engine (user goal) [2] rejecting: graphql-engine-1.0.0 (conflict: base==4.14.0.0/installed-4.14.0.0, graphql-engine => base==4.12.*) [__2] fail (backjumping, conflict set: base, graphql-engine) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: base, graphql-engine, ci-info

hgiasac commented 4 years ago

Can you try to move/rename cabal.project.freeze to something else and then build it

EmrysMyrddin commented 4 years ago

I have the exact same issue. I have tried to update ghc to latest version (8.10.1) and to remove cabale.project.freeze file.

There is the error now:

➜  server git:(master) ✗ cabal new-build
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: ci-info-0.1.0.0 (user goal)
[__1] trying: base-4.14.0.0/installed-4.14.0.0 (dependency of ci-info)
[__2] trying: graphql-engine-1.0.0 (user goal)
[__3] next goal: these (dependency of graphql-engine)
[__3] rejecting: these-1.1 (conflict: graphql-engine => these>=0.7.1 && <0.8)
[__3] skipping: these-1.0.1, these-1, these-0.8.1, these-0.8 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=0.7.1 && <0.8' from 'graphql-engine')
[__3] rejecting: these-0.7.6 (conflict: base==4.14.0.0/installed-4.14.0.0,
these => base>=4.5.1.0 && <4.13)
[__3] skipping: these-0.7.5, these-0.7.4, these-0.7.3, these-0.7.2,
these-0.7.1 (has the same characteristics that caused the previous version to
fail: excludes 'base' version 4.14.0.0)
[__3] rejecting: these-0.7 (conflict: graphql-engine => these>=0.7.1 && <0.8)
[__3] skipping: these-0.6.2.1, these-0.6.2.0, these-0.6.1.0, these-0.6.0.0,
these-0.4.2, these-0.4.1, these-0.4, these-0.3, these-0.2 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=0.7.1 && <0.8' from 'graphql-engine')
[__3] fail (backjumping, conflict set: base, graphql-engine, these)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: these, graphql-engine, base, ci-info
Try running with --minimize-conflict-set to improve the error message.

And with the option --minimize-conflict-set we get back the previous error:

➜  server git:(master) ✗ cabal new-build --minimize-conflict-set
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: graphql-engine-1.0.0 (user goal)
[__1] next goal: these (dependency of graphql-engine)
[__1] rejecting: these-1.1 (conflict: graphql-engine => these>=0.7.1 && <0.8)
[__1] skipping: these-1.0.1, these-1, these-0.8.1, these-0.8 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=0.7.1 && <0.8' from 'graphql-engine')
[__1] trying: these-0.7.6
[__2] next goal: base (dependency of graphql-engine)
[__2] rejecting: base-4.14.0.0/installed-4.14.0.0 (conflict: these =>
base>=4.5.1.0 && <4.13)
[__2] skipping: base-4.14.0.0, base-4.13.0.0 (has the same characteristics
that caused the previous version to fail: excluded by constraint '>=4.5.1.0 &&
<4.13' from 'these')
[__2] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__2] fail (backjumping, conflict set: base, graphql-engine, these)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, these, graphql-engine
webdeb commented 4 years ago

Hi guys, I am on macOS have the same issues with running hasura locally from source. I would like to suggest to create a hasura-dev image to run & build hasura inside a fixed environment.

Just something like

docker --name hasura-dev run -v /path/to/graphql-engine-repo:/graphql-engine hasura-dev-box
docker exec hasura-dev /graphql-engine/scripts/dev.sh graphql-engine
ayuryshev commented 3 years ago

I had the same errors as above but finally I was able to build hasura.

  1. Installed ghcup
  2. ghcup rm ghc 8.8.4
  3. ghcup install ghc 8.10.2
  4. Then I saw that one of cabal.project.* files were changed so I did git restore
  5. Then make started to build although the step was to sudo mkdir /build && sudo chown ... /build

And finally it built successfully

angrocode commented 3 years ago

decision: https://github.com/hasura/graphql-engine/issues/6621#issue-819077988

rebot commented 3 years ago

I suffer from the same error. I've installed ghc version 8.10.5 and cabal version 3.4.0 on an aarch64 architecture running Ubuntu 20.04.

> cabal new-build
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: ci-info-0.1.0.0 (user goal)
[__1] next goal: base (dependency of ci-info)
[__1] rejecting: base-4.14.2.0/installed-4.14.2.0, base-4.15.0.0,
base-4.14.2.0, base-4.14.1.0 (constraint from project config TODO requires
==4.14.0.0)
[__1] rejecting: base-4.14.0.0 (constraint from non-upgradeable package
requires installed instance)
[__1] rejecting: base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0,
base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from project config TODO requires ==4.14.0.0)
[__1] fail (backjumping, conflict set: base, ci-info)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, ci-info

I've tried to install ci-info and base using npm but this hasn't solved my problem :(

Any idea how to solve this?

EDIT:

I'm using the official guideline to install the server: https://github.com/hasura/graphql-engine/blob/master/server/CONTRIBUTING.md#development-workflow

trevordilley commented 3 years ago

I did steps 1,2 and 3 of what @ayuryshev did, and then mv cabal.project.dev-sh.freeze ~/ (preserve the file but get it out of the repo) and then it started building.

danishejaz80 commented 3 years ago

I'm using macOS v11.3.1, ghc v8.10.5 and cabal v3.4.0.0. After removing cabal.project.freeze the ci-info-0.1.0.0 error was resolved and all required dependencies are installed, an error occurred while Building library for graphql-engine-1.0.0. Does anyone know how to resolve this error?

To run graphql-engine using a docker container, I'm executing scripts/dev.sh graphql-engine

Build profile: -w ghc-8.10.5 -O1
In order, the following will be built (use -v for more details):
 - graphql-engine-1.0.0 (lib) (first run)
 - graphql-engine-1.0.0 (exe:graphql-engine) (first run)
Preprocessing library for graphql-engine-1.0.0..
Building library for graphql-engine-1.0.0..
[ 48 of 310] Compiling Data.GADT.Compare.Extended ( src-lib/Data/GADT/Compare/Extended.hs, /Users/danish-invozone/InvoZone/Work/Full-Stack/hasura-cloud/server/dist-newstyle/build/x86_64-osx/ghc-8.10.5/graphql-engine-1.0.0/noopt/build/Data/GADT/Compare/Extended.dyn_o )

src-lib/Data/GADT/Compare/Extended.hs:12:1: error:
    Ambiguous module name ‘Data.GADT.Compare’:
      it was found in multiple packages: dependent-sum-0.6.2.0 some-1.0.3
   |
12 | import           Data.GADT.Compare
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 49 of 310] Compiling Data.HashMap.Strict.Extended ( src-lib/Data/HashMap/Strict/Extended.hs, /Users/danish-invozone/InvoZone/Work/Full-Stack/hasura-cloud/server/dist-newstyle/build/x86_64-osx/ghc-8.10.5/graphql-engine-1.0.0/noopt/build/Data/HashMap/Strict/Extended.dyn_o )

src-lib/Data/HashMap/Strict/Extended.hs:10:5: error:
    Ambiguous occurrence ‘mapKeys’
    It could refer to
       either ‘M.mapKeys’,
              imported from ‘Data.HashMap.Strict’ at src-lib/Data/HashMap/Strict/Extended.hs:20:1-41
              (and originally defined in ‘Data.HashMap.Internal’)
           or ‘Data.HashMap.Strict.Extended.mapKeys’,
              defined at src-lib/Data/HashMap/Strict/Extended.hs:69:1
   |
10 |   , mapKeys
   |     ^^^^^^^
[ 51 of 310] Compiling Hasura.Base.Instances ( src-lib/Hasura/Base/Instances.hs, /Users/danish-invozone/InvoZone/Work/Full-Stack/hasura-cloud/server/dist-newstyle/build/x86_64-osx/ghc-8.10.5/graphql-engine-1.0.0/noopt/build/Hasura/Base/Instances.dyn_o )

src-lib/Hasura/Base/Instances.hs:23:1: error:
    Ambiguous module name ‘Data.GADT.Compare’:
      it was found in multiple packages: dependent-sum-0.6.2.0 some-1.0.3
   |
23 | import           Data.GADT.Compare
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 54 of 310] Compiling Hasura.Incremental.Select ( src-lib/Hasura/Incremental/Select.hs, /Users/danish-invozone/InvoZone/Work/Full-Stack/hasura-cloud/server/dist-newstyle/build/x86_64-osx/ghc-8.10.5/graphql-engine-1.0.0/noopt/build/Hasura/Incremental/Select.dyn_o )

src-lib/Hasura/Incremental/Select.hs:25:1: error:
    Ambiguous module name ‘Data.GADT.Compare’:
      it was found in multiple packages: dependent-sum-0.6.2.0 some-1.0.3
   |
25 | import           Data.GADT.Compare
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[135 of 310] Compiling Network.Wai.Handler.WebSockets.Custom ( src-lib/Network/Wai/Handler/WebSockets/Custom.hs, /Users/danish-invozone/InvoZone/Work/Full-Stack/hasura-cloud/server/dist-newstyle/build/x86_64-osx/ghc-8.10.5/graphql-engine-1.0.0/noopt/build/Network/Wai/Handler/WebSockets/Custom.dyn_o )

src-lib/Network/Wai/Handler/WebSockets/Custom.hs:25:1: error:
    Could not find module ‘Network.WebSockets.Connection’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
25 | import qualified Network.WebSockets.Connection as WS
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src-lib/Network/Wai/Handler/WebSockets/Custom.hs:26:1: error:
    Could not find module ‘Network.WebSockets.Stream’
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
26 | import qualified Network.WebSockets.Stream     as WS
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build graphql-engine-1.0.0 (which is required by
exe:graphql-engine from graphql-engine-1.0.0).
switz commented 2 years ago

Can't install ghcup install ghc 8.10.2 on an M1 Mac. Any suggestions?

zifeo commented 2 years ago

@switz master has been bumped to 8.10.7 which should be compatible for LLVM backend on M1. Not on M1, but the upgraded solved lots of issue on my side.

Gregoor commented 2 years ago

I'm trying my hand at installing things manually, to reduce the resource drain that is Docker, but am getting the following error:

Failed to build mysql-0.2.0.1. The failure occurred during the configure step.
Build log ( /Users/gregor/.cabal/logs/ghc-8.10.7/mysql-0.2.0.1-a230d55b.log ):
[1 of 1] Compiling Main             ( /Users/gregor/code/graphql-engine/dist-newstyle/tmp/src-77581/mysql-0.2.0.1/dist/setup/setup.hs, /Users/gregor/code/graphql-engine/dist-newstyle/tmp/src-77581/mysql-0.2.0.1/dist/setup/Main.o )
Linking /Users/gregor/code/graphql-engine/dist-newstyle/tmp/src-77581/mysql-0.2.0.1/dist/setup/setup ...
Configuring mysql-0.2.0.1...
setup: Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: ssl, crypto
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.If
the library files do 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.

cabal: Failed to build mysql-0.2.0.1 (which is required by exe:graphql-engine
from graphql-engine-1.0.0). See the build log above for details.

Note that I did run brew install openssl already, which from my understanding should contain the missing C libraries?

rsd1122 commented 1 year ago

Since the above is probably related to your intended use of MySQL, just want to let you know that the Hasura MySQL data connector is now generally available (GA).

Please see our docs for more information: https://hasura.io/docs/latest/databases/mysql/index/