Compiling 0.4.10.2 with VS2019 fails

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
zimmer
Space Krill
Posts: 8
Joined: Wed Jun 08, 2022 8:11 pm
Location: Heidelberg

Compiling 0.4.10.2 with VS2019 fails

#1 Post by zimmer »

Hello, first thanks for creating this project. I visited your website and watched a youtube vid, it does seem interesting for an old MOO2 veteran.

I downloaded your SDK and followed the steps for building via Visual Studio .sln.

However the build generates lots of warnings of missing symbols. It seems the linker can't find the proper library files. Checking the project settings somehow isn't showing the proper input paths. I can try to fix this manually. What is the supposed order in which the projects have to build, and where is the linker supposed to find the libraries?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Compiling 0.4.10.2 with VS2019 fails

#2 Post by Geoff the Medio »

What version of the SDK are you building v0.4.10.2 with?

I believe it should be SDK11 (Win32), not SDK12 or master.
1) download and unzip https://github.com/freeorion/freeorion- ... es/tag/v11 (The v0.4.10 build instructions mention this version specifically)
2) run bootstrap.bat or otherwise check out the source
3) switch to the v0.4.10 branch, the latest commits in which should be v0.4.10.2
4) open a .sln file in Visual Studio
5) if using the MSVC 2019 solution file without the Win8.1 SDK installed, select all the projects and in the project properties and change their Windows SDK version to 10. MSVC 2019 should have the Win10 SDK by default.

Just tested and works for me. The solution has the project inter-dependencies / order already set up so needed stuff (Common, Parsers, GiGi) is built before stuff that needs them (client, server, AIs). The project files look for dependencies where they are located after bootstrap.bat is run, which is mostly up a few directory levels. If you don't run it, you can instead generate a project file with CMake, which will expect the SDK contents in their location before bootstrap.bat is run, but I didn't test this just now.

zimmer
Space Krill
Posts: 8
Joined: Wed Jun 08, 2022 8:11 pm
Location: Heidelberg

Re: Compiling 0.4.10.2 with VS2019 fails

#3 Post by zimmer »

Thanks for your explanations.

I visited freeorion.org and on the main page on the right is a box that refers to 0.4.10.2 been released. In this section is a link called Compile that takes me to https://freeorion.org/index.php/Compile. And there is a link to build instructions that takes me to https://github.com/freeorion/freeorion/ ... r/BUILD.md. This says "Download the [FreeOrionSDK v12] from the FreeOrionSDK respository releases".

I tried the installation and built with git core.autocrlf set to false and true, both causing the same behaviour.

It seems there is only something with the linker input path not set up properly (see the attached log). My guess is that the %(AdditionalDependencies) variable is not resolved. It can't be that difficult to fix if I knew where it is supposed to point.
Attachments
build_messages.txt
(5 MiB) Downloaded 91 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Compiling 0.4.10.2 with VS2019 fails

#4 Post by Geoff the Medio »

zimmer wrote: Thu Jun 09, 2022 1:51 pmhttps://freeorion.org/index.php/Compile.
That is general page about compiling FreeOrion, and gives links that will work for the latest master. If you want to build v0.4.10.2 then you'll need to use the instructions for that branch / that release, which are at: https://github.com/freeorion/freeorion/ ... 0/BUILD.md which says to use the v11 SDK.
I tried the installation
What does "tried the installation" mean? Of what? What version? How?
and built with git core.autocrlf set to false and true, both causing the same behaviour.
I don't know what that is / does but I doubt it's relevant.
It seems there is only something with the linker input path not set up properly (see the attached log).
Based on the log, it looks like you're using the x64 version of the SDK version 11 to build a FreeOrion in Win32 mode.

The v0.4.10.2 project files were set up to build in Win32 / x86 platform mode, and x64 wasn't set up or tested.

You should probably get the Win32 SDK and use that to build against.

It's probably possible to build v0.4.10.2 in x64 platform mode, but the project files aren't set up for it, and even if they were, you'd need to switch the solution configuration in Visual Studio from the default Win32 to x64.

If you really want to build in x64 mode, the master version project files are set up for x64 and have been tested with the version 12 SDK.

zimmer
Space Krill
Posts: 8
Joined: Wed Jun 08, 2022 8:11 pm
Location: Heidelberg

Re: Compiling 0.4.10.2 with VS2019 fails

#5 Post by zimmer »

I followed your instructions from your first reply now, i.e. downloaded v11 SDK for the win32 platform.

There was one line I skipped because it was not clear:
3) switch to the v0.4.10 branch, the latest commits in which should be v0.4.10.2
Isn't the bootstrap.bat downloading the latest release anyway?

After launching the .sln in VS2019 it builds until the error "pyconfig.h not found".

If I understood you correctly it should build with the VS2019 default configuration. Or am I missing a specific Win32 SDK installation?

If it is more reliable I can try to build the master version. But I'd need the proper instructions, or more precisely to know which are the right ones.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Compiling 0.4.10.2 with VS2019 fails

#6 Post by Geoff the Medio »

zimmer wrote: Thu Jun 09, 2022 7:53 pm I followed your instructions from your first reply now, i.e. downloaded v11 SDK for the win32 platform.

There was one line I skipped because it was not clear:
3) switch to the v0.4.10 branch, the latest commits in which should be v0.4.10.2
That's a problem. The v11 SDK has Python 3.5 in it, but the master brach latest version of the project files expect Python 3.6.
After launching the .sln in VS2019 it builds until the error "pyconfig.h not found".
That's due to the mismatch between SDK and project files in master. You need to use the v12 SDK for master (as of this writing, there may be v13 soon), or you can use the v11 SDK with the v0.4.10 branch. More specifically, the SDK contains a directory named for the version of Python it contains, and if you don't use a project file with the same directory specified as an include search path, it won't find that .h file. You can edit the C++ include paths in the project files and the path to the python executable that is called as a custom build step for Version.cpp.in to match the SDK you're using, or use the project file from the branch that's already configured for the SDK version you're using.
Isn't the bootstrap.bat downloading the latest release anyway?
bootstrap.bat clones the freeorion repository from github, with the master branch checked out by default. Another branch is for v0.4.10, and you need to check out that branch if you want to build v0.4.10.
If I understood you correctly it should build with the VS2019 default configuration.
If you have a compatible SDK and branch checked out, yes.
If it is more reliable I can try to build the master version. But I'd need the proper instructions, or more precisely to know which are the right ones.
It's not more "reliable", but building master with the latest SDK requires less steps than building v0.4.10.2, for which you need to switch to the v0.4.10 git branch and use the v11 SDK.

If you're wondering why it doesn't automatically check out the v0.4.10 branch when running bootstrap.bat from the v11 SDK, it's because that version of the SDK wasn't made specifically for that branch, and when it was created, it did work with the master branch. But since then, the v0.4.10.2 branch was created for that release, the master branch has moved on, and newer SDK versions have been released that work with newer versions of master.

zimmer
Space Krill
Posts: 8
Joined: Wed Jun 08, 2022 8:11 pm
Location: Heidelberg

Re: Compiling 0.4.10.2 with VS2019 fails

#7 Post by zimmer »

A simple question then: How do I switch to the v0.4.10 git branch? In visual studio?

o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

Re: Compiling 0.4.10.2 with VS2019 fails

#8 Post by o01eg »

CMake could auto-configure project with correct paths the only possible issue is 0.4.10.2 may not include fixes for recent boost versions.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

zimmer
Space Krill
Posts: 8
Joined: Wed Jun 08, 2022 8:11 pm
Location: Heidelberg

Re: Compiling 0.4.10.2 with VS2019 fails

#9 Post by zimmer »

What do I need to build the master?

SDK v12 for x86 Win32?

zimmer
Space Krill
Posts: 8
Joined: Wed Jun 08, 2022 8:11 pm
Location: Heidelberg

Re: Compiling 0.4.10.2 with VS2019 fails

#10 Post by zimmer »

o01eg wrote: Thu Jun 09, 2022 9:11 pm CMake could auto-configure project with correct paths the only possible issue is 0.4.10.2 may not include fixes for recent boost versions.
After VS2019 not working, I tried to use CMake. I couldn't complete the CMake configuration for the build. So I assumed it could be CRLF mismatch. Hard to tell really, with the instructions all over the place and possibly versions not matching.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Compiling 0.4.10.2 with VS2019 fails

#11 Post by Geoff the Medio »

zimmer wrote: Thu Jun 09, 2022 9:09 pmA simple question then: How do I switch to the v0.4.10 git branch? In visual studio?
Visual Studio 2019 has a git branch manager, though I've never used it. You can probably use it to check out the remote origin/v0.4.10 branch.
git branch manager in msvs
git branch manager in msvs
msvs_git_branch_manager.png (93.58 KiB) Viewed 2404 times
I mostly use TortoiseGit and console git commands.
zimmer wrote: Thu Jun 09, 2022 9:12 pm What do I need to build the master?

SDK v12 for x86 Win32?
You can use the v12 Win32 SDK with the default settings in the project files. The v12 x64 SDK should also work, but you need to change the project configuration to the x64 version in Visual Studio after loading the solution file.
changing solution cofing
changing solution cofing
config_picker_msvs.png (40.54 KiB) Viewed 2404 times

zimmer
Space Krill
Posts: 8
Joined: Wed Jun 08, 2022 8:11 pm
Location: Heidelberg

Re: Compiling 0.4.10.2 with VS2019 fails

#12 Post by zimmer »

Geoff the Medio wrote: Thu Jun 09, 2022 9:30 pm The v12 x64 SDK should also work, but you need to change the project configuration to the x64 version in Visual Studio after loading the solution file.
That's what I tried after you told me that I were using the v12 SDK for the x64 platform. So I supposed what I installed was exactly that and switched to the x64 platform as build target. But I got the exact same errors as for the x86 platform, all those unresolved symbols.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Compiling 0.4.10.2 with VS2019 fails

#13 Post by Geoff the Medio »

zimmer wrote: Thu Jun 09, 2022 9:37 pm
Geoff the Medio wrote: Thu Jun 09, 2022 9:30 pm The v12 x64 SDK should also work, but you need to change the project configuration to the x64 version in Visual Studio after loading the solution file.
That's what I tried after you told me that I were using the v12 SDK for the x64 platform. So I supposed what I installed was exactly that and switched to the x64 platform as build target. But I got the exact same errors as for the x86 platform, all those unresolved symbols.
I had forgotten, but just confirmed after testing, that there is an issue with the v12 x64 SDK with the project files in x64 configuration.

But it's not the same errors as building Win32 with the x64 SDK. With the x64 SDK and x64 config, there are linker errors just for GLEW-related symbols, like "__imp___glewBindBuffer", whereas in Win32 mode with the x64 SDK, there are thousands of linker errors for various other things, starting with "__declspec(dllimport) void __cdecl boost::filesystem::path_traits::convert(..."

Building FreeOrion in Win32 mode with the Win32 SDK works for me, though. And the next release of the SDK should work in x64 mode.

I've also removed the x64 SDK downloads from the last two releases, since at least the v12 is broken.

zimmer
Space Krill
Posts: 8
Joined: Wed Jun 08, 2022 8:11 pm
Location: Heidelberg

Re: Compiling 0.4.10.2 with VS2019 fails

#14 Post by zimmer »

Thanks for all the help!

I managed to build successfully with the SDK v11 and Win32 target. But it really required a manual switch to the 0.4.10 branch, which is quite obtuse in VS2019. It's in the bottom right corner, not in the git menu.

The game runs. It applies also full screen, but the rendering is off for 2560p and 1920p. I can live with this for getting an overview, so it is more a bug report. Also, switching to English is kind of buried in submenus.

Have to check out what FreeOrion can do. It seems quite overwhelming at first (even for players coming from MOO), possibly because of all the text boxes and widgets that are displayed initially. Was this a conscious design choice?

I see you use sdl. Did you create the window widgets yourself, or this is another library? It's good that you can move the windows around and resize them, but I am unsure whether the widget UI could minimized more. It would help the feel & look of the game.

You divided the solution into projects. I take it GIGI is for the user interface, the parser for serialization. But I am curious what is the logic for the separation of common/FreeOrion/FreeOrionD/FreeOrionCA?

I can provide you with more feedback, from a developer's perspective, if you like. Maybe in another thread/board?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Compiling 0.4.10.2 with VS2019 fails

#15 Post by Geoff the Medio »

zimmer wrote: Fri Jun 10, 2022 9:35 amthe rendering is off for 2560p and 1920p.
Screen resolution or the resolution the game thinks it's running at? Maybe check that it's set to the correct resolution in the options Video tab.
Was this a conscious design choice?
Initial player impression of the in-game UI hasn't been a major consideration, but can certainly be improved.
I see you use sdl. Did you create the window widgets yourself, or this is another library?
...
I take it GIGI is for the user interface
GiGi is a generic GUI library that is used as the base for the visible GUI widgets and other engine-type stuff, though a lots of the visible widgets are heavily customized for FreeOrion specific purposes.
It's good that you can move the windows around and resize them, but I am unsure whether the widget UI could minimized more. It would help the feel & look of the game.
Specific suggestions are possibly useful, vague / general not so much.
You divided the solution into projects. I take it GIGI is for the user interface, the parser for serialization.
The parser is used to read the game content scripts, not serialization of gamestate or other info. Serialization is done with Boost Serialization, the code for which is in various places related to the info being serialized.
But I am curious what is the logic for the separation of common/FreeOrion/FreeOrionD/FreeOrionCA?
Human client, server (runs as a separate process for single player and multiplayer remote or local games), and AI client.
I can provide you with more feedback, from a developer's perspective, if you like. Maybe in another thread/board?
A new thread or threads would probably make sense.

Post Reply