New user - first thoughts on compiling

Questions, problems and discussion about compiling FreeOrion.

Moderators: Oberlus, Oberlus

Post Reply
Message
Author
Simon Small
Space Krill
Posts: 9
Joined: Wed Apr 01, 2020 8:05 pm

New user - first thoughts on compiling

#1 Post by Simon Small » Wed Apr 01, 2020 8:29 pm

I am running Debian Buster on a laptop (Intel i7 @ 2.90GHz), 16GB memory; I installed the freeorion package (0.4.8-1) just to check what it was. I tried the Quick Start and Single Player options and decided I might like this game.

I found that some of the screens had layout issues, but not too significant. I did struggle to work out how the game should be played and with some of the navigation. I am not sure that I have the time to help too much, but I can see that I could suggest changes.

I installed the source and I have configured my build system using CMake and the CodeBlocks IDE. I have not compiled it yet (soon?). The comments I will make are:

* the 'Download ZIP' link in GitHub did not include a '.git' directory; I deleted these files from my system (I could have created the git repository for these files, but there are no instructions to do so)
* I 'cloned' the project from the command line, as instructed. This worked smoothly
* I created the 'build' directory, as instructed, using the command line. I note that I could name this anything and this could cause problems later (see gitignore below). Can the empty build directory be added to the source?
* I created the CMakeCache.txt file using the command line from the freeorion directory using 'cmake -G "CodeBlocks - Unix Makefiles" ..' (this is the easy way?)
* I opened the CMakeCache.txt file from the GUI file manager using CMake (right click menu, opens the CMake GUI tool). Clicking the Configure button highlighted the missing libraries, which I installed. The Generate button worked successfully
* I got an error in CMake regarding the OpenGL libraries. I added the line 'cmake_policy(SET CMP0072 NEW)' to the top level CMakeLists.txt file to force the correct behaviour
* I opened the freeorion.cbp file with CodeBlocks (right click menu) and can browse the source
* I ran the 'gitk' command from the freeorion directory (command line) and can browse the repository. It shows lots of local uncommitted changes; these are from the build directory. I added line 'build/' to the FreeOrion specific section of the '.gitignore' file

This was totally painless, given that my system had the relevant development tool packages installed. Although I used Linux I think that these tools are available for Windows. I hope that this is useful - now its time to compile...

User avatar
adrian_broher
Programmer
Posts: 1154
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: New user - first thoughts on compiling

#2 Post by adrian_broher » Wed Apr 01, 2020 10:27 pm

Simon Small wrote:
Wed Apr 01, 2020 8:29 pm
* the 'Download ZIP' link in GitHub did not include a '.git' directory; I deleted these files from my system (I could have created the git repository for these files, but there are no instructions to do so)
Could you clarify what is the problem with that (aside the fact that we don't have control over the GitHub page design)?
* I created the 'build' directory, as instructed, using the command line. I note that I could name this anything and this could cause problems later (see gitignore below). Can the empty build directory be added to the source?
No, as the build directory is just a suggestion for those users who decide to build from source. We don't do this because there will be that one contributor™, who push his build tree to the repository without checking, git does not track empty directories without crutches like an empty hidden file and some contributors run multiple build trees for different compilers or architecture targets. I would generally suggest to put the build tree in a sibling directory to the source directory.
* I created the CMakeCache.txt file using the command line from the freeorion directory using 'cmake -G "CodeBlocks - Unix Makefiles" ..' (this is the easy way?)
Pretty much yes. Cmake also provides a menu configuration program (both graphical and curl based) that does the same as the cmake invocation, if you considers this easier.
* I got an error in CMake regarding the OpenGL libraries. I added the line 'cmake_policy(SET CMP0072 NEW)' to the top level CMakeLists.txt file to force the correct behaviour
You can ignore this warning, there are currently efforts to properly migrate to the OpenGL glvnd ABI.
* I ran the 'gitk' command from the freeorion directory (command line) and can browse the repository. It shows lots of local uncommitted changes; these are from the build directory. I added line 'build/' to the FreeOrion specific section of the '.gitignore' file
See the comment about the build tree above.
This was totally painless, given that my system had the relevant development tool packages installed.
Nice to hear that the efforts on the build system paid off so far.
Although I used Linux I think that these tools are available for Windows.
They are, but CMake is currently not usable for the project on the Windows platform.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

Simon Small
Space Krill
Posts: 9
Joined: Wed Apr 01, 2020 8:05 pm

Re: New user - first thoughts on compiling

#3 Post by Simon Small » Thu Apr 02, 2020 9:12 pm

Thanks for your comments. I was suggesting areas that might put off new users and prevent them from being involved. In general I prefer to see recommendations
rather than leave the user unsure of what to do, but making it clear where the user has a choice.

I would have a note about the difference between the Download ZIP link and the clone option (to remove all doubt, and to avoid difficulties later). Having the
Git data might be useful to identify changes and for creating pull requests when investigating bugs. The source code can be used to check functionality when
reviewing documents or Pedia entries. How do you want people to use the source?

One option when using CMake is an "out of source" build where the build files are not in the source directory. I agree with your location, and would change the
instructions to recommend this.

I am not too familiar with compiling with windows but I do have a Linux system that I can use for testing. I wonder if I should suggest changes to the Linux
Compile page?

User avatar
Oberlus
Cosmic Dragon
Posts: 2695
Joined: Mon Apr 10, 2017 4:25 pm

Re: New user - first thoughts on compiling

#4 Post by Oberlus » Thu Apr 02, 2020 10:22 pm

I used the instructions for compiling in linux in the freeorion page (https://www.freeorion.org/index.php/Com ... #FreeOrion), which instructed me to make a build directory outside (besides) the source directory.
The instructions in the repository (https://github.com/freeorion/freeorion/ ... r/BUILD.md) doesn't say the same, despite being (supposedly) more up to date. I prefer the ones in the home page (that I think coincide with what adrian_broher recommends).

User avatar
adrian_broher
Programmer
Posts: 1154
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: New user - first thoughts on compiling

#5 Post by adrian_broher » Thu Apr 02, 2020 10:23 pm

The current documentation (links below) does not mention anything regarding the zip download and explicit states git clone as the only way (with a command line to execute), can you point out the documentation that suggests otherwise? If the user decides to download the latest head only contrary to what is the documentation is telling him to do I don't see how this can be fixed.

https://github.com/freeorion/freeorion/ ... /README.md
https://github.com/freeorion/freeorion/ ... r/BUILD.md
https://github.com/freeorion/freeorion/ ... IBUTING.md

> I wonder if I should suggest changes to the Linux Compile page?

If you are talking about the wiki, please don't. It is already bad enough that those pages (or the wiki in general) exist in the first place containing outdated and contrary information to the authoritative documents within the repository. Those pages need to be deleted.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

Simon Small
Space Krill
Posts: 9
Joined: Wed Apr 01, 2020 8:05 pm

Re: New user - first thoughts on compiling

#6 Post by Simon Small » Thu Apr 02, 2020 11:50 pm

Thanks for the advice... now I know what I did (I think)

* I searched the internet for "FreeOrion", that takes me to the wiki page
* I clicked "Compile" to get the Compile wiki page
* Under the "Getting the Source" header, I clicked the link to the source code, getting the GitHub page
* The big green button "Clone or download" seems the obvious thing to click, downloading the ZIP seems to be the easiest

* further down the GitHub page, in the README.md under the Install header, the "For Linux..." line points the the Build Instructions page
* Under the "Compiling FreeOrion" header the Step by step procedure starts with "Enter the source directory", then the step "On Linux" gives "create a build directory". The rest of that section uses a build directory INSIDE the source directory

This is how I managed to get it 'wrong' - I accept that - but if I did this then perhaps others can too? I am now past that stage, so I'll move on. My first compile gave an error; I'll check if I did that wrong, and open another thread if I need to

Thanks for your comments

User avatar
Oberlus
Cosmic Dragon
Posts: 2695
Joined: Mon Apr 10, 2017 4:25 pm

Re: New user - first thoughts on compiling

#7 Post by Oberlus » Fri Apr 03, 2020 6:19 am

Simon Small wrote:
Thu Apr 02, 2020 11:50 pm
Under the "Compiling FreeOrion" header the Step by step procedure starts with "Enter the source directory", then the step "On Linux" gives "create a build directory". The rest of that section uses a build directory INSIDE the source directory

This is how I managed to get it 'wrong'
Indeed.
https://github.com/freeorion/freeorion/blob/master/BUILD.md wrote:Step by step procedure:
  • Enter the source directory.
  • On Linux and other Operating Systems
    • Create a build directory, which will contain all compile FreeOrion build artifacs.
    • Change into the build directory on the command line.
    • Execute cmake to generate Makefiles:

      Code: Select all

          cmake ..
    • Compile the whole project by calling make within the build directory. In case you want to utilize multiple CPU cores by running parallel compile jobs check out the the make jobs parameter of make.
    • Create a symbolic link to the data directory inside the build directoy by invoking:

      Code: Select all

          ln -s ../default .
This will leave you with a build of FreeOrion executables.
  • freeorion-project/freeorion/build on Linux and other Operating Systems.
There's no doubt this is instructing the one contributor™ to put the build directory within the source directory.
adrian_broher wrote:
Wed Apr 01, 2020 10:27 pm
I would generally suggest to put the build tree in a sibling directory to the source directory.
So the instructions in the repository are misleading and should be corrected, isn't it, @adrian_broher?

Post Reply