Closed Jammyjamjamman closed 1 year ago
Some problems I found so far:
hardcoding the path to libvlc allows vlc-based project to build, so vlc nuget is a valid project.
Managed to build libglest (vs2019), but I had to copy some headers out of SDL2 directory in vcpkg folder and I had to manually specify lib directories.
Linked everything and glest_game appears to build, but the linker leaves me with 3300 + errors (mostly "unresolved external symbol").
Now using libglew from nuget, because version from vcpkg is too new.
Build gets so far then fails catastrophically at linking https://gist.github.com/Jammyjamjamman/76e31e6a61af5f1cb491010cbe4fb714
I made a second attempt at building on windows with vcpkg, with no luck 👎 . I get these errors currently:
1>libglest.lib(miniupnpc.obj) : error LNK2019: unresolved external symbol __imp_ssdpDiscoverDevices referenced in function upnpDiscoverDevices
1>SDL2.lib(hid.c.obj) : error LNK2019: unresolved external symbol __imp_SetupDiEnumDeviceInfo referenced in function hid_enumerate
1>SDL2.lib(hid.c.obj) : error LNK2019: unresolved external symbol __imp_SetupDiDestroyDeviceInfoList referenced in function hid_enumerate
1>SDL2.lib(hid.c.obj) : error LNK2019: unresolved external symbol __imp_SetupDiEnumDeviceInterfaces referenced in function hid_enumerate
1>SDL2.lib(hid.c.obj) : error LNK2019: unresolved external symbol __imp_SetupDiGetDeviceInterfaceDetailA referenced in function hid_enumerate
1>SDL2.lib(hid.c.obj) : error LNK2019: unresolved external symbol __imp_SetupDiGetClassDevsA referenced in function hid_enumerate
1>SDL2.lib(hid.c.obj) : error LNK2019: unresolved external symbol __imp_SetupDiGetDeviceRegistryPropertyA referenced in function hid_enumerate
1>path\to\megaglest-source\mk\windoze\x64\Debug\\megaglest.exe : fatal error LNK1120: 7 unresolved externals
1> 22 Warning(s)
1> 8 Error(s)
1>
1>Time Elapsed 00:00:02.46
StopOnFirstBuildError: Build cancelled because project "glest_game" failed to build.
Build has been canceled.
I have no idea what I'm doing at this point. Some forum posts online would suggest additional libs need linking, but who knows what the right libs to link are or how you find out which need linking. There's no online help for these specific link errors, afaik.
Anyone else wants to give it a try with what I've done can look at this branch https://github.com/MegaGlest/megaglest-source/tree/vcpkg_build Also checkout this: https://github.com/MegaGlest/megaglest-source/blob/vcpkg_build/mk/windoze/megaglest_vs2019.txt
It seems that there are many reasons for these so-called LNK2019 warnings. Whoever works on this next might get some hints at https://stackoverflow.com/questions/19886397/how-to-solve-the-error-lnk2019-unresolved-external-symbol-function
This was one of my favorite answers ;)
it turned out i was using .c files with .cpp files. renaming .c to .cpp solved my problem.
I've pushed some more changes to https://github.com/MegaGlest/megaglest-source/tree/vcpkg_build
Megaglest now builds, but fails to run. All that happens is the game starts, the loading spinner flickers, and I get this in console:
> .\megaglest
megaglest.exe v3.13-dev
Compiled using: VC++: 1926 [64bit] platform: Windows-X64 endianness: little
GIT: [Rev: $5608.a3c8464$] - using STREFLOP [SSE] - [no-denormals]
***WARNING*** Windows network throttling is enabled, value: 10
Please set: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile
Key: NetworkThrottlingIndex to the value: FFFFFFFF
The game then ends. No other info is provided. This maybe because I'm building with /MT
, not /MTd
(multithreaded, without debug).
I ran it in verbose to get some more info, but nothing obviously suspicious:
.\megaglest.exe --verbose
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 521]
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 529] About to validate SSE support
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 576] sse check got [1,1,1,1,1,1,1,1,1,1,0,1,0]
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 633]
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 637]
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 656]
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 663]
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 665]
In [C:\Users\blues\git_repos\megaglest-source\source\shared_lib\include\platform\sdl\platform_main.h::mainSetup Line: 668]
SocketManager calling WSAStartup...
In [util.cpp::Shared::Util::SystemFlags::setupRequiredMembers Line: 227]
In [util.cpp::Shared::Util::SystemFlags::init Line: 246]
In [util.cpp::Shared::Util::SystemFlags::init Line: 268]
In [simple_threads.cpp::Shared::PlatformCommon::LogFileThread::execute Line: 681]
In [simple_threads.cpp::Shared::PlatformCommon::LogFileThread::execute Line: 689]
In [util.cpp::Shared::Util::SystemFlags::init Line: 277]
In [util.cpp::Shared::Util::SystemFlags::initHTTP Line 190] calling curl_global_init
In [util.cpp::Shared::Util::SystemFlags::initHTTP Line 193] curl_global_init called and returned: result 0 [No error]
In [util.cpp::Shared::Util::SystemFlags::initHTTP Line 197] calling curl_easy_init
In [util.cpp::Shared::Util::SystemFlags::initHTTP Line 203] handle = 000000000052A8A8
In [util.cpp::Shared::Util::SystemFlags::initHTTP Line 206] handle = 000000000052A8A8
megaglest.exe v3.13-dev
Compiled using: VC++: 1926 [64bit] platform: Windows-X64 endianness: little
Endian value = 111
Endian to common value = 111
Endian from common value = 111
int8 sizeof = 1
SwitchSetupRequest sizeof = 401
GIT: [Rev: $5608.a3c8464$] - using STREFLOP [SSE] - [no-denormals]
***WARNING*** Windows network throttling is enabled, value: 10
Please set: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile
Key: NetworkThrottlingIndex to the value: FFFFFFFF
-=-=-=-=-=-=-= looking for file in possible location [C:\Program Files (x86)\MegaGlest\]
-=-=-=-=-=-=-= looking for windows specific file in possible location [C:\Program Files (x86)\MegaGlest\windows_glest.ini]
foundPath = [1]
-=-=-=-=-=-=-= About to load fileName.first = [C:\Program Files (x86)\MegaGlest\glest.ini]
Property key [DataPath] now has value [C:\Program Files (x86)\MegaGlest\] original_value [$APPLICATIONDATAPATH\]
Property key [LogPath] now has value [C:\Users\blues\AppData\Roaming\megaglest\] original_value [$APPDATA\megaglest\]
Property key [UserData_Root] now has value [C:\Users\blues\AppData\Roaming\megaglest\] original_value [$APPDATA\megaglest\]
-=-=-=-=-=-=-= About to load fileName.second = [C:\Users\blues\AppData\Roaming\megaglest\glestuser.ini]
Using ini specified data path [C:\Program Files (x86)\MegaGlest\]
Using ini specified logs path [C:\Users\blues\AppData\Roaming\megaglest\]
Looking for [] in
#1: []
#2: [C:\Users\blues\AppData\Roaming\megaglest\]
#3: [C:\Program Files (x86)\MegaGlest\]
result [C:\Users\blues\AppData\Roaming\megaglest\]
Steps to reproduce what I've done so far:
./vcpkg integrate install
option too).vcpkg install sdl2pp:x64-windows-static ftgl:x64-windows-static libjpeg-turbo:x64-windows-static curl:x64-windows-static openal-soft:x64-windows-static libvorbis:x64-windows-static lua:x64-windows-static miniupnpc:x64-windows-static glew:x64-windows-static xerces-c:x64-windows-static openssl:x64-windows-static
VCPKG_ROOT
. Set this variable to the directory in which your git clone of vcpkg is located.libircclient.lib
and libircclient.dll
to megaglest-source\source\windows_deps_2015\lib\
.megaglest-source/mk/windoze/vc2015
. (I have actually upgraded it to a 2019 project.)glest_game
project. The final binary will be located in megaglest-source\mk\windoze\x64\Debug
.These steps will successfully build megaglest, but it will not run properly and there will be no errors. I tried copying and running it in the same directory as my standard megaglest installation and running it with --verbose
, which produced the log I shared above.
I have been re-attempting this, with a lot more success (mainly thanks to @andy5995 ). Decided to try and build using cmake: https://github.com/MegaGlest/megaglest-source/tree/windows-cmake-build-testing
This uses vcpkg+cmake+msbuild. I tested it using visual studio c++ tools + vscode. It's quite nice because you don't have to install the visual studio ide. You can compile it by running vcpkg+cmake+msbuild commands.
I had some problems with the function stackdumper()
. But I think that's due to some incorrect macros in the code. (If debug is set, the code for stackdumper()
is never generated. But stackdumper()
is still called.)
My next plan is to make a new branch, with the cmake corrected properly, rather than just hacked. Hopefully can create debug+release build options, rather than just debug.
Windows builds now built in gh actions.
Creating a ticket here to keep track of building on appveyor.
Problems with package manager
Libs which are not available on vcpkg:
So the package I think that is the biggest problem is libircclient