Closed ArthurSonzogni closed 4 years ago
When OpenAL is used as a static library, you also need to define AL_LIBTYPE_STATIC
wherever you include OpenAL headers. Windows is sensitive to this since it dresses symbols differently depending if it's from a DLL or not.
Awesome! I would have never found this myself. Thank you so much!
It worked on its first try: https://travis-ci.com/github/ArthurSonzogni/smk/builds/159693530 Perfect!
I used:
target_compile_definitions(OpenAL PUBLIC AL_LIBTYPE_STATIC)
This tell cmake to add this definition while building the library AND add it to every direct embedders of the library. Maybe we should add a similar line directly into the CMake of OpenAL when building statically? What do you think? This would avoid all the future "me" from falling into the same problem again.
Actually, many similar libraries have this approach to static linking. If I get linker errors then I usually look for this macro option.
Even SFML has one if you've looked into it.
Maybe we should add a similar line directly into the CMake of OpenAL when building statically? What do you think? This would avoid all the future "me" from falling into the same problem again.
Makes sense, I don't imagine it would cause a problem. Done in commit 0dc9b0392d30fab9faae6492c75dbe8240152019.
Thanks! I updated my OpenAL dependency to 0dc9b03. https://github.com/ArthurSonzogni/smk/compare/bd37599b2b51...09f3b433ccb2 In theory, the next build must work thanks to your patch: https://travis-ci.com/github/ArthurSonzogni/smk/builds/159844127
I am using OpenAL-soft for a cross platform library:
Unfortunately, it doesn't link properly on Windows:
I am using OpenAL as a static library.
Is there any reasons linking against OpenAL to be different on Windows than on the other platforms? What is the correct way of using OpenAL on Windows?
(I tried hard the last few days, but I am abandoning. Asking you directly as a last resort)
Here is my configuration:
Fetch openal and set LIBTYPE STATIC
Link the library against OpenAL
Link the example executable against the library:
It compile on Linux and Mac, but fails on Windows: Example output from: https://travis-ci.com/github/ArthurSonzogni/smk/jobs/315617549
Then it fails at link time of the library: