Thread overview
Building Example Project with `raylib-d`
Sep 14, 2022
jwatson-CO-edu
Sep 15, 2022
jwatson-CO-edu
September 14, 2022

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
  2. cd /tmp
  3. git clone https://github.com/raysan5/raylib.git raylib
  4. cd raylib
  5. mkdir build && cd build
  6. cmake -DBUILD_SHARED_LIBS=ON ..
  7. make -j2
  8. sudo make install
  9. sudo reboot now

Dlang Raylib API

  1. Install Dlang
  2. Navigate to project root directory
  3. mkdir source
  4. touch source/app.d
  5. Code: https://github.com/schveiguy/raylib-d#example
  6. dub add raylib-d
  7. 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.

  1. Have I missed an install step?
  2. What are my next troubleshooting steps?
September 14, 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
  2. cd /tmp
  3. git clone https://github.com/raysan5/raylib.git raylib
  4. cd raylib
  5. mkdir build && cd build
  6. cmake -DBUILD_SHARED_LIBS=ON ..
  7. make -j2
  8. sudo make install
  9. sudo reboot now

Dlang Raylib API

  1. Install Dlang
  2. Navigate to project root directory
  3. mkdir source
  4. touch source/app.d
  5. Code: https://github.com/schveiguy/raylib-d#example
  6. dub add raylib-d
  7. 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

September 15, 2022

On Wednesday, 14 September 2022 at 23:42:57 UTC, Steven Schveighoffer wrote:

>

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
  2. cd /tmp
  3. git clone https://github.com/raysan5/raylib.git raylib
  4. cd raylib
  5. mkdir build && cd build
  6. cmake -DBUILD_SHARED_LIBS=ON ..
  7. make -j2
  8. sudo make install
  9. sudo reboot now

Dlang Raylib API

  1. Install Dlang
  2. Navigate to project root directory
  3. mkdir source
  4. touch source/app.d
  5. Code: https://github.com/schveiguy/raylib-d#example
  6. dub add raylib-d
  7. 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

That worked immediately, thank you! Honored to have the direct attention of and detailed advice from the package author.

I have the corrected install instructions below, in case someone finds this post while resolving the same issue:

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
  2. cd /tmp
  3. git clone https://github.com/raysan5/raylib.git raylib
  4. cd raylib
  5. git checkout 4.2.0 # 2022-09-14: Or the version currently targeted by raylib-d
  6. mkdir build && cd build
  7. cmake -DBUILD_SHARED_LIBS=ON ..
  8. make -j2
  9. sudo make install
  10. sudo reboot now

Add Dlang Raylib API, Build, and Run

  1. Install Dlang
  2. Navigate to project root directory
  3. mkdir source
  4. touch source/app.d
  5. Code: https://github.com/schveiguy/raylib-d#example
  6. dub add raylib-d
  7. dub build
  8. ./PROJECTNAME