Skip to content

Dynamic linking error with SDL (cannot resolve symbol SDL_SetHint, but SDL_Initworks) #4707

Answered by ryanking13
pthom asked this question in Q&A
Discussion options

You must be logged in to vote

It seems like SDL2 library is not linked when creating the final .so file. So it tries to find the symbol from outside at the runtime.
I don't know the exact reason. I suspect CMake or Emscripten is not putting the flag for some reason.

Anyway, here is the way you can fix it, inside meta.yaml file, put the following content.

build:
  cflags: |
    -sUSE_SDL=2
  ldflags: |
    -sUSE_SDL=2
    -lSDL2

This will inject -lSDL2 at the final link step, which will force link SDL2 library to the final shared library.


On a side note, I noticed that a binary for macOS (_daft_lib.cpython-312-darwin.so) exists in the built wheel. I would recommend to remove this from the wheel to prevent unexpected b…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pthom
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants