www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Raspberry Pi 4: Where to put raylib after I've compiled it to get dub

reply Decabytes <mycontributiontotheworld gmail.com> writes:
I just downloaded Raylib on the pi 4, which unfortunately wasn't 
in the repo on Raspberry Pi OS. On my computer main comp, I can 
link it by just adding raylib to the libs section of the dub.sdl 
because I downloaded it from the repo, but because I've compiled 
it from source on the RPI that doesn't work. All the files are 
located at /home/pi/Desktop/raylib/src. I've tried variations of 
/home/pi/Desktop/raylib/src and /home/pi/Desktop/raylib, but I 
can't seem to get it to work. Is there a place I can put the code 
so that the original libs "raylib" line will work? Or is there 
just a different way to link it I'm not understanding? I don't 
really understand how linking works
Mar 07 2021
parent reply Mike Parker <aldacron gmail.com> writes:
On Monday, 8 March 2021 at 03:16:40 UTC, Decabytes wrote:
 I just downloaded Raylib on the pi 4, which unfortunately 
 wasn't in the repo on Raspberry Pi OS. On my computer main 
 comp, I can link it by just adding raylib to the libs section 
 of the dub.sdl because I downloaded it from the repo, but 
 because I've compiled it from source on the RPI that doesn't 
 work. All the files are located at /home/pi/Desktop/raylib/src. 
 I've tried variations of /home/pi/Desktop/raylib/src and 
 /home/pi/Desktop/raylib, but I can't seem to get it to work. Is 
 there a place I can put the code so that the original libs 
 "raylib" line will work? Or is there just a different way to 
 link it I'm not understanding? I don't really understand how 
 linking works
The linker needs to know two pieces of information to link library dependencies: the library name, and the path to the library. The "libs" directive in the dub.json handles the name. Every operating system has a default library search path. If the library is not on that search path, then you'll need to specify the path. In your dub.json, you should be able to do this with an "lflags" directive, using "-L/path/to/lib". The path can be absolute or relative to the directory in which you're compiling. However, on Unix-like systems, libraries are usually installed in a well-known location on the default search path, like /usr/lib or /usr/local/lib. The raylib Makefile has an "install" target, so you should be able to run "make install" to put the library in the right place. Or you can copy it manually.
Mar 07 2021
parent Decabytes <mycontributiontotheworld gmail.com> writes:
On Monday, 8 March 2021 at 04:22:14 UTC, Mike Parker wrote:
 On Monday, 8 March 2021 at 03:16:40 UTC, Decabytes wrote:
 I just downloaded Raylib on the pi 4, which unfortunately 
 wasn't in the repo on Raspberry Pi OS. On my computer main 
 comp, I can link it by just adding raylib to the libs section 
 of the dub.sdl because I downloaded it from the repo, but 
 because I've compiled it from source on the RPI that doesn't 
 work. All the files are located at 
 /home/pi/Desktop/raylib/src. I've tried variations of 
 /home/pi/Desktop/raylib/src and /home/pi/Desktop/raylib, but I 
 can't seem to get it to work. Is there a place I can put the 
 code so that the original libs "raylib" line will work? Or is 
 there just a different way to link it I'm not understanding? I 
 don't really understand how linking works
The linker needs to know two pieces of information to link library dependencies: the library name, and the path to the library. The "libs" directive in the dub.json handles the name. Every operating system has a default library search path. If the library is not on that search path, then you'll need to specify the path. In your dub.json, you should be able to do this with an "lflags" directive, using "-L/path/to/lib". The path can be absolute or relative to the directory in which you're compiling. However, on Unix-like systems, libraries are usually installed in a well-known location on the default search path, like /usr/lib or /usr/local/lib. The raylib Makefile has an "install" target, so you should be able to run "make install" to put the library in the right place. Or you can copy it manually.
This is helpful! I've gotten a little farther. after copying libraylib.a from the src directory into the /raylib directory, I was successfully able to run make install. Which installed these header files cp --update raylib.h /usr/local/include/raylib.h cp --update raymath.h /usr/local/include/raymath.h cp --update rlgl.h /usr/local/include/rlgl.h cp --update physac.h /usr/local/include/physac.h unfortunately it still didn't like me just putting "raylib" in the libs section, but I at least got all the undefined reference errors to stop happening once I changed it to libs "raylib" "gl" "gbm" "drm" "egl". I'm encountering one more error when I run dub now. INFO: Initializing raylib 3.5 INFO: DISPLAY: No graphic card set, trying card1 WARNING: DISPLAY: Failed get DRM resources Program exited with code -11 I have the drm lib linked, so I'm not entirely sure what is going on there. I tried PLATFORM=PLATFORM_DESKTOP GRAPHICS=GRAPHICS_API_OPENGL_21, and rerunning make install, but that didn't seem to help.
Mar 08 2021