janet-lang / jaylib

Janet bindings to Raylib
MIT License
137 stars 36 forks source link

problem installing - fatal error: GLFW/glfw3.h: No such file or directory #40

Closed lucasemmoreira closed 1 year ago

lucasemmoreira commented 1 year ago

My current issue is when I try to install:

$ sudo jpm install jaylib
From https://github.com/janet-lang/jaylib
 * branch            HEAD       -> FETCH_HEAD
HEAD is now at 14a0665 Merge pull request #37 from CFiggers/master
compiling raylib/src/rcore.c to build/raylib___src___rcore.o...
raylib/src/rcore.c:194:14: fatal error: GLFW/glfw3.h: No such file or directory
  194 |     #include "GLFW/glfw3.h"         // GLFW3 library: Windows, OpenGL context and Input management
      |              ^~~~~~~~~~~~~~
compilation terminated.
error: command failed with non-zero exit code 1
error: build fail
  in pdag [/usr/local/lib/janet/jpm/dagbuild.janet] (tailcall) on line 79, column 23
  in <anonymous> [/usr/local/lib/janet/jpm/pm.janet] on line 236, column 9
  in <anonymous> [/usr/local/lib/janet/jpm/pm.janet] on line 221, column 5
  in bundle-install [/usr/local/lib/janet/jpm/pm.janet] on line 219, column 3
  in install [/usr/local/lib/janet/jpm/commands.janet] (tailcall) on line 197, column 20
  in run-main [boot.janet] on line 3783, column 16
  in cli-main [boot.janet] on line 3928, column 17

I checked and the file is there:

13:40:58: /usr/lib
$ find . -name glfw3.h
./janet/.cache/git__https___github.com_janet-lang_jaylib.git/raylib/examples/others/external/include/GLFW/glfw3.h
./janet/.cache/git__https___github.com_janet-lang_jaylib.git/raylib/src/external/glfw/include/GLFW/glfw3.h

I also tried to clone the repository and and install with jpm directly from there as suggested in the README. However I got no luck.

I also tried to install another package (jtbox) to see if it was a jpm issue but this install was successful. That's why I am submitting the issue here.

Not sure if I am doing something wrong... Can anyone give me some direction on where to go from here?

Some versions info: OS: Artix Linux janet: Janet 1.26.0-75179de8 linux/x64 - '(doc)' for help jpm: not sure how to check the version but I tried through the aur install and then I got the latest version from the repository

sogaiu commented 1 year ago

@lucasemmoreira

I get a similar error on an Ubuntu system.

Doing the following seems to take care of the situation here:

sudo apt-get install libglfw3-dev

Is Artix Arch based? If so, may be one of the packages listed here will help.

May be for a while no additional dependencies were necessary and now they are (again?)...


Thanks to @saikyun for documenting the dependency here.

lucasemmoreira commented 1 year ago

@sogaiu thank you! it worked! (yes, Artix is Arch based)

Since it worked, I think this should be closed. But if I may, I have a question: is this the behavior expected? I thought that because raylib was supposed to be self sufficient (ie, no external dependency)

sogaiu commented 1 year ago

@lucasemmoreira I don't know if it's expected.

I'm also curious as I do see a similar claim in the features section of the Raylib repository README, but I also see what seems like not-so-consistent information at various points in the wiki.

I removed the libglfw3-dev package and tried changing project.janet as follows as an experiment:

diff --git a/project.janet b/project.janet
index cf60476..b5a6c25 100644
--- a/project.janet
+++ b/project.janet
@@ -11,7 +11,7 @@
     :macos '["-Iraylib/src" "-ObjC" "-Iraylib/src/external/glfw/include"]
     :windows ["-Iraylib/src" "-Iraylib/src/external/glfw/include" ]
     #default
-    '["-Iraylib/src"]))
+    '["-Iraylib/src" "-Iraylib/src/external/glfw/include"]))

 (def lflags
   (case o

Now jpm clean && jpm build succeeds without visible errors.

If that's correct may be project.janet could use an update.