I've having difficulties linking raylib to my odin project, and have tried a bunch of different combinatons with the linker flags to fix it to no avail. I see this error:
odin run . -extra-linker-flags:"-L/opt/homebrew/Cellar/raylib/5.0/lib -lraylib -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreGraphics -framework Foundation -framework AppKit" and I get Undefined symbols for architecture arm64: followed by a bunch of references that failed to resolve like _objc_msgSend$IBeamCursor. Now I've tried this on my system with a C program and I'm able to do it fine with clang: clang main.c -I/opt/homebrew/Cellar/raylib/5.0/include -L/opt/homebrew/Cellar/raylib/5.0/lib -lraylib -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreGraphics -framework Foundation -framework AppKit -framework QuartzCore -lobjc -o test Does anyone have any further guidance?
#Help with linking raylib in Odin
1 messages · Page 1 of 1 (latest)
slightly unrelated, but I am able to use SDL2 perfectly fine without issue
Are you making modifications to rayilb? Why not just use the one in the standard library?
no, I just tried using an installed raylib because the standard library doesnt work either
it's the same error either way
There is a weird issue some people are experiencing lately and I can't figure out what ultimately causes it
You shouldn't need any of these linker flags btw, Odin adds them
I did look at that thread, but wasn't entirely sure what the solution I should be attempting is!
not sure if this helps, but my clang version and llvm seem fine: ➜ src clang -v Homebrew clang version 17.0.6 Target: arm64-apple-darwin21.5.0 Thread model: posix InstalledDir: /opt/homebrew/opt/llvm@17/bin
Tried llvm 18 to no avail as well
Yeah I am not sure either
I will investigate a bit, seems to have some correlation with the macOS sdk version maybe
I don't run into it so it is a bit hard
In the meantime you might have more luck with getting Odin from brew too: brew install odin
That version will link with the raylib on brew so might work
I'll try that out! thanks for the help
no luck with using odin via brew either unfortunately
Really, so that means the raylib build might not be the problem
Got it working - I think the MacOSX sdk was out of date, and updating my mac fixed it
Doing that and reinstalling the command line tools did the trick for me
Okay, that's not ideal though it should work on older versions too
I assume out of date wasn't years out of date
I had to go back to check, it was pretty out of date. I went from 12.4 -> 14.5, which is a couple of years old.