Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build of graphql-engine binary is failing on ubuntu24.04 on x86_64 #10689

Open
abhijeetdandekaribm opened this issue Feb 20, 2025 · 5 comments
Open
Labels
k/bug Something isn't working

Comments

@abhijeetdandekaribm
Copy link

abhijeetdandekaribm commented Feb 20, 2025

Version Information

v2.45.1

Environment

OSS

What is the current behaviour?

We are trying to build graphql-binary by cloning graphql-engine repo on ubuntu:24.04 and while running cabal new-build exe:graphql-engine command inside server folder we are facing below errors.

What is the expected behaviour?

The graphql-engine binary which is used in this graphql-engine Dockerfile should get generated after running cabal new-build exe:graphql-engine command.

How to reproduce the issue?

  1. Clone the graphql-engine repository on ubuntu 24.04 container.
  2. Run apt install -y libpq-dev pkg-config unixodbc unixodbc-dev zlib1g-dev vim git g++ cabal-install ghc command to install ghc, cabal and other required packages.
  3. Delete cabal.project.freeze file from graphql-engine folder.
  4. Inside server folder run the below commands:
    ln -s cabal/dev.project cabal.project.local
    cabal update
    cabal freeze
    cabal new-build exe:graphql-engine

Screenshots or Screencast

Image

Please provide any traces or logs that could help here.

System/Metrics/Prometheus/Internal/Map2.hs:17:3: error:
    Variable not in scope:
      foldl'
        :: (M.Map k10 (M.Map k20 a0)
            -> (k10, k20, a0) -> M.Map k10 (M.Map k20 a0))
           -> M.Map k0 a1 -> [(k1, k2, a)] -> M.Map k1 (M.Map k2 a)
    Suggested fix:
      Perhaps use one of these:
        M.foldl' (imported from Data.Map.Strict),
        `M.foldl' (imported from Data.Map.Strict),
        `foldl' (imported from Prelude)
   |
17 |   foldl'
   |   ^^^^^^
[ 7 of 20] Compiling System.Metrics.Prometheus.Internal.Sample ( System/Metrics/Prometheus/Internal/Sample.hs, /graphql-engine/dist-newstyle/build/x86_64-linux/ghc-9.4.7/ekg-prometheus-0.3.0.0/opt/build/System/Metrics/Prometheus/Internal/Sample.o, /graphql-engine/dist-newstyle/build/x86_64-linux/ghc-9.4.7/ekg-prometheus-0.3.0.0/opt/build/System/Metrics/Prometheus/Internal/Sample.dyn_o ) [Source file changed]

System/Metrics/Prometheus/Internal/Sample.hs:20:3: error:
    Variable not in scope:
      foldl'
        :: (M.Map k10 (a0, M.Map k20 b0)
            -> (k10, k20, a0, b0) -> M.Map k10 (a0, M.Map k20 b0))
           -> M.Map k0 a1 -> [(k1, k2, a, b)] -> M.Map k1 (a, M.Map k2 b)
    Suggested fix:
      Perhaps use one of these:
        M.foldl' (imported from Data.Map.Strict),
        `M.foldl' (imported from Data.Map.Strict),
        `foldl' (imported from Prelude)
   |
20 |   foldl'

Any possible solutions/workarounds you're aware of?

Update below files with import Data.List (foldl')
graphql-engine/server/lib/ekg-prometheus/System/Metrics/Prometheus/Internal/Map2.hs
graphql-engine/server/lib/ekg-prometheus/System/Metrics/Prometheus/Internal/Sample.hs

@abhijeetdandekaribm abhijeetdandekaribm added the k/bug Something isn't working label Feb 20, 2025
@abhijeetdandekaribm abhijeetdandekaribm changed the title Build of graphql-engine binary is failing on X86 Build of graphql-engine binary is failing on ubuntu24.04 on x86_64 Feb 20, 2025
@robertjdominguez
Copy link
Contributor

Thanks for the detailed repro, @abhijeetdandekaribm 🙏

Someone will be in touch shortly.

@danieljharvey
Copy link
Contributor

Hello! Which GHC version did apt-get install? You can run ghc --version to find out.

graphql-engine currently requires GHC version 9.10.1 in order to build correctly. The easiest way to install specific GHC versions is with ghcup.

@jberryman
Copy link
Collaborator

Whatever you do, you'll need to keep the existing freeze file intact. If just trying to build a production binary then cabal build exe:graphql-engine should suffice. If developing the engine you might find scripts/dev.sh graphql-engine is easier

@abhijeetdandekaribm
Copy link
Author

Yes, apt-get was installing ghc-9.4.7. So, I installed ghc-9.10.1 using ghcup tool and cabal build exe:graphql-engine command got executed successfully.
Thanks @robertjdominguez, @danieljharvey, @jberryman for the help!

@abhijeetdandekaribm
Copy link
Author

COPY commands used in this graphql-engine Dockerfile are copying the generated graphql-binary that was created using cabal build exe:graphql-engine right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants