Giter Club home page Giter Club logo

glfw-ocaml's Issues

difficulties on macos, arm64

I had already brew install glfw

first attempt to opam instal glfw-ocaml failed with:

# File "glfw-ocaml/dune", line 9, characters 15-25:
# 9 |   (names       GLFW_stubs)
#                    ^^^^^^^^^^
# (cd _build/default/glfw-ocaml && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -pthread -D_FILE_OFFSET_BITS=64 -O2 -fno-strict-aliasing -fwrapv -pthread -g -I /Users/paul/.opam/oktree/lib/ocaml -o GLFW_stubs.o -c GLFW_stubs.c)
# GLFW_stubs.c:1:10: fatal error: 'GLFW/glfw3.h' file not found
# #include <GLFW/glfw3.h>
#          ^~~~~~~~~~~~~~
# 1 error generated.

from this answer https://stackoverflow.com/a/67378304/202168 I fixed that by export CPATH=/opt/homebrew/include

installed successfully

then I copied the code from example window.ml and tried to compile it:

ocamlfind ocamlopt -package glfw-ocaml -thread -linkpkg -o glfw.native glfw.ml
File "glfw.ml", line 8, characters 15-32:
8 |   let window = GLFW.createWindow 640 480 "Hello World" () in
                   ^^^^^^^^^^^^^^^^^
Warning 6 [labels-omitted]: labels width, height, title were omitted in the application of this function.
File "glfw.ml", line 10, characters 2-25:
10 |   GLFW.makeContextCurrent (Some window);
       ^^^^^^^^^^^^^^^^^^^^^^^
Warning 6 [labels-omitted]: label window was omitted in the application of this function.
File "glfw.ml", line 12, characters 13-35:
12 |   while not (GLFW.windowShouldClose window) do
                  ^^^^^^^^^^^^^^^^^^^^^^
Warning 6 [labels-omitted]: label window was omitted in the application of this function.
File "glfw.ml", line 16, characters 4-20:
16 |     GLFW.swapBuffers window;
         ^^^^^^^^^^^^^^^^
Warning 6 [labels-omitted]: label window was omitted in the application of this function.
Undefined symbols for architecture arm64:
  "_caml_glClearColorBufferBit", referenced from:
      _camlGlfw__entry in glfw.o
      _camlGlfw__1 in glfw.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking (exit code 1)

I found a couple of answers:

the solution there seems to revolve around having a CMakeLists.txt file with target_link_libraries(<project> glfw)

but I have no idea how to relate that back to glfw-ocaml ...do you have any tips? thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.