mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.82k stars 438 forks source link

Issues linking when linking against static version of OpenAL #412

Open hsdk123 opened 4 years ago

hsdk123 commented 4 years ago

Hi, I'm attempting to use a static version of OpenAL built through the repo here: https://github.com/kcat/openal-soft

Using a dynamic library build of OpenAL seems to link fine, whereas using the static library seems to cause linker errors. CMake configuration went fine and thus I'm somewhat puzzled as to what's happening.

Log:

C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\AudioData.cpp.obj : error LNK2019: unresolved external symbol __imp__alBufferData referenced in function "public: class Magnum::Audio::Buffer & __thiscall Magnum::Audio::Buffer::setData(enum Magnum::Audio::BufferFormat,class Corrade::Containers::ArrayView<void const >,int)" (?setData@Buffer@Audio@Magnum@@QAEAAV123@W4BufferFormat@23@V?$ArrayView@$$CBX@Containers@Corrade@@H@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\AudioMgr.cpp.obj : error LNK2019: unresolved external symbol __imp__alGenBuffers referenced in function "public: __thiscall Magnum::Audio::Buffer::Buffer(void)" (??0Buffer@Audio@Magnum@@QAE@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\AudioMgr.cpp.obj : error LNK2019: unresolved external symbol __imp__alDeleteBuffers referenced in function "public: __thiscall Magnum::Audio::Buffer::~Buffer(void)" (??1Buffer@Audio@Magnum@@QAE@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alGenSources referenced in function "public: __thiscall Magnum::Audio::Source::Source(void)" (??0Source@Audio@Magnum@@QAE@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alDeleteSources referenced in function "public: __thiscall Magnum::Audio::Source::~Source(void)" (??1Source@Audio@Magnum@@QAE@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alSourcef referenced in function "public: class Magnum::Audio::Source & __thiscall Magnum::Audio::Source::setGain(float)" (?setGain@Source@Audio@Magnum@@QAEAAV123@M@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alSourcei referenced in function "public: class Magnum::Audio::Source & __thiscall Magnum::Audio::Source::setLooping(bool)" (?setLooping@Source@Audio@Magnum@@QAEAAV123@_N@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Source.cpp.obj) : error LNK2001: unresolved external symbol __imp__alSourcei
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alGetSourcef referenced in function "public: float __thiscall Magnum::Audio::Source::gain(void)const " (?gain@Source@Audio@Magnum@@QBEMXZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alGetSourcei referenced in function "public: bool __thiscall Magnum::Audio::Source::isLooping(void)const " (?isLooping@Source@Audio@Magnum@@QBE_NXZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Source.cpp.obj) : error LNK2001: unresolved external symbol __imp__alGetSourcei
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alSourcePlay referenced in function "public: class Magnum::Audio::Source & __thiscall Magnum::Audio::Source::play(void)" (?play@Source@Audio@Magnum@@QAEAAV123@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alSourceStop referenced in function "public: class Magnum::Audio::Source & __thiscall Magnum::Audio::Source::stop(void)" (?stop@Source@Audio@Magnum@@QAEAAV123@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\Sound.cpp.obj : error LNK2019: unresolved external symbol __imp__alSourcePause referenced in function "public: class Magnum::Audio::Source & __thiscall Magnum::Audio::Source::pause(void)" (?pause@Source@Audio@Magnum@@QAEAAV123@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alGetString referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Magnum::Audio::Context::vendorString(void)const " (?vendorString@Context@Audio@Magnum@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcCreateContext referenced in function "public: bool __thiscall Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QAE_NABVConfiguration@123@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcMakeContextCurrent referenced in function "public: bool __thiscall Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QAE_NABVConfiguration@123@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcDestroyContext referenced in function "public: __thiscall Magnum::Audio::Context::~Context(void)" (??1Context@Audio@Magnum@@QAE@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcOpenDevice referenced in function "public: bool __thiscall Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QAE_NABVConfiguration@123@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcCloseDevice referenced in function "public: __thiscall Magnum::Audio::Context::~Context(void)" (??1Context@Audio@Magnum@@QAE@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcGetError referenced in function "public: bool __thiscall Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QAE_NABVConfiguration@123@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcGetString referenced in function "public: static class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl Magnum::Audio::Context::deviceSpecifierStrings(void)" (?deviceSpecifierStrings@Context@Audio@Magnum@@SA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp__alcGetIntegerv referenced in function "public: bool __thiscall Magnum::Audio::Context::isHrtfEnabled(void)const " (?isHrtfEnabled@Context@Audio@Magnum@@QBE_NXZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourcePlayv referenced in function "public: static void __cdecl Magnum::Audio::Source::play(class std::initializer_list<class std::reference_wrapper<class Magnum::Audio::Source> >)" (?play@Source@Audio@Magnum@@SAXV?$initializer_list@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@std@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourceStopv referenced in function "public: static void __cdecl Magnum::Audio::Source::stop(class std::initializer_list<class std::reference_wrapper<class Magnum::Audio::Source> >)" (?stop@Source@Audio@Magnum@@SAXV?$initializer_list@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@std@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourceRewindv referenced in function "public: static void __cdecl Magnum::Audio::Source::rewind(class std::initializer_list<class std::reference_wrapper<class Magnum::Audio::Source> >)" (?rewind@Source@Audio@Magnum@@SAXV?$initializer_list@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@std@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourcePausev referenced in function "public: static void __cdecl Magnum::Audio::Source::pause(class std::initializer_list<class std::reference_wrapper<class Magnum::Audio::Source> >)" (?pause@Source@Audio@Magnum@@SAXV?$initializer_list@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@std@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourceQueueBuffers referenced in function "public: class Magnum::Audio::Source & __thiscall Magnum::Audio::Source::queueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?queueBuffers@Source@Audio@Magnum@@QAEAAV123@V?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x86-Debug\MagnumAudio-d.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp__alSourceUnqueueBuffers referenced in function "public: unsigned int __thiscall Magnum::Audio::Source::unqueueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?unqueueBuffers@Source@Audio@Magnum@@QAEIV?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)
mosra commented 4 years ago

Hi!

Not sure what's happening here. If you check what symbols the static OpenAL exports, are those listed in the exact same form or mangled differently? Another cause might be that the library actually has them, but the header marks them as __declspec(dllimport) and so the linker would try to find them in some DLL instead of taking them directly from the static lib (though I think it would mention the dllimport in that case).

I never built OpenAL Soft myself, so that's about all I can suggest, sorry :)

mosra commented 4 years ago

The changes done in 25f7d79a96dc89b1348773456230a421507f6826 should make static OpenAL work better especially when it comes to 3rd party dependencies, but I'm not sure if it really fixes this issue as well, as that seems to be rather some issue with symbol export than with improperly handled transitive dependencies.

@hsdk123 could you confirm/deny, please? :)

hsdk123 commented 4 years ago

Good to see we're pushing through this! I'm still getting the undefined symbols with the static build:

  FAILED: ../../../bin-Windows-RelWithDebInfo8-cored/LightApp.exe 
  cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=src\App\CMakeFiles\LightApp.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests ..\..\..\config\Windows.manifest -- C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\LightApp.rsp  /out:..\..\..\bin-Windows-RelWithDebInfo8-cored\LightApp.exe /implib:..\..\..\bin-Windows-RelWithDebInfo8-cored\LightApp.lib /pdb:..\..\..\bin-Windows-RelWithDebInfo8-cored\LightApp.pdb /version:0.0  /machine:x64 /debug /INCREMENTAL /subsystem:windows  && cmd.exe /C "cd /D C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\src\App && powershell -noprofile -executionpolicy Bypass -file C:/Users/daego/Desktop/DevTools/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/daego/Desktop/Projects/Light.vn-multi/core/bin-Windows-RelWithDebInfo8-cored/LightApp.exe -installedDir C:/Users/daego/Desktop/DevTools/vcpkg/installed/x64-windows/bin -OutVariable out""
  LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\LightApp.rsp /out:..\..\..\bin-Windows-RelWithDebInfo8-cored\LightApp.exe /implib:..\..\..\bin-Windows-RelWithDebInfo8-cored\LightApp.lib /pdb:..\..\..\bin-Windows-RelWithDebInfo8-cored\LightApp.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:windows /MANIFEST /MANIFESTFILE:src\App\CMakeFiles\LightApp.dir/intermediate.manifest src\App\CMakeFiles\LightApp.dir/manifest.res" failed (exit code 1120) with the following output:
     Creating library ..\..\..\bin-Windows-RelWithDebInfo8-cored\LightApp.lib and object ..\..\..\bin-Windows-RelWithDebInfo8-cored\LightApp.exp
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(AudioMgr.cpp.obj) : error LNK2019: unresolved external symbol __imp_alGenBuffers referenced in function "public: __cdecl Magnum::Audio::Buffer::Buffer(void)" (??0Buffer@Audio@Magnum@@QEAA@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alGenBuffers
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(AudioMgr.cpp.obj) : error LNK2019: unresolved external symbol __imp_alDeleteBuffers referenced in function "public: __cdecl Magnum::Audio::Buffer::~Buffer(void)" (??1Buffer@Audio@Magnum@@QEAA@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alDeleteBuffers
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(AudioData.cpp.obj) : error LNK2019: unresolved external symbol __imp_alBufferData referenced in function "public: class Magnum::Audio::Buffer & __cdecl Magnum::Audio::Buffer::setData(enum Magnum::Audio::BufferFormat,class Corrade::Containers::ArrayView<void const >,int)" (?setData@Buffer@Audio@Magnum@@QEAAAEAV123@W4BufferFormat@23@V?$ArrayView@$$CBX@Containers@Corrade@@H@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alBufferData
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alGenSources referenced in function "public: __cdecl Magnum::Audio::Source::Source(void)" (??0Source@Audio@Magnum@@QEAA@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alGenSources
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alDeleteSources referenced in function "public: __cdecl Magnum::Audio::Source::~Source(void)" (??1Source@Audio@Magnum@@QEAA@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alDeleteSources
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourcef referenced in function "public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::setGain(float)" (?setGain@Source@Audio@Magnum@@QEAAAEAV123@M@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alSourcef
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourcei referenced in function "public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::setLooping(bool)" (?setLooping@Source@Audio@Magnum@@QEAAAEAV123@_N@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Source.cpp.obj) : error LNK2001: unresolved external symbol __imp_alSourcei
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alGetSourcef referenced in function "public: float __cdecl Magnum::Audio::Source::gain(void)const " (?gain@Source@Audio@Magnum@@QEBAMXZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alGetSourcef
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alGetSourcei referenced in function "public: bool __cdecl Magnum::Audio::Source::isLooping(void)const " (?isLooping@Source@Audio@Magnum@@QEBA_NXZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alGetSourcei
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Source.cpp.obj) : error LNK2001: unresolved external symbol __imp_alGetSourcei
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourcePlay referenced in function "public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::play(void)" (?play@Source@Audio@Magnum@@QEAAAEAV123@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(VideoBuffer.cpp.obj) : error LNK2001: unresolved external symbol __imp_alSourcePlay
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourceStop referenced in function "public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::stop(void)" (?stop@Source@Audio@Magnum@@QEAAAEAV123@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MyCore.lib(Sound.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourcePause referenced in function "public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::pause(void)" (?pause@Source@Audio@Magnum@@QEAAAEAV123@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alGetString referenced in function "public: class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl Magnum::Audio::Context::extensionStrings(void)const " (?extensionStrings@Context@Audio@Magnum@@QEBA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alcCreateContext referenced in function "public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alcMakeContextCurrent referenced in function "public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alcDestroyContext referenced in function "public: __cdecl Magnum::Audio::Context::~Context(void)" (??1Context@Audio@Magnum@@QEAA@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alcOpenDevice referenced in function "public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alcCloseDevice referenced in function "public: __cdecl Magnum::Audio::Context::~Context(void)" (??1Context@Audio@Magnum@@QEAA@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alcGetError referenced in function "public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alcGetString referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Magnum::Audio::Context::deviceSpecifierString(void)const " (?deviceSpecifierString@Context@Audio@Magnum@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Context.cpp.obj) : error LNK2019: unresolved external symbol __imp_alcGetIntegerv referenced in function "public: enum Magnum::Audio::Context::HrtfStatus __cdecl Magnum::Audio::Context::hrtfStatus(void)const " (?hrtfStatus@Context@Audio@Magnum@@QEBA?AW4HrtfStatus@123@XZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Buffer.cpp.obj) : error LNK2019: unresolved external symbol __imp_alBufferiv referenced in function "public: class Magnum::Audio::Buffer & __cdecl Magnum::Audio::Buffer::setLoopPoints(int,int)" (?setLoopPoints@Buffer@Audio@Magnum@@QEAAAEAV123@HH@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Buffer.cpp.obj) : error LNK2019: unresolved external symbol __imp_alGetBufferi referenced in function "public: int __cdecl Magnum::Audio::Buffer::bitDepth(void)const " (?bitDepth@Buffer@Audio@Magnum@@QEBAHXZ)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourcePlayv referenced in function "public: static void __cdecl Magnum::Audio::Source::play(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?play@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourceStopv referenced in function "public: static void __cdecl Magnum::Audio::Source::stop(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?stop@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourceRewindv referenced in function "public: static void __cdecl Magnum::Audio::Source::rewind(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?rewind@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourcePausev referenced in function "public: static void __cdecl Magnum::Audio::Source::pause(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?pause@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourceQueueBuffers referenced in function "public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::queueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?queueBuffers@Source@Audio@Magnum@@QEAAAEAV123@V?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release-Cored\MagnumAudio.lib(Source.cpp.obj) : error LNK2019: unresolved external symbol __imp_alSourceUnqueueBuffers referenced in function "public: unsigned __int64 __cdecl Magnum::Audio::Source::unqueueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?unqueueBuffers@Source@Audio@Magnum@@QEAA_KV?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\bin-Windows-RelWithDebInfo8-cored\LightApp.exe : fatal error LNK1120: 29 unresolved externals
  ninja: build stopped: subcommand failed.

Build All failed.
mosra commented 4 years ago

Too bad I don't understand how the link libraries are passed to link.exe :/ I expected MagnumAudio.lib to be on the command line, but it's not there... so I don't even know if OpenAL gets correctly linked.

This is with the updated FindOpenAL? Can you explicitly link LightApp to the OpenAL::OpenAL cmake target?

hsdk123 commented 4 years ago

Hmm, interesting... Would you be able to make sense of this?

1> [CMake] CMake Error at C:/Users/daego/Desktop/DevTools/vcpkg/scripts/buildsystems/vcpkg.cmake:188 (_add_executable):
1> [CMake]   Target "LightApp" links to target "OpenAL::OpenAL" but the target was not
1> [CMake]   found.  Perhaps a find_package() call is missing for an IMPORTED target, or
1> [CMake]   an ALIAS target is missing?
hsdk123 commented 4 years ago

(this is when I explicitly add OpenAL::OpenAL as a link dependency)

mosra commented 4 years ago

Oh, vcpkg? Wait, I thought you have a hand-built static version. With vcpkg I'm aware of a linker error shown at https://github.com/microsoft/vcpkg/pull/10158#issuecomment-591207830, but that's an error one step after the one you have.

This is with the updated FindOpenAL?

The original FindOpenAL (which is based on the vanilla one from CMake) didn't create any OpenAL::OpenAL target, so that may be the reason for the error. Make sure you have the FindOpenAL from latest magnum master and try this -- it should not fail on the "target was not found error" anymore:

find_package(OpenAL REQUIRED)
target_link_libraries(LightApp ... OpenAL::OpenAL)
hsdk123 commented 4 years ago

hand-built static version

Yup, I'm using the hand-built static version, and with the updated FindOpenAL. Not sure why vcpkg is coming up.

I can confirm that this finishes the cmake generate portion without problem, although I needed to copy the FindOpenAL.cmake inside magnum/modules into my top level modules/

find_package(OpenAL REQUIRED)
target_link_libraries(LightApp ... OpenAL::OpenAL)

However, even after doing this, and rebuilding, I still get the same unresolved symbol errors. I get the feeling the error's somewhere else

mosra commented 4 years ago

Hum, then it's probably what i thought at first -- that the static build is weird in some way. And looking at what vcpkg does for static build, yep, that's definitely it: https://github.com/microsoft/vcpkg/blob/master/ports/openal-soft/dont-export-symbols-in-static-build.patch

hsdk123 commented 4 years ago

Might potentially be faster to just ask the maintainer of openal soft, the person seemed kindly fast with replies.

mosra commented 4 years ago

The vcpkg patch seems to be what needs to be integrated upstream, yep. Can you verify locally that it helps and then ask the maintainer about it? (I'm not really on Windows, so I can't help much in this regard.)

hsdk123 commented 4 years ago

The openal-soft maintainer got back super quick, it seems adding

add_compile_definitions(AL_LIBTYPE_STATIC)

fixes the build (and I could get rid of the extra target_link_dependency) - it looks as if magnum would need to add the compile option in the event we use a static build of openal.

mosra commented 4 years ago

I have to admit that's quite an unusual way to do static builds. What's often done (and what magnum does also) is that the library installs a configure header that has this definition embedded (or it adds that to the main headers during build/install).

Looking at its CMakeLists, this definition is added, so if we're using the imported target (which the fancy new FindOpenAL.cmake does), the define should already be present. Similarly to what you did in #402, can you paste the contents of the two OpenALConfig files here? If I assume correctly, those should have the define there. Thanks!

For a non-imported case (where I'm just finding the libraries on the disk, without OpenALConfig), the problem is that I can't reliably detect if the build is static. On Windows you always link to *.lib no matter if it's a DLL or not.

hsdk123 commented 4 years ago

I don't seem to see the define inside here, but here are the 2 files: OpenALConfig.cmake

# Generated by CMake

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
   message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget OpenAL::OpenAL)
  list(APPEND _expectedTargets ${_expectedTarget})
  if(NOT TARGET ${_expectedTarget})
    list(APPEND _targetsNotDefined ${_expectedTarget})
  endif()
  if(TARGET ${_expectedTarget})
    list(APPEND _targetsDefined ${_expectedTarget})
  endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
  unset(_targetsDefined)
  unset(_targetsNotDefined)
  unset(_expectedTargets)
  set(CMAKE_IMPORT_FILE_VERSION)
  cmake_policy(POP)
  return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
  message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)

# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()

# Create imported target OpenAL::OpenAL
add_library(OpenAL::OpenAL STATIC IMPORTED)

set_target_properties(OpenAL::OpenAL PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/AL"
  INTERFACE_LINK_LIBRARIES "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.18362.0/um/x64/WinMM.Lib"
)

if(CMAKE_VERSION VERSION_LESS 2.8.12)
  message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
endif()

# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/OpenALConfig-*.cmake")
foreach(f ${CONFIG_FILES})
  include(${f})
endforeach()

# Cleanup temporary variables.
set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
  foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
    if(NOT EXISTS "${file}" )
      message(FATAL_ERROR "The imported target \"${target}\" references the file
   \"${file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()
  endforeach()
  unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)

# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)

OpenALConfig-relwithdebinfo.cmake

#----------------------------------------------------------------
# Generated CMake target import file for configuration "RelWithDebInfo".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "OpenAL::OpenAL" for configuration "RelWithDebInfo"
set_property(TARGET OpenAL::OpenAL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
set_target_properties(OpenAL::OpenAL PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELWITHDEBINFO "CXX"
  IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib/OpenAL32.lib"
  )

list(APPEND _IMPORT_CHECK_TARGETS OpenAL::OpenAL )
list(APPEND _IMPORT_CHECK_FILES_FOR_OpenAL::OpenAL "${_IMPORT_PREFIX}/lib/OpenAL32.lib" )

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
mosra commented 4 years ago

Just tried building latest Git master locally (on Linux), and this is what I get in OpenALConfig.cmake:

...

set_target_properties(OpenAL::OpenAL PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "AL_LIBTYPE_STATIC"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/AL"
  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:-pthread>;\$<LINK_ONLY:dl>;\$<LINK_ONLY:atomic>;\$<LINK_ONLY:m>"
)

...

The AL_LIBTYPE_STATIC is defined there. Digging further, this seems to be done since kcat/openal-soft@0dc9b0392d30fab9faae6492c75dbe8240152019, which was done after the 1.20.1 release.

Can you confirm that, if you build from latest Git master, the linking issue goes away even without explicitly defining AL_LIBTYPE_STATIC?

hsdk123 commented 4 years ago

I get the following logs, but I can confirm that the build (with master) completes without the definition!

C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alGetString' defined in 'OpenAL32.lib(state.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl Magnum::Audio::Context::extensionStrings(void)const " (?extensionStrings@Context@Audio@Magnum@@QEBA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcCreateContext' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcMakeContextCurrent' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcDestroyContext' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: __cdecl Magnum::Audio::Context::~Context(void)" (??1Context@Audio@Magnum@@QEAA@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcOpenDevice' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcCloseDevice' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: __cdecl Magnum::Audio::Context::~Context(void)" (??1Context@Audio@Magnum@@QEAA@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcGetError' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcGetString' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Magnum::Audio::Context::deviceSpecifierString(void)const " (?deviceSpecifierString@Context@Audio@Magnum@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcGetIntegerv' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: enum Magnum::Audio::Context::HrtfStatus __cdecl Magnum::Audio::Context::hrtfStatus(void)const " (?hrtfStatus@Context@Audio@Magnum@@QEBA?AW4HrtfStatus@123@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alBufferiv' defined in 'OpenAL32.lib(buffer.cpp.obj)' is imported by 'MagnumAudio.lib(Buffer.cpp.obj)' in function '"public: class Magnum::Audio::Buffer & __cdecl Magnum::Audio::Buffer::setLoopPoints(int,int)" (?setLoopPoints@Buffer@Audio@Magnum@@QEAAAEAV123@HH@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alGetBufferi' defined in 'OpenAL32.lib(buffer.cpp.obj)' is imported by 'MagnumAudio.lib(Buffer.cpp.obj)' in function '"public: int __cdecl Magnum::Audio::Buffer::bitDepth(void)const " (?bitDepth@Buffer@Audio@Magnum@@QEBAHXZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourcei' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::setBuffer(class Magnum::Audio::Buffer *)" (?setBuffer@Source@Audio@Magnum@@QEAAAEAV123@PEAVBuffer@23@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alGetSourcei' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: unsigned __int64 __cdecl Magnum::Audio::Source::unqueueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?unqueueBuffers@Source@Audio@Magnum@@QEAA_KV?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourcePlayv' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: static void __cdecl Magnum::Audio::Source::play(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?play@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourceStopv' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: static void __cdecl Magnum::Audio::Source::stop(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?stop@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourceRewindv' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: static void __cdecl Magnum::Audio::Source::rewind(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?rewind@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourcePausev' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: static void __cdecl Magnum::Audio::Source::pause(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?pause@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourceQueueBuffers' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::queueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?queueBuffers@Source@Audio@Magnum@@QEAAAEAV123@V?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourceUnqueueBuffers' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: unsigned __int64 __cdecl Magnum::Audio::Source::unqueueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?unqueueBuffers@Source@Audio@Magnum@@QEAA_KV?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)'
  [347/349] Automatic MOC and UIC for target LightEditor
  [348/348] Linking CXX executable ..\..\..\bin-Windows-RelWithDebInfo8\LightEditor.exe
  LINK : ..\..\..\bin-Windows-RelWithDebInfo8\LightEditor.exe not found or not built by the last incremental link; performing full link
     Creating library ..\..\..\bin-Windows-RelWithDebInfo8\LightEditor.lib and object ..\..\..\bin-Windows-RelWithDebInfo8\LightEditor.exp
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LIBCMT.lib(initializers.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alGetString' defined in 'OpenAL32.lib(state.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > __cdecl Magnum::Audio::Context::extensionStrings(void)const " (?extensionStrings@Context@Audio@Magnum@@QEBA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcCreateContext' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcMakeContextCurrent' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcDestroyContext' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: __cdecl Magnum::Audio::Context::~Context(void)" (??1Context@Audio@Magnum@@QEAA@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcOpenDevice' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcCloseDevice' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: __cdecl Magnum::Audio::Context::~Context(void)" (??1Context@Audio@Magnum@@QEAA@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcGetError' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: bool __cdecl Magnum::Audio::Context::tryCreate(class Magnum::Audio::Context::Configuration const &)" (?tryCreate@Context@Audio@Magnum@@QEAA_NAEBVConfiguration@123@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcGetString' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Magnum::Audio::Context::deviceSpecifierString(void)const " (?deviceSpecifierString@Context@Audio@Magnum@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alcGetIntegerv' defined in 'OpenAL32.lib(alc.cpp.obj)' is imported by 'MagnumAudio.lib(Context.cpp.obj)' in function '"public: enum Magnum::Audio::Context::HrtfStatus __cdecl Magnum::Audio::Context::hrtfStatus(void)const " (?hrtfStatus@Context@Audio@Magnum@@QEBA?AW4HrtfStatus@123@XZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alBufferiv' defined in 'OpenAL32.lib(buffer.cpp.obj)' is imported by 'MagnumAudio.lib(Buffer.cpp.obj)' in function '"public: class Magnum::Audio::Buffer & __cdecl Magnum::Audio::Buffer::setLoopPoints(int,int)" (?setLoopPoints@Buffer@Audio@Magnum@@QEAAAEAV123@HH@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alGetBufferi' defined in 'OpenAL32.lib(buffer.cpp.obj)' is imported by 'MagnumAudio.lib(Buffer.cpp.obj)' in function '"public: int __cdecl Magnum::Audio::Buffer::bitDepth(void)const " (?bitDepth@Buffer@Audio@Magnum@@QEBAHXZ)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourcei' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::setBuffer(class Magnum::Audio::Buffer *)" (?setBuffer@Source@Audio@Magnum@@QEAAAEAV123@PEAVBuffer@23@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alGetSourcei' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: unsigned __int64 __cdecl Magnum::Audio::Source::unqueueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?unqueueBuffers@Source@Audio@Magnum@@QEAA_KV?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourcePlayv' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: static void __cdecl Magnum::Audio::Source::play(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?play@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourceStopv' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: static void __cdecl Magnum::Audio::Source::stop(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?stop@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourceRewindv' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: static void __cdecl Magnum::Audio::Source::rewind(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?rewind@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourcePausev' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: static void __cdecl Magnum::Audio::Source::pause(class std::vector<class std::reference_wrapper<class Magnum::Audio::Source>,class std::allocator<class std::reference_wrapper<class Magnum::Audio::Source> > > const &)" (?pause@Source@Audio@Magnum@@SAXAEBV?$vector@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@V?$allocator@V?$reference_wrapper@VSource@Audio@Magnum@@@std@@@2@@std@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourceQueueBuffers' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: class Magnum::Audio::Source & __cdecl Magnum::Audio::Source::queueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?queueBuffers@Source@Audio@Magnum@@QEAAAEAV123@V?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)'
C:\Users\daego\Desktop\Projects\Light.vn-multi\core\out\build\x64-Release\LINK : warning LNK4217: symbol 'alSourceUnqueueBuffers' defined in 'OpenAL32.lib(source.cpp.obj)' is imported by 'MagnumAudio.lib(Source.cpp.obj)' in function '"public: unsigned __int64 __cdecl Magnum::Audio::Source::unqueueBuffers(class Corrade::Containers::ArrayView<class Corrade::Containers::Reference<class Magnum::Audio::Buffer> >)" (?unqueueBuffers@Source@Audio@Magnum@@QEAA_KV?$ArrayView@V?$Reference@VBuffer@Audio@Magnum@@@Containers@Corrade@@@Containers@Corrade@@@Z)'
hsdk123 commented 4 years ago

What's interesting is that if I explicitly readd

add_compile_definitions(AL_LIBTYPE_STATIC)

then the LNK4217 warnings go away

hsdk123 commented 4 years ago

What's more interesting is that if I do the explicit addition

warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

This also goes away.

mosra commented 4 years ago

Is Magnum recompiled against the openal git master also? To me it looks like MagnumAudio.lib didn't receive the AL_LIBTYPE_STATIC define when being compiled.

With the updated config file in OpenAL Git master and latest FindOpenAL.cmake in magnum, the AL_LIBTYPE_STATIC gets defined for the OpenAL::OpenAL target, so anything linking to it should receive the same definition transitively. With that, I don't think there's anything else left to be done on Magnum side -- for current stable OpenAL Soft you'll need to pass AL_LIBTYPE_STATIC from your side (either by add_compile_definitions(), or by passing a -D flag to the compiler etc.); for OpenAL Soft Git master this will be done automatically. Other than that, Magnum on its own can't reliably detect if the OpenAL lib is static, so it can't do anything more about this.

hsdk123 commented 4 years ago

Just for reference, I've been trying repeatedly over the last couple of weeks to get things to compile on msvc without the warnings, but it doesn't seem to happen without manually defining AL_LIBTYPE_STATIC.

I'm unsure as to why this is happening, but I understand that there might not be anything else possible through magnum automatically. I'll reopen this if I can maybe find a workaround, as of now, I can agree this might not be high priority.

mosra commented 4 years ago

OK, let's keep this open until it's fully resolved :) ... or at least until next stable OpenAL soft is released, with the define correctly exposed.