Open TheCycoONE opened 5 months ago
Thanks for the report and the trace logs. So, yes, there is a copy paste error in this line
which should be PC_GOBJECT2
. Then, the INTERFACE_LINK_DIRECTORIES
property of the GLib2::gobject-2
should be populated correctly. However, this target is unused, as the vcpkg version of fluidsynth seems to have been built without libinstpatch support, so it doesn't matter.
The problem of the build log you have linked is
LINK : fatal error LNK1104: cannot open file 'intl.lib'
However, all the cmake-related places I see in that log is where intl.lib
is referenced by absolute path. Yet, the linker search path is obviously missing in the build command, and I currently don't see why. _glib2_link_directories
is correctly populated and propagated to the target (see 2024-06-16T02:28:36.0189181Z
).
@pedrolcl might have a look, maybe I'm missing something.
2024-06-16T02:28:36.0189181Z D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/share/fluidsynth/FindGLib2.cmake(161): set_target_properties(GLib2::glib-2 PROPERTIES IMPORTED_LOCATION D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib/glib-2.0.lib INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/include/glib-2.0;D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib/glib-2.0/include INTERFACE_LINK_LIBRARIES intl;iconv;ws2_32;winmm;pcre2-8 INTERFACE_LINK_DIRECTORIES D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib/pkgconfig/../../lib )
sets the relative path intl.lib, iconv.lib, pcre2-8.lib on GLib2::glib-2. It has an INTERFACE_LINK_DIRECTOREIS, but that's lost and only the INTERFACE_LINK_LIBRARIES are passed on in FluidSynthTargets.cmake
2024-06-16T02:28:36.2903786Z D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/share/fluidsynth/FluidSynthTargets.cmake(60): set_target_properties(FluidSynth::libfluidsynth-OBJ PROPERTIES INTERFACE_LINK_LIBRARIES dsound;ksuser;winmm;winmm;ksuser;ole32;ws2_32;Threads::Threads;GLib2::glib-2;GLib2::gthread-2;SndFile::sndfile )
sets those libraries on FluidSynth::libfluidsynth-OBJ
then 2024-06-16T02:28:36.2962924Z D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/share/fluidsynth/FluidSynthTargets.cmake(70): set_target_properties(FluidSynth::libfluidsynth PROPERTIES INTERFACE_INCLUDE_DIRECTORIES D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/include INTERFACE_LINK_LIBRARIES $<LINK_ONLY:FluidSynth::libfluidsynth-OBJ> )
links to FluidSynth::libfluidsynth
as I read the trace.
I'm not at all an expert either in cmake or your use case so take this with a grain of salt, but wouldn't it be possible to use IMPORTED_TARGET on the pkg_check_modules call and skip most of the hand coded extraction?
wouldn't it be possible to use IMPORTED_TARGET on the pkg_check_modules call and skip most of the hand coded extraction?
That hand coded extraction in PkgConfigHelpers.cmake gives us control over the target name to use. I.e. if pkgconfig fails to discover that lib, we just create a target with the same name and populate it through the CMake find_package()
logic. Apart from that, CMake's official logic for IMPORTED_TARGET
does not account for private dependencies of a library, whereas our logic does: https://github.com/Kitware/CMake/blob/b83fabd0d3e29247618f6cd8e975894096e17a66/Modules/FindPkgConfig.cmake#L339-L356
I agree that FluidSynthTargets.cmake is the culprit. But it's autogenerated. I need to figure out how to convince cmake to populate the INTERFACE_LINK_DIRECTORIES
or LINK_DIRECTORIES
properties.
Can you pls. try the following:
In FluidSynthTargets.cmake, locate the line
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:FluidSynth::libfluidsynth-OBJ>"
and replace it by
INTERFACE_LINK_LIBRARIES "FluidSynth::libfluidsynth-OBJ"
From my understanding of the docs, the INTERFACE_LINK_DIRECTORIES
should now be queried and propagated from all depending targets.
That edit did not resolve the issue.
I tried a couple other things that didn't help too; the gobject fix mentioned at the top; using target_link_libraries instead of target_set_properties, and setting interface_link_directories with the list of targets, even explicitly setting with:
set_target_properties(FluidSynth::libfluidsynth PROPERTIES
INTERFACE_LINK_DIRECTORIES "C:/Users/User/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib")
So far the only things that have worked are removing fluidsynth :frowning_face:; or explicitly setting the link directory in my own CMakeList.txt on my target.
https://github.com/microsoft/vcpkg/blob/master/ports/qtbase/GLIB2-static.patch may be useful, or maybe a similar patch should be applied upstream by vcpkg.
Please try
set_target_properties(FluidSynth::libfluidsynth PROPERTIES
LINK_DIRECTORIES "C:/Users/User/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib")
the gobject fix mentioned at the top
Please confirm that this fix correctly populates the INTERFACE_LINK_DIRECTORIES
property of the GLib2::gobject-2
target, you have mentioned initially.
Btw, where exactly in CorsixTH is libfluidsynth linked against?
There were two lines that I had to change:
"PC_GOBJECT2" "_gobject2")
originally is missing the G, as well as the line you mentioned.
Changing both of those does fix that line in the cmake trace:
set_target_properties(GLib2::gobject-2 PROPERTIES IMPORTED_LOCATION C:/Users/User/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib/gobject-2.0.lib INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES C:/Users/User/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/include/glib-2.0;C:/Users/User/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib/glib-2.0/include INTERFACE_LINK_LIBRARIES glib-2.0;intl;iconv;ws2_32;winmm;pcre2-8;ffi INTERFACE_LINK_DIRECTORIES C:/Users/User/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib )
For the second question, CorsixTH doesn't directly link fluidsynth but does so indirectly through sdl2_mixer.
From our vcpkg.json
"features": {
"audio": {
"description": "In game audio support",
"dependencies": [
{
"name": "fluidsynth",
"platform": "!osx",
"features": [
"sndfile"
]
},
{
"name": "sdl2-mixer",
"features": [
"libmodplug",
{
"name": "fluidsynth",
"platform": "!osx"
},
"libflac",
"mpg123",
"opusfile"
]
}
]
},
In our CMakeList.txt we do:
if(CORSIX_TH_USE_SDL_MIXER)
if(VCPKG_TARGET_TRIPLET)
find_package(SDL2_mixer CONFIG REQUIRED)
target_link_libraries(
CorsixTH
PRIVATE
$<IF:$<TARGET_EXISTS:SDL2_mixer::SDL2_mixer>,SDL2_mixer::SDL2_mixer,SDL2_mixer::SDL2_mixer-static>)
SDL2_mixer-static-targets.cmake has this line:
set_target_properties(SDL2_mixer::SDL2_mixer-static PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/SDL2"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:>;\$<LINK_ONLY:OpusFile::opusfile>;\$<LINK_ONLY:Vorbis::vorbisfile>;\$<LINK_ONLY:FLAC::FLAC>;\$<LINK_ONLY:modplug::modplug>;\$<LINK_ONLY:libxmp::xmp_static>;\$<LINK_ONLY:MPG123::libmpg123>;\$<LINK_ONLY:FluidSynth::libfluidsynth>;\$<LINK_ONLY:WavPack::WavPack>"
)
There were two lines that I had to change
Ok, thanks, I just committed a fix for this.
For the second question, CorsixTH doesn't directly link fluidsynth but does so indirectly through sdl2_mixer.
Ok, so the next step should be to figure out whether the error lies in fluidsynth logic or in the way how the dependencies are propagated via sdl2_mixer. To do this, I suggest you
find_package(fluidsynth CONFIG REQUIRED)
find_package(SDL2_mixer CONFIG REQUIRED)
i.e. discover fluidsynth via the cmake logic before discovering SDL2_mixer. This will create FluidSynth::libfluidsynth
target and therefore should prevent SDL2_mixer from messing with that target. Try to build.
If it fails, it might be necessary to explicitly link against liblfuidsynth
target_link_libraries(
CorsixTH
PRIVATE
$<IF:$<TARGET_EXISTS:SDL2_mixer::SDL2_mixer>,SDL2_mixer::SDL2_mixer,SDL2_mixer::SDL2_mixer-static,FluidSynth::libfluidsynth>)
If that works, I'd say that the dependencies and their linker directories are correctly exposed by fluidsynth and the problem needs to be deferred to SDL2_mixer.
If that doesn't work, the error clearly lies in fluidsynth. In this case please post the attach the fluidsynth.pc
, sdl2-mixer.pc
, glib-2.0.pc
, SDL2_mixer-static-targets.cmake
and FluidSynthTargets.cmake
files.
@pedrolcl might have a look, maybe I'm missing something.
@derselbst I've tried to reproduce the problem with this minimal project using SDL and SDL_mixer with Fluidsynth dependency. It can be linked statically with vcpkg dependencies without issues.
Here are the installed vcpkg packages:
C:\Users\plcl\Projects\vcpkg>vcpkg.exe list x64-windows-static
dirent:x64-windows-static 1.24 Dirent is a C/C++ programming interface that all...
fluidsynth:x64-windows-static 2.3.5 FluidSynth reads and handles MIDI events from th...
gettext-libintl:x64-windows-static 0.22.5#1 The libintl C library from GNU gettext-runtime.
gettext:x64-windows-static 0.22.5#1 A GNU framework to help produce multi-lingual me...
glib:x64-windows-static 2.78.4#3 Portable, general-purpose utility library.
libffi:x64-windows-static 3.4.6 Portable, high level programming interface to va...
libiconv:x64-windows-static 1.17#3 GNU Unicode text conversion
libogg:x64-windows-static 1.3.5#1 Ogg is a multimedia container format, and the na...
libpng:x64-windows-static 1.6.43#2 libpng is a library implementing an interface fo...
libvorbis:x64-windows-static 1.3.7#3 Ogg Vorbis is a fully open, non-proprietary, pat...
pcre2:x64-windows-static 10.43 Regular Expression pattern matching using the sa...
pcre2[jit]:x64-windows-static Enable support for Just-In-Time compiling regex ...
pcre2[platform-default-features]:x64-windows-st... Enable default features
sdl2-image:x64-windows-static 2.8.2#2 SDL_image is an image file loading library. It l...
sdl2-mixer:x64-windows-static 2.8.0#3 Multi-channel audio mixer library for SDL.
sdl2-mixer[fluidsynth]:x64-windows-static Use FluidSynth to play MIDI audio format.
sdl2-mixer[wavpack]:x64-windows-static Enable WavPack music.
sdl2:x64-windows-static 2.30.3#1 Simple DirectMedia Layer is a cross-platform dev...
wavpack:x64-windows-static 5.6.0#2 WavPack encode/decode library, command-line prog...
zlib:x64-windows-static 1.3.1 A compression library
I am too busy to debug other people buildsystems right now.
@pedrolcl I can reproduce with your project.
Checkout https://github.com/TheCycoONE/sdlmixtest/tree/repo (repo branch of my fork). I just added the vcpkg files and CMakePresets.
The x64 version does not reproduce (CorsixTH also sometimes works on my local for x64, though never in the GitHub action pipeline - I haven't figured out the criteria but this is another data point) The x86 version does reproduce.
From the root of the repo run:
cmake --preset win-x86-rel cmake --build --preset win-x86-rel
PS C:\Users\User\sdlmixtest> cmake --build --preset win-x86-rel
MSBuild version 17.9.8+b34f75857 for .NET Framework
1>Checking Build System
Building Custom Rule C:/Users/User/sdlmixtest/CMakeLists.txt
LINK : fatal error LNK1104: cannot open file 'pcre.lib' [C:\Users\User\sdlmixtest\build\win-x86-rel\sdlmixtest.vcxproj]
PS C:\Users\User\sdlmixtest>
From the vcproj:
vcpkg_installed\x86-windows-static\lib\SDL2-static.lib;vcpkg_installed\x86-windows-static\lib\SDL2_image-static.lib;vcpkg_installed\x86-windows-static\lib\SDL2_mixer-static.lib;kernel32.lib;user32.lib;gdi32.lib;imm32.lib;oleaut32.lib;version.lib;uuid.lib;advapi32.lib;setupapi.lib;shell32.lib;dinput8.lib;vcpkg_installed\x86-windows-static\lib\libpng16.lib;vcpkg_installed\x86-windows-static\lib\zlib.lib;vcpkg_installed\x86-windows-static\lib\vorbisfile.lib;vcpkg_installed\x86-windows-static\lib\vorbis.lib;vcpkg_installed\x86-windows-static\lib\ogg.lib;vcpkg_installed\x86-windows-static\lib\libfluidsynth.lib;dsound.lib;ksuser.lib;ole32.lib;vcpkg_installed\x86-windows-static\debug\lib\gthread-2.0.lib;vcpkg_installed\x86-windows-static\debug\lib\glib-2.0.lib;winmm.lib;ws2_32.lib;vcpkg_installed\x86-windows-static\debug\lib\intl.lib;vcpkg_installed\x86-windows-static\debug\lib\iconv.lib;vcpkg_installed\x86-windows-static\debug\lib\charset.lib;pcre.lib;vcpkg_installed\x86-windows-static\lib\libwavpack.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib
So this is a slightly different variant where glib2 is fine, only pcre is impacted.
Actually glib2 doesn't look exactly fine since it's mixing debug versions with release versions...
On the x64-windows-static triplet I'm getting the same mixed debug/release issue but no missing library paths.
Link:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\User\sdlmixtest\build\win6
4\RelWithDebInfo\sdlmixtest.exe" /INCREMENTAL /ILK:"sdlmixtest.dir\RelWithDebInfo\sdlmixtest.ilk" /NOLOGO "vcpkg_installed\x64-windows-static\lib\SDL2-static.lib" "vcp
kg_installed\x64-windows-static\lib\SDL2_image-static.lib" "vcpkg_installed\x64-windows-static\lib\SDL2_mixer-static.lib" kernel32.lib user32.lib gdi32.lib imm32.lib o
leaut32.lib version.lib uuid.lib advapi32.lib setupapi.lib shell32.lib dinput8.lib "vcpkg_installed\x64-windows-static\lib\libpng16.lib" "vcpkg_installed\x64-windows-s
tatic\lib\zlib.lib" "vcpkg_installed\x64-windows-static\lib\vorbisfile.lib" "vcpkg_installed\x64-windows-static\lib\vorbis.lib" "vcpkg_installed\x64-windows-static\lib
\ogg.lib" "vcpkg_installed\x64-windows-static\lib\libfluidsynth.lib" dsound.lib ksuser.lib ole32.lib "vcpkg_installed\x64-windows-static\debug\lib\gthread-2.0.lib" "vc
pkg_installed\x64-windows-static\debug\lib\glib-2.0.lib" winmm.lib ws2_32.lib "vcpkg_installed\x64-windows-static\debug\lib\intl.lib" "vcpkg_installed\x64-windows-stat
ic\debug\lib\iconv.lib" "vcpkg_installed\x64-windows-static\debug\lib\charset.lib" "vcpkg_installed\x64-windows-static\lib\pcre2-8.lib" "vcpkg_installed\x64-windows-st
atic\lib\libwavpack.lib" kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"l
evel='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Users/User/sdlmixtest/build/win64/RelWithDebInfo/sdlmixtest.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMI
CBASE /NXCOMPAT /IMPLIB:"C:/Users/User/sdlmixtest/build/win64/RelWithDebInfo/sdlmixtest.lib" /MACHINE:X64 /machine:x64 sdlmixtest.dir\RelWithDebInfo\example.obj
Creating library C:/Users/User/sdlmixtest/build/win64/RelWithDebInfo/sdlmixtest.lib and object C:/Users/User/sdlmixtest/build/win64/RelWithDebInfo/sdlmixtest.exp
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library [C:\Users\User\sdlmixtest\build\win64\sdlmixtest.vcxproj]
glib-2.0.lib(gtestutils.c.obj) : error LNK2019: unresolved external symbol _CrtSetReportFile referenced in function g_test_init [C:\Users\User\sdlmixtest\build\win64\sdl
mixtest.vcxproj]
glib-2.0.lib(gtestutils.c.obj) : error LNK2019: unresolved external symbol _CrtSetReportMode referenced in function g_test_init [C:\Users\User\sdlmixtest\build\win64\sdl
mixtest.vcxproj]
glib-2.0.lib(glib-private.c.obj) : error LNK2001: unresolved external symbol _CrtSetReportMode [C:\Users\User\sdlmixtest\build\win64\sdlmixtest.vcxproj]
C:\Users\User\sdlmixtest\build\win64\RelWithDebInfo\sdlmixtest.exe : fatal error LNK1120: 2 unresolved externals [C:\Users\User\sdlmixtest\build\win64\sdlmixtest.vcxproj
]
Done Building Project "C:\Users\User\sdlmixtest\build\win64\sdlmixtest.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\User\sdlmixtest\build\win64\ALL_BUILD.vcxproj" (default targets) -- FAILED.
Build FAILED.
I don't use the Visual Stupido Code or the siblings. I have installed only the MSVC 2019 command line build tools. As IDE, I use Qt Creator. I don't need a CMakePresets.json, the settings are provided by QtCreator.
In case of VCPKG, I install the libraries I need, for instance in this case for x86 static:
C:\Users\plcl\Projects\vcpkg>vcpkg.exe list x86-windows-static
dirent:x86-windows-static 1.24 Dirent is a C/C++ programming interface that all...
fluidsynth:x86-windows-static 2.3.5 FluidSynth reads and handles MIDI events from th...
fluidsynth[sndfile]:x86-windows-static Enable rendering to file and SF3 support
gettext-libintl:x86-windows-static 0.22.5#1 The libintl C library from GNU gettext-runtime.
gettext:x86-windows-static 0.22.5#1 A GNU framework to help produce multi-lingual me...
glib:x86-windows-static 2.78.4#3 Portable, general-purpose utility library.
libffi:x86-windows-static 3.4.6 Portable, high level programming interface to va...
libflac:x86-windows-static 1.4.3#2 Library for manipulating FLAC files
libflac[stack-protector]:x86-windows-static Build with stack smashing protection
libiconv:x86-windows-static 1.17#3 GNU Unicode text conversion
libogg:x86-windows-static 1.3.5#1 Ogg is a multimedia container format, and the na...
libpng:x86-windows-static 1.6.43#2 libpng is a library implementing an interface fo...
libsndfile:x86-windows-static 1.2.2 A library for reading and writing audio files
libsndfile[external-libs]:x86-windows-static Enable FLAC, Vorbis, and Opus codecs
libsndfile[mpeg]:x86-windows-static Enable MPEG codecs
libvorbis:x86-windows-static 1.3.7#3 Ogg Vorbis is a fully open, non-proprietary, pat...
mp3lame:x86-windows-static 3.100#14 LAME is a high quality MPEG Audio Layer III (MP3...
mpg123:x86-windows-static 1.31.3#4 mpg123 is a real time MPEG 1.0/2.0/2.5 audio pla...
opus:x86-windows-static 1.5.1 Totally open, royalty-free, highly versatile aud...
pcre2:x86-windows-static 10.43 Regular Expression pattern matching using the sa...
pcre2[jit]:x86-windows-static Enable support for Just-In-Time compiling regex ...
pcre2[platform-default-features]:x86-windows-st... Enable default features
sdl2-image:x86-windows-static 2.8.2#2 SDL_image is an image file loading library. It l...
sdl2-mixer:x86-windows-static 2.8.0#3 Multi-channel audio mixer library for SDL.
sdl2-mixer[fluidsynth]:x86-windows-static Use FluidSynth to play MIDI audio format.
sdl2-mixer[wavpack]:x86-windows-static Enable WavPack music.
sdl2:x86-windows-static 2.30.3#1 Simple DirectMedia Layer is a cross-platform dev...
wavpack:x86-windows-static 5.6.0#2 WavPack encode/decode library, command-line prog...
zlib:x86-windows-static 1.3.1 A compression library
Here is the output of CMake, when run from Qt Creator:
Two relevant arguments (among others) are:
[cmake] Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Users/plcl/Projects/SDLMixTest -B C:/Users/plcl/Projects/SDLMixTest/build/MSVC2019_x86-Release "-DCMAKE_GENERATOR:STRING=Ninja" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=C:\Users\plcl\Projects\SDLMixTest\build\MSVC2019_x86-Release/.qtc/package-manager/auto-setup.cmake" "-DQT_QMAKE_EXECUTABLE:FILEPATH=C:/Users/plcl/Projects/vcpkg/installed/x86-windows/tools/qt5/bin/qmake.exe" "-DCMAKE_PREFIX_PATH:PATH=C:/Users/plcl/Projects/vcpkg/installed/x86-windows-static" "-DCMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX86/x86/cl.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX86/x86/cl.exe" "-DCMAKE_CXX_FLAGS_INIT:STRING=" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" in C:\Users\plcl\Projects\SDLMixTest\build\MSVC2019_x86-Release.
[cmake] -- The C compiler identification is MSVC 19.29.30151.0
[cmake] -- The CXX compiler identification is MSVC 19.29.30151.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX86/x86/cl.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/HostX86/x86/cl.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Found ZLIB: C:/Users/plcl/Projects/vcpkg/installed/x86-windows-static/lib/zlib.lib (found version "1.3.1")
[cmake] -- Found PNG: C:/Users/plcl/Projects/vcpkg/installed/x86-windows-static/lib/libpng16.lib (found version "1.6.43")
[cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
[cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
[cmake] -- Looking for pthread_create in pthreads
[cmake] -- Looking for pthread_create in pthreads - not found
[cmake] -- Looking for pthread_create in pthread
[cmake] -- Looking for pthread_create in pthread - not found
[cmake] -- Found Threads: TRUE
[cmake] -- Found GLib2: C:/Users/plcl/Projects/vcpkg/installed/x86-windows-static/lib/glib-2.0.lib (found suitable version "2.78.4", minimum required is "2.6.5")
[cmake] CMake Warning at C:/Users/plcl/Projects/vcpkg/installed/x86-windows-static/share/libffi/libffiConfig.cmake:2 (message):
[cmake] find_package(libffi) is deprecated.
[cmake]
[cmake] libffi can be imported via CMake FindPkgConfig module:
[cmake]
[cmake]
[cmake]
[cmake] find_package(PkgConfig)
[cmake] pkg_check_modules(LIBFFI REQUIRED IMPORTED_TARGET libffi)
[cmake] target_link_libraries(main PRIVATE PkgConfig::LIBFFI)
[cmake]
[cmake]
[cmake]
[cmake] vcpkg provides proprietary CMake targets:
[cmake]
[cmake]
[cmake]
[cmake] find_package(unofficial-libffi CONFIG REQUIRED)
[cmake] target_link_libraries(main PRIVATE unofficial::libffi::libffi)
[cmake]
[cmake] Call Stack (most recent call first):
[cmake] C:/Users/plcl/Projects/vcpkg/installed/x86-windows-static/share/fluidsynth/FindGLib2.cmake:214 (find_package)
[cmake] C:/Qt/Tools/CMake_64/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
[cmake] C:/Users/plcl/Projects/vcpkg/installed/x86-windows-static/share/fluidsynth/FluidSynthConfig.cmake:75 (find_dependency)
[cmake] C:/Qt/Tools/CMake_64/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
[cmake] C:/Users/plcl/Projects/vcpkg/installed/x86-windows-static/share/SDL2_mixer/SDL2_mixerConfig.cmake:90 (find_dependency)
[cmake] CMakeLists.txt:7 (find_package)
[cmake]
[cmake]
[cmake] -- Configuring done (5.0s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: C:/Users/plcl/Projects/SDLMixTest/build/MSVC2019_x86-Release
[cmake]
[cmake] Elapsed time: 00:05.
And finally the build process:
21:23:32: Running steps for project sdlmixtest...
21:23:32: Starting: "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build C:/Users/plcl/Projects/SDLMixTest/build/MSVC2019_x86-Release --target all
Change Dir: 'C:/Users/plcl/Projects/SDLMixTest/build/MSVC2019_x86-Release'
Run Build Command(s): C:/PROGRA~2/MICROS~2/2019/COMMUN~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe -v all
[1/2 1.2/sec] C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\HostX86\x86\cl.exe /TP -DMUSIC_FILE=test.mid -DSOUNDFONT_FILE=C:/ProgramData/soundfonts/default.sf2 -external:IC:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\include -external:IC:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\include\SDL2 -external:W0 /DWIN32 /D_WINDOWS /GR /EHsc /O2 /Ob2 /DNDEBUG -MT /showIncludes /FoCMakeFiles\sdlmixtest.dir\example.cpp.obj /FdCMakeFiles\sdlmixtest.dir\ /FS -c C:\Users\plcl\Projects\SDLMixTest\example.cpp
Compilador de optimizaci¢n de C/C++ de Microsoft (R) versi¢n 19.29.30151 para x86
(C) Microsoft Corporation. Todos los derechos reservados.
[2/2 1.5/sec] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Qt\Tools\CMake_64\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\sdlmixtest.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x86\mt.exe --manifests -- C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx86\x86\link.exe CMakeFiles\sdlmixtest.dir\example.cpp.obj /out:sdlmixtest.exe /implib:sdlmixtest.lib /pdb:sdlmixtest.pdb /version:0.0 /machine:X86 /INCREMENTAL:NO /subsystem:console -LIBPATH:C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\SDL2-static.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\SDL2_image-static.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\SDL2_mixer-static.lib kernel32.lib user32.lib gdi32.lib imm32.lib oleaut32.lib version.lib uuid.lib advapi32.lib setupapi.lib shell32.lib dinput8.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\libpng16.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\zlib.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\vorbisfile.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\libfluidsynth.lib dsound.lib ksuser.lib ole32.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\glib-2.0.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\gthread-2.0.lib glib-2.0.lib intl.lib iconv.lib winmm.lib ws2_32.lib pcre2-8.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\sndfile.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\vorbisenc.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\vorbis.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\FLAC.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\ogg.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\opus.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\mpg123.lib shlwapi.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\libmp3lame-static.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\libmpghip-static.lib C:\Users\plcl\Projects\vcpkg\installed\x86-windows-static\lib\libwavpack.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
21:23:34: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited normally.
21:23:34: Elapsed time: 00:01.
No errors in this build.
One point of clarification, the above does not use Visual Studio Code, it's just using vcpkg with the recommended CMake setup: https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-powershell
FluidSynth version
2.3.5
Describe the bug
When building a program that statically links fluidsynth and and uses static linkage on windows with vcpkg the libraries added by FindGLib2 do not contain their absolute path, and linking may fail. e.g.:
D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/share/fluidsynth/FindGLib2.cmake(219): set_target_properties(GLib2::gobject-2 PROPERTIES IMPORTED_LOCATION D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib/gobject-2.0.lib INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/include/glib-2.0;D:/a/CorsixTH/CorsixTH/build/win-x64-rel/vcpkg_installed/x64-windows-static-release/lib/glib-2.0/include INTERFACE_LINK_LIBRARIES libffi;GLib2::glib-2 INTERFACE_LINK_DIRECTORIES )
The same is true for the pcre dependency.
Expected behavior
I would expect all libraries found to have their absolute path so that they can be linked properly.
Additional context
A cmake run with tracing is logged here: https://github.com/CorsixTH/CorsixTH/actions/runs/9532652685/job/26274993008
Related vcpkg ticket: https://github.com/microsoft/vcpkg/issues/36139