Building Example Project with `raylib-d`

Steven Schveighoffer schveiguy at gmail.com
Wed Sep 14 23:42:57 UTC 2022


On 9/14/22 4:17 PM, jwatson-CO-edu wrote:
> Hello,
> I used the following steps to build the example `raylib-d` program. 
> (https://github.com/schveiguy/raylib-d#example)
> 
> ### Install Raylib (Ubuntu/Debian)
> 1. `sudo apt install libasound2-dev mesa-common-dev libx11-dev 
> libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev`
> 1. `cd /tmp`
> 1. `git clone https://github.com/raysan5/raylib.git raylib`
> 1. `cd raylib`
> 1. `mkdir build && cd build`
> 1. `cmake -DBUILD_SHARED_LIBS=ON ..`
> 1. `make -j2`
> 1. `sudo make install`
> 1. `sudo reboot now`
> 
> ### Dlang Raylib API
> 1. Install Dlang
> 1. Navigate to project root directory
> 1. `mkdir source`
> 1. `touch source/app.d`
> 1. Code: https://github.com/schveiguy/raylib-d#example
> 1. `dub add raylib-d`
> 1. `dub build`
> 
> ### Errors encountered
> ```
> Performing "debug" build using /usr/bin/dmd for x86_64.
> 00_test ~master: building configuration "application"...
> Linking...
> /usr/bin/ld: 
> .dub/build/application-debug-linux.posix-x86_64-dmd_v2.100.0-533EF886932B3BC59F9F09D93C0642F5/00_test.o: 
> in function `_D6raylib7binding21validateRaylibBindingFNbNiZv':
> /home/james/.dub/packages/raylib-d-4.2.0/raylib-d/source/raylib/binding.d:26: 
> undefined reference to `raylibVersion'
> /usr/bin/ld: 
> /home/james/.dub/packages/raylib-d-4.2.0/raylib-d/source/raylib/binding.d:26: 
> undefined reference to `raylibVersion'
> collect2: error: ld returned 1 exit status
> Error: linker exited with status 1
> /usr/bin/dmd failed with exit code 1.
> ```
> 
> ### Questions
> There appears to be a linker problem with regards to missing symbols, 
> but normally I would expect `make install` to place the shared libs in 
> their proper places.

You built the unreleased version of raylib, where they changed the name 
of that symbol. (see 
https://github.com/raysan5/raylib/commit/082920eb800d7d7612d500a4bbc46b21ff232424)

Try `git checkout 4.2.0` on the raylib library before building, or use 
the released binary.

raylib is notorious for making breaking changes. On the next release, I 
will have to update that symbol name.

-Steve


More information about the Digitalmars-d-learn mailing list