jeroenjanssens / raylibr

R package that wraps Raylib, a simple and easy-to-use library to enjoy videogames programming
https://jeroenjanssens.github.io/raylibr/
Other
44 stars 6 forks source link

Installation error Raylibr - file raylib.h is missing #1

Closed jackesselink closed 2 years ago

jackesselink commented 2 years ago

Hi

I tried to install raylibr on both R Studio Desktop Mac and R Studio Server web and both returned the following error:

In file included from RcppExports.cpp:4:0: ../inst/include/raylibr_types.h:3:10: fatal error: raylib.h: No such file or directory

include

Would it be possible to fix the installation package so it includes the missing file?

thanks

SomeUnusualGames commented 2 years ago

I just want to add one more thing I had to do to install the library:

After adding the corresponding raylib files manually, I had some linking errors when compiling it. I solved it by editing the src/Makevars file:

PKG_LIBS = -L/opt/homebrew/Cellar/raylib/4.0.0/lib -lraylib -lwinmm -lkernel32 -lgdi32
PKG_CPPFLAGS = -I/opt/homebrew/Cellar/raylib/4.0.0/include

With that I was able to install raylibr successfully. Note that those are the Windows dependencies, for Linux and Mac it's different. I don't know if this is the best way but it worked for me...

jeroenjanssens commented 2 years ago

Thank you for creating the very first issue for raylibr, @jackesselink! And thank you for providing a temporary Windows solution, @SomeUnusualGames!

So far I have been focusing on getting everything to work in the first place. I wasn't expecting people to actually try it out themselves. :)

Still, being able to install raylibr is obviously crucial. I'll be taking a break and expect to be able to look into this in August, so please be patient. If you can't wait, then manually installing Raylib and modifying src/Makevars to match your configuration might work (as @SomeUnusualGames has reported).

I must admit that bundling a C library with an R package is new to me. If you have any insights or pointers, feel free to comment to this issue. Thanks.

jackesselink commented 2 years ago

I am in hurry at all. I saw your post on Linkedin and an invitation to try out the code so that's why I tried it out. So I am happy to wait and see any updates in August or beyond :))

ramiromagno commented 2 years ago

A first step to help users install raylib could be to list the system packages that provide raylib for different OSes with the SystemRequirements field in the DESCRIPTION file.

Here's an example: https://github.com/r-lib/xml2/blob/ab2078976c9ab57116c7c9175632e7d19d45273f/DESCRIPTION#L36

For example, for my system, an Arch Linux one could add raylib: raylib (Arch Linux) etc (etc)...

Arch Linux raylib package: https://archlinux.org/packages/community/x86_64/raylib/

Also useful: https://stackoverflow.com/questions/58291674/how-does-r-check-for-system-external-dependencies-when-installing-an-r-package