首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Opam中的图形安装

Opam中的图形安装
EN

Stack Overflow用户
提问于 2021-05-21 05:49:10
回答 1查看 264关注 0票数 0

我正在尝试使用opam install graphics安装图形,但我得到了以下错误消息:

代码语言:javascript
复制
$ 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-9364-8b8a2d.env
# output-file ~/.opam/log/graphics-9364-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

我尝试过以下解决方案,但似乎没有一种可行:

  1. https://github.com/ocaml/graphics/issues/16 (运行export LIBRARY_PATH=/opt/X11/lib)
  2. 还将export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig"添加到我的.zshrc文件中(在与1相同的线程中提到了这一点。

当我运行pkg-config --list-all | grep x11时,会弹出x11库,但由于某种原因,垃圾邮件在试图安装图形时似乎找不到它。任何建议都是有帮助的!

以下是我目前的计算机配置:

  • macOS BigSur版本11.2.1
  • Ocaml编译器4.11.1

更新:

此问题已在以下线程(https://github.com/ocaml/graphics/pull/36#issuecomment-846827032)中提出,并将在新的图形发行版中更新。

EN

回答 1

Stack Overflow用户

发布于 2021-05-24 14:46:49

要使图形包在macOS上工作,最简单的方法是安装和正确安装自制,然后您就可以这样做了。

代码语言:javascript
复制
opam depext --install graphics

它应该通过自制(xquartzxorgproto)安装系统依赖项,并安装OCaml库。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67631440

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档