ocaml / graphics

The Graphics library from OCaml, in a standalone repository
Other
58 stars 30 forks source link

Unable to install graphics on a fresh opam installation on Mac OS 10.14.6 #18

Closed Poirriez closed 3 years ago

Poirriez commented 4 years ago

Here is the output of opam install graphics

$ opam install graphics
The following actions will be performed:
  ∗ install   conf-pkg-config 1.1   [required by conf-libX11]
  ∗ install   conf-libX11     1     [required by graphics]
  ∗ install   graphics        5.0.0
  ↻ recompile ocamlfind       1.8.1 [uses graphics]
===== ∗ 3   ↻ 1 =====
Do you want to continue? [Y/n] y

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
[ocamlfind.1.8.1] found in cache
[graphics.5.0.0] downloaded from https://github.com/ocaml/graphics/releases/download/5.0.0/graphics-5.0.0.tbz

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
⊘ removed   ocamlfind.1.8.1
∗ installed conf-pkg-config.1.1
∗ installed conf-libX11.1
[ERROR] The compilation of graphics failed at
        "/Users/vpoirrie/.opam/opam-init/hooks/sandbox.sh build dune build -p
        graphics -j 3 @install".

#=== ERROR while compiling graphics.5.0.0 =====================================#
# context     2.0.4 | macos/x86_64 | ocaml-system.4.09.0 | https://opam.ocaml.org#bd644e85
# path        ~/_opam/.opam-switch/build/graphics.5.0.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p graphics -j 3 @install
# exit-code   1
# env-file    ~/.opam/log/graphics-12083-48c407.env
# output-file ~/.opam/log/graphics-12083-48c407.out
### output ###
# [...]
# In file included from src/unix/text.c:16:
# src/unix/libgraph.h:17:10: fatal error: 'X11/Xlib.h' file not found
# #include <X11/Xlib.h>
#          ^~~~~~~~~~~~
# 1 error generated.
#       ocamlc src/subwindow.o (exit 2)
# (cd _build/default/src && /usr/local/bin/ocamlc.opt -g -ccopt -O2 -ccopt -fno-strict-aliasing -ccopt -fwrapv -ccopt -g -o subwindow.o subwindow.c)
# In file included from src/unix/subwindow.c:16:
# src/unix/libgraph.h:17:10: fatal error: 'X11/Xlib.h' file not found
# #include <X11/Xlib.h>
#          ^~~~~~~~~~~~
# 1 error generated.

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
┌─ The following actions failed
│ λ build graphics 5.0.0
└─ 
┌─ The following changes have been performed (the rest was aborted)
│ ⊘ remove  ocamlfind       1.8.1
│ ∗ install conf-libX11     1
│ ∗ install conf-pkg-config 1.1
└─ 
nojb commented 4 years ago

Duplicate of #16 ?

nojb commented 4 years ago

I think this bug has been correcte in #17, but the fix has not yet been released to opam. In the meantime you can try doing

export LIBRARY_PATH=/opt/X11/lib

before opam install graphics.

dra27 commented 3 years ago

This was fixed in graphics 5.1.0

zhangtravis commented 3 years ago

I have the same problem as mentioned, and I tried running export LIBRARY_PATH=/opt/X11/lib before running opam install graphics, and that does not seem to work. I am on macOS BigSur Version 11.2.1 with an Ocaml Compiler version 4.11.1. Any suggestions would be appreciated!

dra27 commented 3 years ago

It's hopefully not the same problem, because you shouldn't be trying to install version 5.0.0 of the library! Please could you post the error you're getting - in particular, the export shown above was a workaround - has opam install conf-libX11 succeeded?

zhangtravis commented 3 years ago

Hi @dra27, here is the error I am getting:

  $ opam install graphics   
  The following actions will be performed:
    ∗ install   graphics     5.1.1
    ↻ recompile ocamlfind    1.9.1 [uses graphics]
    ↻ recompile base-bytes   base  [uses ocamlfind]
    ↻ recompile ounit2       2.2.4 [uses base-bytes]
    ↻ recompile ANSITerminal 0.8.2 [uses base-bytes]
  ===== ∗ 1   ↻ 4 =====
  Do you want to continue? [Y/n] y

  <><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
  [ANSITerminal.0.8.2] found in cache
  [graphics.5.1.1] found in cache
  [ocamlfind.1.9.1] found in cache
  [ounit2.2.2.4] found in cache

  <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
  [ERROR] The compilation of graphics failed at "/Users/traviszhang/.opam/opam-init/hooks/sandbox.sh build dune
          build -p graphics -j 3 @install".

  #=== ERROR while compiling graphics.5.1.1 =====================================#
  # context     2.0.8 | macos/x86_64 | ocaml-base-compiler.4.11.1 | https://opam.ocaml.org#7e6a6dcc
  # path        ~/.opam/cs3110-2021sp/.opam-switch/build/graphics.5.1.1
  # command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p graphics -j 3 @install
  # exit-code   1
  # env-file    ~/.opam/log/graphics-59898-8b8a2d.env
  # output-file ~/.opam/log/graphics-59898-8b8a2d.out
  ### output ###
  # [...]
  # In file included from src/unix/subwindow.c:16:
  # src/unix/libgraph.h:17:10: fatal error: 'X11/Xlib.h' file not found
  # #include <X11/Xlib.h>
  #          ^~~~~~~~~~~~
  # 1 error generated.
  #           cc src/text.o (exit 1)
  # (cd _build/default/src && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -D_FILE_OFFSET_BITS=64 -D_REENTRANT -g -I /Users/traviszhang/.opam/cs3110-2021sp/lib/ocaml -o text.o -c text.c)
  # In file included from src/unix/text.c:16:
  # src/unix/libgraph.h:17:10: fatal error: 'X11/Xlib.h' file not found
  # #include <X11/Xlib.h>
  #          ^~~~~~~~~~~~
  # 1 error generated.

  <><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
  ┌─ The following actions failed
  │ λ build graphics 5.1.1
  └─ 
  ╶─ No changes have been performed 

Here is the output for running opam install conf-libX11:

$ opam install conf-libX11
[NOTE] Package conf-libX11 is already installed (current version is 1).