#[SOLVED] stb_image on Linux build - undefined reference to `stbi_load_from_memory'

1 messages · Page 1 of 1 (latest)

hushed orbit
#

Hi,

I'm trying to get my little "game" to build on Linux in GitHub actions. I've already gotten macOS and Windows working, but when I try to do the same on a Linux runner I am greeted with:

/usr/bin/ld: /home/runner/work/odin-sylt/odin-sylt/odin-out/sylt.o: in function `main.init':
odin_package:(.text+0x63d7): undefined reference to `stbi_set_flip_vertically_on_load'
/usr/bin/ld: odin_package:(.text+0x645b): undefined reference to `stbi_load_from_memory'
/usr/bin/ld: odin_package:(.text+0x6487): undefined reference to `stbi_load_from_memory'
/usr/bin/ld: odin_package:(.text+0x6b0b): undefined reference to `stbi_image_free'
/usr/bin/ld: odin_package:(.text+0x6b13): undefined reference to `stbi_image_free'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Do I need to provide some kind of flags or anything else to get this to work?

I've followed the workflow sokol-odin uses: https://github.com/floooh/sokol-odin/blob/main/.github/workflows/main.yml

sudo apt-get update
sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev

I am using the odin-ubuntu-amd64-dev-2024-03.zip to build it with

./dist/odin build src -out:odin-out/sylt.exe -o:speed -show-timings
steep basin
#

You need to go into the stb directory and run make, eg: cd vendor/stb/src && make

hushed orbit
#

Awesome, thank you!

#

[SOLVED] stb_image on Linux build - undefined reference to `stbi_load_from_memory'

#

I still don't know if the actual program built by GitHub works but there are three blue checkmarks 😂

steep basin
#

@placid warren I really think we need something for this, an attribute on foreign imports like @(not_found_error="did you run make?") or even @(not_found_run="cd src && make") that just runs that

placid warren
#

I'd love this but how would it know? This compiler isn't the linker.

steep basin
#

That's true but at least for paths that are relative/absolute we should be able to figure it out?

#

system:blah is harder

placid warren