Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AppVeyor CI - Windows builds #192

Open
Jammyjamjamman opened this issue Nov 16, 2019 · 11 comments
Open

AppVeyor CI - Windows builds #192

Jammyjamjamman opened this issue Nov 16, 2019 · 11 comments

Comments

@Jammyjamjamman
Copy link
Contributor

@Jammyjamjamman Jammyjamjamman commented Nov 16, 2019

Creating a ticket here to keep track of building on appveyor.

Problems with package manager

Libs which are not available on vcpkg:

  • google-breakpad (breakpad is available, so I download this)
  • include (this looks like a custom dir full of headers for megaglest to link libs)
  • lib (looks like another custom megaglest dir full of various libs)
  • libircclient (this is a problem)
  • lpng (using libpng instead)
  • direct x sdk (is this necessary?)
  • vlc (I'm downloading this using nuget instead, we'll see if that works)

So the package I think that is the biggest problem is libircclient

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Nov 17, 2019

Some problems I found so far:

  • RTCc checks (type coercion problem detection) were preventing builds succeeding - solved (switch it off)
  • Some headers e.g. any sdl header does not link properly with vcpkg because e.g. SDL.h -> sdl2/SDL.h (unsolved)
  • Cannot link libvlc from nuget package to project (unsolved, but the header file is there so I don't know what's wrong.)
  • libircclient is only available on sourceforge (unsolved)

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Nov 17, 2019

hardcoding the path to libvlc allows vlc-based project to build, so vlc nuget is a valid project.

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Nov 17, 2019

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.

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Nov 17, 2019

Linked everything and glest_game appears to build, but the linker leaves me with 3300 + errors (mostly "unresolved external symbol").

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Nov 17, 2019

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

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Jul 1, 2020

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

@andy5995
Copy link
Contributor

@andy5995 andy5995 commented Jul 1, 2020

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.

https://stackoverflow.com/a/37634287/6838037

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Jul 3, 2020

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).

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Jul 3, 2020

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\]

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented Jul 3, 2020

Steps to reproduce what I've done so far:

  1. Get Visual studio 2019 https://visualstudio.microsoft.com/downloads/ Install with the windows c++ development tools.
  2. Pull this project https://github.com/MegaGlest/megaglest-source/tree/vcpkg_build
  3. Get vcpkg: https://github.com/microsoft/vcpkg Follow the instructions to install. (You must use the ./vcpkg integrate install option too).
  4. install packages with vcpkg: 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
  5. Add a new environment variable to windows: VCPKG_ROOT. Set this variable to the directory in which your git clone of vcpkg is located.
  6. Get libircclient: https://sourceforge.net/projects/libircclient/files/libircclient/1.10/ Extract libircclient.lib and libircclient.dll to megaglest-source\source\windows_deps_2015\lib\.
  7. Open the solution in megaglest-source/mk/windoze/vc2015. (I have actually upgraded it to a 2019 project.)
  8. Build 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.

@Jammyjamjamman
Copy link
Contributor Author

@Jammyjamjamman Jammyjamjamman commented May 16, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants