Compile Problem

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Message
Author
AndrewW
Juggernaut
Posts: 791
Joined: Mon Feb 04, 2013 10:15 pm

Compile Problem

#1 Post by AndrewW »

Getting closer...

Just pulled down from git today.

Code: Select all

[ 67%] Building CXX object server/CMakeFiles/freeoriond.dir/__/universe/UniverseGenerator.cpp.o
/home/andrew/Games/freeorion/universe/UniverseGenerator.cpp:716:36: warning: ‘const {anonymous}::MonsterFleetPlanManager& {anonymous}::GetMonsterFleetPlanManager()’ defined but not used [-Wunused-function]
     const MonsterFleetPlanManager& GetMonsterFleetPlanManager()
                                    ^
Linking CXX executable ../freeoriond
../libfreeorioncommon.so: undefined reference to `FreeOrionVersionString()'
collect2: error: ld returned 1 exit status
server/CMakeFiles/freeoriond.dir/build.make:401: recipe for target 'freeoriond' failed
make[2]: *** [freeoriond] Error 1
CMakeFiles/Makefile2:309: recipe for target 'server/CMakeFiles/freeoriond.dir/all' failed
make[1]: *** [server/CMakeFiles/freeoriond.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2
Any idea where to look?

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Compile Problem

#2 Post by Dilvish »

AndrewW wrote:Any idea where to look?
If you search our forums (upper right of page) for FreeOrionVersionString, you'll find a thread with a couple potential fixes (the simplest has to do with changing the build location).
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

AndrewW
Juggernaut
Posts: 791
Joined: Mon Feb 04, 2013 10:15 pm

Re: Compile Problem

#3 Post by AndrewW »

Got closer:

Code: Select all

[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

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Compile Problem

#4 Post by Dilvish »

ok well can you tell us what potential fixes you tried from that other thread, and how your situation matches or not? What cmake version and boost versions are you using? Did you try an out-of-source build?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

AndrewW
Juggernaut
Posts: 791
Joined: Mon Feb 04, 2013 10:15 pm

Re: Compile Problem

#5 Post by AndrewW »

Dilvish wrote:ok well can you tell us what potential fixes you tried from that other thread, and how your situation matches or not? What cmake version and boost versions are you using? Did you try an out-of-source build?
Tried:

Code: Select all

git clone https://github.com/freeorion/freeorion
mkdir freeorion.build 
cd freeorion.build
cmake ../freeorion
make
cmake 3.0.2-1
libboost-all-d 1.55.0.2

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Compile Problem

#6 Post by Dilvish »

Ah, yeah, I think I see the issue, your build directory is all the way out of your local git repo. When we had been using the phrase "out-of-source" build, it really meant something more like "compartmentalized from the source files" not "totally out of the source tree". Try

Code: Select all

git clone https://github.com/freeorion/freeorion
cd freeorion
mkdir build 
cd build
cmake ..
make
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

AndrewW
Juggernaut
Posts: 791
Joined: Mon Feb 04, 2013 10:15 pm

Re: Compile Problem

#7 Post by AndrewW »

Dilvish wrote:Ah, yeah, I think I see the issue, your build directory is all the way out of your local git repo. When we had been using the phrase "out-of-source" build, it really meant something more like "compartmentalized from the source files" not "totally out of the source tree". Try

Code: Select all

git clone https://github.com/freeorion/freeorion
cd freeorion
mkdir build 
cd build
cmake ..
make
Ok, that plus a link worked.

pheldens
Pupating Mass
Posts: 96
Joined: Fri Mar 15, 2013 12:54 pm

Re: Compile Problem

#8 Post by pheldens »

Don't put the build dir inside the git source tree! Put it outside at the same level as the source tree, to prevent a build bug.

on a generic linux, I was able to build like this:
git clone https://github.com/freeorion/freeorion.git
mkdir freeorion.build
cd freeorion.build
cmake ../freeorion
make -j2
ln -s ../freeorion/default/ .
./freeorion

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Compile Problem

#9 Post by Dilvish »

pheldens wrote:Don't put the build dir inside the git source tree! Put it outside at the same level as the source tree, to prevent a build bug.
The location I suggested is the default for KDevelop, and has never caused me any trouble (though it is best to then add that add it to .gitignore). The location you suggest appears to me to be the exact one that had been causing AndrewW trouble.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Compile Problem

#10 Post by MatGB »

OK, the Compile in Linux wiki page still contains references to Bullet and Ogre3d that need removing. It needs adding that you need SDL2 and not 1.2 (which comes with Kubuntu), so

Code: Select all

sudo apt-get install libsdl2-dev
will grab that.

Now I can't get it to install because it wants me to have Glew. I've downloaded Glew, but can't figure out how to get it into the right place, so I'm taking a break, if anyone knows, brilliant, I'll get on with it when I've watered the garden
Mat Bowles

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

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Compile Problem

#11 Post by Dilvish »

MatGB wrote:OK, the Compile in Linux wiki page still contains references to Bullet and Ogre3d that need removing. It needs adding that you need SDL2 and not 1.2 (which comes with Kubuntu), so

Code: Select all

sudo apt-get install libsdl2-dev
will grab that.
Now I can't get it to install because it wants me to have Glew. I've downloaded Glew, but can't figure out how to get it into the right place, so I'm taking a break, if anyone knows, brilliant, I'll get on with it when I've watered the garden

Code: Select all

sudo apt-get install libglew-dev
should do it; I didn't do anything fancy for my install of it.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Compile Problem

#12 Post by MatGB »

Building! Excellent. I'll get used to this command line thing, eventually.
Mat Bowles

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

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: Compile Problem

#13 Post by MatGB »

OK, 72% in very quickly, then this

Code: Select all

Linking CXX executable ../freeoriond
../libfreeorioncommon.so: undefined reference to `FreeOrionVersionString()'
collect2: error: ld returned 1 exit status
make[2]: *** [freeoriond] Error 1
make[1]: *** [server/CMakeFiles/freeoriond.dir/all] Error 2
make: *** [all] Error 2
matgb@MatGB-Desktop:~/git/freeorion/build$ 
Mat Bowles

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

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: Compile Problem

#14 Post by Dilvish »

right, there have been a lot of people running into that; it's why I just added to the compile instructions a recommendation to make a separate build directory. Instead of running cmake and make from within the main freeorion directory, make a build directory (then you also have to add a link to the content directory). if you add it within the freeorion directory you'd want to add it to your .gitignore, but some some folks (but not all it seems) it works to add it outside the freeorion directory. That's probably best to try first. So if you had the source at programs/freeorion, then you would
cd programs
mkdir freeorion.build
cd freeorion.build
ln -s ../freeorion/default .
cmake ../freeorion
make

when you update only the "make" step normally needs to be redone

If you still have trouble with VersionString, then do the same as above but make the build directory be within the freeorion directory (and then the cmake step would be "cmake .." and the link step would be "ln -s ../default ."
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

AndrewW
Juggernaut
Posts: 791
Joined: Mon Feb 04, 2013 10:15 pm

Re: Compile Problem

#15 Post by AndrewW »

Also you might want to add "-jx" to the make command if you have multiple cores and/or CPU's, replace the x with the number of cores or number of cores+1. This can speed up compiling by using multiple threads, so say if you have a quad core it would look like:

Code: Select all

make -j5

Post Reply