FreeOrion

Forums for the FreeOrion project
It is currently Fri Nov 17, 2017 9:01 pm

All times are UTC




Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: Compile Problem
PostPosted: Thu Jun 11, 2015 7:41 pm 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3257
Doofus here decided his clone was ina stupid place, so decided to put it somewhere else. And rather than cut/paste, I recloned it. d'oh! Not the best time of day to be doing that.

Quad core machine, but only 8gig RAM, that's near the top of the things I want to upgrade when I've got more money, so I reread things and went up to j3 instead of j2. This, so far, is working, but we'll see, thanks for the help guys.
Quote:
cd git
mkdir freeorion.build
cd freeorion.build
ln -s ../freeorion/default .
cmake ../freeorion
make -j3

Re the Wiki, definitely need to get it updated, do we remove the Ogre/Bullet references entirely, or say that it's not needed as per release 0.4.5 or anything taken from the Git repo? Also, one of the listed dependencies I notice is Subversion, I assume that's no longer needed?

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Thu Jun 11, 2015 8:00 pm 
Offline
Juggernaut

Joined: Mon Feb 04, 2013 10:15 pm
Posts: 756
MatGB wrote:
Quad core machine, but only 8gig RAM, that's near the top of the things I want to upgrade when I've got more money, so I reread things and went up to j3 instead of j2. This, so far, is working, but we'll see, thanks for the help guys.


Most stuff doesn't need more then 8gb. You can always run top (command line) and see how much memory is available and how much the various programs are taking.

MatGB wrote:
Re the Wiki, definitely need to get it updated, do we remove the Ogre/Bullet references entirely, or say that it's not needed as per release 0.4.5 or anything taken from the Git repo? Also, one of the listed dependencies I notice is Subversion, I assume that's no longer needed?


Correct, Subversion is no longer needed.

Yes that needs updating, maybe a separate section for older versions?


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Thu Jun 11, 2015 9:06 pm 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1040
Location: Germany
Having the compile instructions in the wiki is rather stupid, imo. A section within the README.md or a separate INSTALL.md would be always synchronous to the actual checked out code.

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Thu Jun 11, 2015 9:56 pm 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4374
AndrewW wrote:
Yes that needs updating, maybe a separate section for older versions?
I've updated it some earlier today. I saw no point in keeping anything about SVN or older versions of the code.

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 12:35 am 
Offline
Juggernaut

Joined: Mon Feb 04, 2013 10:15 pm
Posts: 756
Removed the old build and did a new one (testing things), didn't work within the directory structure:

Code:
[100%] Building CXX object client/human/CMakeFiles/freeorion.dir/__/__/UI/TextBrowseWnd.cpp.o
Linking CXX executable ../../freeorion
CMakeFiles/freeorion.dir/chmain.cpp.o: In function `mainConfigOptionsSetup(std::vector<std::string, std::allocator<std::string> > const&)':
chmain.cpp:(.text+0xe4d): undefined reference to `FreeOrionVersionString()'
chmain.cpp:(.text+0x1781): undefined reference to `FreeOrionVersionString()'
CMakeFiles/freeorion.dir/chmain.cpp.o: In function `mainSetupAndRun()':
chmain.cpp:(.text+0x376f): undefined reference to `FreeOrionVersionString()'
CMakeFiles/freeorion.dir/__/__/UI/IntroScreen.cpp.o: In function `IntroScreen::IntroScreen()':
IntroScreen.cpp:(.text+0x359f): undefined reference to `FreeOrionVersionString()'
collect2: error: ld returned 1 exit status
client/human/CMakeFiles/freeorion.dir/build.make:1729: recipe for target 'freeorion' failed
make[2]: *** [freeorion] Error 1
CMakeFiles/Makefile2:413: recipe for target 'client/human/CMakeFiles/freeorion.dir/all' failed
make[1]: *** [client/human/CMakeFiles/freeorion.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2


Worked fine building outside the directory structure though...


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 1:21 am 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4374
AndrewW wrote:
Removed the old build and did a new one (testing things), didn't work within the directory structure:
Just to be clear, by "within the directory structure" you mean not using a special build directory at all, correct? Because I thought you had indicated above that using one like freeorion/build/ worked for you.

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 2:44 am 
Offline
Juggernaut

Joined: Mon Feb 04, 2013 10:15 pm
Posts: 756
Dilvish wrote:
Just to be clear, by "within the directory structure" you mean not using a special build directory at all, correct? Because I thought you had indicated above that using one like freeorion/build/ worked for you.


Meaning using a directory under the freeorion directory. It did work, but did a completely new build, removing the old stuff first and it didn't. Putting a new build directory outside the freeorion directory worked this time.


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 5:08 am 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4374
AndrewW wrote:
Putting a new build directory outside the freeorion directory worked this time.
Weird.. isn't that what you had tried *first* and it didn't work, before I suggested trying a build folder within the freeorion folder? Did you do anything different this time than that first time?

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 6:28 am 
Offline
Juggernaut

Joined: Mon Feb 04, 2013 10:15 pm
Posts: 756
Dilvish wrote:
Weird.. isn't that what you had tried *first* and it didn't work, before I suggested trying a build folder within the freeorion folder? Did you do anything different this time than that first time?


Correct that is the way I tried it initially. Not that I'm aware of.

I have no idea why this time it works this way around and the other time it didn't, but worked the other way around. Wanted to mention my results, not trying to explain why as I don't have an explanation. Note, didn't need to create any links this time either.


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 9:22 am 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3257
For what it's worth, the first time I thought it had compiled properly I couldn't find anything to get the game going, Cmake hadn't given me any error messages and it all looked good. I remade it, no change, then I redid Cmake then remade it, and this time I got executables that were clearly executables in teh build folder (I know what to look for next time).

It appears sometimes simply doing it again makes a difference, but I've, obviously, zero clue why doing it again makes a difference.

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 9:33 am 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1040
Location: Germany
MatGB wrote:
For what it's worth, the first time I thought it had compiled properly I couldn't find anything to get the game going.


Please be more specific. Also the configure/compile output always is a good indicator on what is happening or going wrong, so please post it.

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 9:58 am 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3257
Specifically, there were no executables for freeorion, freeoriond or freeorionca. But, this was the first time I'd *ever* tried to compile something on Linux and I had no idea what Linux executables even looked like or where they were meant to be. It was only after I'd messed around, including using sudo apt get to install the current Release version from the Ubuntu repo (which wasn't what I thought I was doing) that I had a vague idea what to look for and then reran Cmake then Make, this time, despite doing everything identically, it worked fine.
Quote:
Also the configure/compile output always is a good indicator on what is happening or going wrong, so please post it.

Given I've rerun the commands subsequently, will the old output still exist? If so, where do I look?

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 11:28 am 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1040
Location: Germany
MatGB wrote:
Specifically, there were no executables for freeorion, freeoriond or freeorionca. But, this was the first time I'd *ever* tried to compile something on Linux and I had no idea what Linux executables even looked like or where they were meant to be.


Well, okay. I will give you a little breakdown of the steps then.

Starting from the commands you used:

change directory to the directory called 'git'
Code:
cd git


make a directory called 'freeorion.build' inside the git directory.
Code:
mkdir freeorion.build


Again, change directory to the new created directory 'freeorion.build'
Code:
cd freeorion.build


Create a (soft) symbolic link to the default directory of the freeorion source inside the freeorion.build directory.
A symbolic link is a transparent way to point a file/directory to another file/directory.
This is because freeorion expects all the data files at a certain place.
Instead you could copy the default directory into the freeorion.build directory, but then changes inside the default directory originated in the source wouldn't reflect inside the build directory.
Code:
ln -s ../freeorion/default .


Configure your build from the sources located inside ../freeorion.
This is a more complex step, as it does serveral steps
1. It creates the build system, which is by default 'make', you can choose other build systems and, for example create a build system based on Xcode (only on MacOSX) or Visual Studio (only on Windows).
2. It checks if all prerequisites are satisfied. This means that all libraries and programs used are installed.
3. It generates platform specific code files from template files. For example it creates the Version.cpp file by asking GIT what the version of currently checked out source code is.
As the name says, this would be the place to configure you build, e.g. where to install the result, what library versions to use and so on. Most of the time no configuration is needed for FO.
Code:
cmake ../freeorion


This is where you actually compile the code into the FO executables and libraries. The -j3 parameter says that the make build system should try to run 3 jobs in parallel. As a rule of thumb you run as many jobs as you have processors/cores (or less if you need a processor/core for other purposes).
Code:
make -j3


After a successful compile the executables 'freeorion', 'freeorionca' and 'freeoriond' are placed within the 'freeorion.build' directory. On unix-ish systems there is no file extension indicating that an executable is executable, but rather a file permission that indicates this. Also important to note is that you haven't installed the application yet (which doesn't prevent you from running it, though, but more later).

Here is a listing of my freeorion build directory:
Code:
$ ls -l
insgesamt 57144
drwxrwxr-x.  4 adrian adrian     4096  8. Mai 22:49 client
-rw-rw-r--.  1 adrian adrian    38490  7. Jun 22:54 CMakeCache.txt
drwxrwxr-x.  7 adrian adrian     4096  8. Jun 15:10 CMakeFiles
-rw-rw-r--.  1 adrian adrian     5821  4. Jun 17:52 cmake_install.cmake
-rw-r--r--.  1 adrian adrian     5952  7. Jun 22:54 CPackConfig.cmake
-rw-r--r--.  1 adrian adrian     5487  7. Jun 22:54 CPackSourceConfig.cmake
lrwxrwxrwx.  1 adrian adrian       25 11. Mai 20:26 default -> ../freeorion.git/default/
-rwxrwxr-x.  1 adrian adrian  6359107  8. Jun 15:10 freeorion
-rwxrwxr-x.  1 adrian adrian  3196517  8. Jun 15:10 freeorionca
-rwxrwxr-x.  1 adrian adrian  3666331  8. Jun 15:10 freeoriond
drwxrwxr-x.  5 adrian adrian     4096  7. Jun 22:54 GG
-rwxrwxr-x.  1 adrian adrian 10461276  8. Jun 15:10 libfreeorioncommon.so
-rw-rw-r--.  1 adrian adrian 23637040  5. Jun 15:07 libfreeorionparse.a
-rwxrwxr-x.  1 adrian adrian  6473240  8. Jun 15:09 libfreeorionparse.so
-rwxrwxr-x.  1 adrian adrian   238069  4. Jun 17:53 libGiGiSDL.so
-rwxrwxr-x.  1 adrian adrian  4299976  4. Jun 17:53 libGiGi.so
-rw-rw-r--.  1 adrian adrian    65960  7. Jun 22:54 Makefile
drwxrwxr-x.  3 adrian adrian     4096  7. Jun 22:54 parse
drwxrwxr-x.  3 adrian adrian     4096  7. Jun 22:54 server


The '-l' parameter tells ls that it should output the listing in tabular form. The first column, indicates the permissions of a file. Permissions are a whole chapter on it's own, so I skip that for now. The important part is the 'x', which means that the file is executable.


Quote:
It was only after I'd messed around, including using sudo apt get to install the current Release version from the Ubuntu repo (which wasn't what I thought I was doing) that I had a vague idea what to look for and then reran Cmake then Make, this time, despite doing everything identically, it worked fine.


Now here comes the part that probably caused problems for you. When executing a command on the command line like 'ls' the shell searches certain directories for this executable and execute it if found. The directories search are controlled by the 'PATH' environment variable. However the current directory '.' is by default not in this search path (and should not be for security purposes).

This means even if I'm in the freeorion build directory and there is a freeorion executable and I run

Code:
freeorion


the shell will respond with something along the lines:

Code:
freeorion: Command not found


or, if you have installed freeorion on the system it would run this installed version, but not the version you compiled.

But you can tell the shell to explicit run the executable inside the directory by typing in:

Code:
./freeorion


Which literally translates into "execute the file 'freeorion' inside the current directory (. is the shorthand for that)".

Quote:
Given I've rerun the commands subsequently, will the old output still exist? If so, where do I look?


I was assuming that had save it somewhere. No, by default the only output by make and cmake is written to the console. This output is destroyed whenever you close the console.

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Fri Jun 12, 2015 12:44 pm 
Offline
Creative Contributor
User avatar

Joined: Fri Jun 28, 2013 11:45 pm
Posts: 3257
That is incredibly helpful, thank you. Some of it I already (sort of) knew, or had guessed, but seeing all the abbreviations with examples makes the point a lot clearer.
Quote:
I was assuming that had save it somewhere.

Someday, I will get into the habit of doing this, someday. I didn't even manage to save a copy of the game I was playing late last night where I discovered an edge case scripting bug that should be an easy fix but'll need testing, ah well.

Still, I now have my executables, know what I'm doing (sort of) and am learning things. This is good.

Some of the above probably ought to be in the wiki, when I'm feeling less fragile I'll see what I can do, need to remember my password for it first though ;-)

_________________
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
 Post subject: Re: Compile Problem
PostPosted: Sat Feb 27, 2016 3:47 pm 
Offline
Space Kraken
User avatar

Joined: Sat Jan 30, 2016 11:29 am
Posts: 123
Dilvish wrote:
Code:
sudo apt-get install libglew-dev
should do it; I didn't do anything fancy for my install of it.


Necroing this. That line of code should be in the Wiki page, together with the other "apt-get install" statements. I was trying to compile on a Linux Mint box and had a hard time with a "Couldn't find GLEW" message.

So, what I did (retroactively adding the missing apt-get install), and went very smooth, was:

Code:
sudo apt-get install build-essential git pkg-config libltdl-dev cmake libboost-all-dev
sudo apt-get install python2.7-dev libfreetype6-dev libsdl2-dev libvorbis-dev libtiff4-dev libopenal-dev
sudo apt-get install libglew-dev

cd git
git clone git://github.com/freeorion/freeorion
cd freeorion
mkdir freeorion.build
cd freeorion.build
ln -s ../default .
cmake ..
make -j9
./freeorion


I had to "mine" that sequence of commands from various places in the wiki and this forum. I think it should be all together in an easily accessible place in the wiki.

_________________
All contributions are released under GPL or LGPL v2 or later, or under appropriate Creative Commons licence, consistent with project guidelines.


Last edited by Cpeosphoros on Wed Nov 15, 2017 12:12 pm, edited 1 time in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group