Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: link the SDL library statically #2068

Closed
wants to merge 1 commit into from
Closed

Conversation

certik
Copy link
Contributor

@certik certik commented Sep 17, 2024

This allows to run the executable on windows using:

.build/bin/sdl_example

Previously it would give an error message that "SDL.dll" was not found.

This allows to run the executable on windows using:

    .build/bin/sdl_example

Previously it would give an error message that "SDL.dll" was not found.
@certik certik changed the title SDL: link the library statically fix: link the SDL library statically Sep 17, 2024
@certik
Copy link
Contributor Author

certik commented Sep 17, 2024

I tested on Windows natively (in a shell) and on Linux (in WSL) and it works for me in both.

@baszalmstra
Copy link
Contributor

This looks fine, but it did work when using pixi run right?

@certik
Copy link
Contributor Author

certik commented Sep 18, 2024

Yes, the main works with pixi run start.

Also this PR needs to be tested on macOS, the static linking might not work there.

@ruben-arts
Copy link
Contributor

Thanks @certik, assigned our Mac users to test it, if they approve we can merge it!

@tdejager
Copy link
Contributor

Although its nice to run it without pixi r start, is this something we want to use as an example as not all libraries have static counterparts on conda.

@certik
Copy link
Contributor Author

certik commented Sep 19, 2024

Is there a way on Windows to make the program just work by finding the "dll" libraries automatically? Or is static linking the only option?

On Linux and macOS you can use rpath that seems to work pretty well, alleviating most issues with shared libraries.

@baszalmstra
Copy link
Contributor

I dont think there is something like rpath, but if the dlls are next to the executable that would work.

@ruben-arts
Copy link
Contributor

Is this ready to merge?

@certik
Copy link
Contributor Author

certik commented Oct 3, 2024

I've been using SDL in a project for some time with pixi, and I had problems with static linking on all platforms.

I personally think static linking is preferable for end user applications, especially on Windows where the habit seems to be to simply pack all dlls and ship them with the application. So the dlls are not reused anyway, so might as well just link it statically.

However, given the linking problems I had, I would recommend to stick with dynamic linking for now, since this is a demo and must work on all platforms out of the box. So I am going to close the PR.

@certik certik closed this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants