#require "Graphics" error - symbol not found in flat namespace '_XAllocColor'

Hey everyeone,
I am currently learning OCaml on weekends it is a clean and clear language and the walk-through on the official site is great, but I am facing a problem with running “Graphics”

Cannot load required shared library dllgraphics_stubs.
Reason: /Users/myname/.opam/default/lib/stublibs/dllgraphics_stubs.so:
dlopen(/Users/myname/.opam/default/lib/stublibs/dllgraphics_stubs.so, 0x000A):
symbol not found in flat namespace '_XAllocColor'.

I am using a Macbook Air m1, is there anyway to solve it? thank you everyone!

more info of my machine:

ocamlrun -config
version: 5.0.0
standard_library_default: /Users/myname/.opam/default/lib/ocaml
standard_library: /Users/myname/.opam/default/lib/ocaml
int_size: 64
word_size: 63
os_type: Unix
host: aarch64-apple-darwin22.4.0
flat_float_array: true
supports_afl: true
windows_unicode: false
supports_shared_libraries: true
no_naked_pointers: true
profinfo: false
profinfo_width: 0
exec_magic_number: Caml1999X032
#use "topfind";;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

Sounds similar to Cannot load graphics library on ARM macOS · Issue #33 · ocaml/graphics · GitHub.


1 Like

thanks for replying, since it was just part of the tutorial I just gave up on that