View topic - compilation trouble with 0.87 linux/ubuntu 10.04



All times are UTC + 1 hour


Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: 08 Mar 2012, 19:22 

Joined: 08 Mar 2012, 18:52
Hi,

(dear admin: please move this to right place, if this isn't.)

This a spring-compilation-newbie question about a specific problem during compilation/linking with v0.87 on Ubuntu 10.04.

I just wanted to get my feet a little bit more wet and tried to compile spring myself. So I downloaded the "last stable release" from git via
Code:
git clone -b master git://github.com/spring/spring

Since I did this today, the VERSION string inside reads "0.87". After some additions of dev-libraries I managed to get cmake to run without errors.
So after creating a build directory and running
Code:
cmake $path_to_cmakelists.txt
make
I got the following error:
Code:
 CMakeFiles/engine-default.dir/__/__/System/Object.cpp.o: In function `Threading::AtomicCounterInt64::operator++()':
~/spring/rts/System/Platform/Threading.h:111: undefined reference to `__sync_fetch_and_add_8'
~/spring/rts/System/Platform/Threading.h:111: undefined reference to `__sync_fetch_and_add_8'

(note ~/spring is the directory of the git checkout)

I checked the file Threading.h and was slightly surprised that this function doesn't exist; the name is different. The line reads
Code:
111          return __sync_fetch_and_add(&num, boost::int64_t(1));

(see e.g. here for other reference).

After some research (google, forum, dev pages) without fruition I thought I might ask here. What's going wrong and how can I fix it?

The system is more or less vanilla Ubuntu 10.04.4 (gcc 4.4.3-4ubuntu5, boost1.40, etc.).

Anybody an idea?


Top
 Offline Profile  
 
PostPosted: 08 Mar 2012, 20:22 
Spring Developer

Joined: 31 May 2009, 23:08
http://stackoverflow.com/questions/7994 ... -and-add-4

this suggests to use a newer gcc... :-/

i'm not sure, koshi (current ubuntu package maintainer) has maybe a better idea.


Note: its 87.0 not 0.87.


Top
 Offline Profile  
 
PostPosted: 08 Mar 2012, 23:33 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
the stackoverflow suggests it is related to this:
https://github.com/spring/spring/commit/ac0269a5e109161dd6974a6f1b2b55d2f00b6983

(there is a bug in the cmake files of 87.0 causing not to pass "-march=i686")


Last edited by jK on 09 Mar 2012, 09:54, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 08 Mar 2012, 23:47 
Spring Developer

Joined: 31 May 2009, 23:08
damn, i wanted to commit that only into develop, i'm a bit confused why its in release/master... :-/


Top
 Offline Profile  
 
PostPosted: 09 Mar 2012, 08:27 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
hotfix release?
(see RC13 here)
or would that cause sync incompatibility?


Top
 Offline Profile  
 
PostPosted: 09 Mar 2012, 10:00 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
abma wrote:
damn, i wanted to commit that only into develop, i'm a bit confused why its in release/master... :-/
you did but that was after 86.0, with 87.0 it went into release again

hoijui wrote:
hotfix release?
(see RC13 here)
or would that cause sync incompatibility?
Better hope not. A hotfix might be needed if multiple ppl are affected (the guy here, will later no matter what use the official debian/ubuntu binary)


Top
 Offline Profile  
 
PostPosted: 09 Mar 2012, 13:13 

Joined: 08 Mar 2012, 18:52
Hi,

sorry for the wrong zero positioning (0.87 -> 87.0).

It seems this:
jK wrote:
[...](there is a bug in the cmake files of 87.0, causing to not pass "-march=i686")

is actually "seen" by cmake. I noticed it during invocation:
Code:
 -- Checking to see if CXX compiler accepts flag -march i686
-- Checking to see if CXX compiler accepts flag -march i686 - no
INFO-march i686 flag not accepted

But it's only INFO level, not ERROR. On this machine I can't check whether the flag is passed or not, since its gcc can't handle it (for the reason given by abma).

Currently I'm trying to get another gcc version installed on the system (which fails for some other reason); when (or if...) that's done, I can try to compile spring again.

jK wrote:
[...](the guy here, will later no matter what use the official debian/ubuntu binary)

You're probably right, but still I'd like to be able to compile the thing myself and get my hands a little dirtier. I'd like to take a closer look at some things (e.g. like profiling, understand how the lua binding works)

cheers, cherub


Top
 Offline Profile  
 
PostPosted: 09 Mar 2012, 16:18 

Joined: 08 Mar 2012, 18:52
Hi,

reading, thinking and understanding helps sometimes.

First I tried to build 87.0 with a newer gcc version (4.6.3), simply to see if the flag works. It didn't, because the wrong syntax in the cmake file, as jk pointed out. I applied the change -- tada, it worked.
Then I tried to build spring with the Ubuntu built-in compiler (4.4.3), which also worked; the cmake error disappeared, compilation and linking went fine. I could run spring.

So, everything's green now. There's only one thing I needed to tweak:
I tried to run spring from the build directory (I didn't see right away how to change the install directory, so I refrained from `make instal`). It didn't work, since it still needed manual linking of the freefont (FreeSansBold.otf). This might be no problem, if `make install` is done; but I didn't see any (soft-)link command.

Thanks for the help.


Top
 Offline Profile  
 
PostPosted: 10 Mar 2012, 00:02 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
Code:
cmake \
   -DSPRING_DATADIR="${INSTALL_DIR}" \
   -DCMAKE_INSTALL_PREFIX="" \
   -DBINDIR=. -DLIBDIR=. -DMANDIR=. -DDATADIR=.

make

make install DESTDIR=${INSTALL_DIR}

set INSTALL_DIR to where you want to install and.. yeah about liek that. i extracted these lines out of my build scripts.. not sure if this is really allyou need, but i think so. add your own special stuff of course.


Top
 Offline Profile  
 
PostPosted: 14 Mar 2012, 11:55 
User avatar

Joined: 09 Sep 2010, 08:01
ubuntu lts 10.04 here, had same problem:
[...]/Threading.h:111: undefined reference to `__sync_fetch_and_add_8'

have i done that right:

first i entered "cmake ."
then i edited "CMakeCache.txt"
inserted "i686" on end of line:
MARCH_FLAG:STRING=

then run "make" - and it worked.

after that i wondered "hey, i got an athlon. why optimize for i686?"
so i changed to something else, i tried "k8" for an athlon
all architecture options are found here:
http://gcc.gnu.org/onlinedocs/gcc/i386- ... tions.html



worked too - but i haven't noticed any differences.


Top
 Offline Profile  
 
PostPosted: 14 Mar 2012, 12:00 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
Some sse-optimizations are a damn lot faster when optimizing for with the correct athlon flag (mostly you want `amdfam10`), but it's nothing you will notice ingame (even when the code runs 10-100x faster, the code is just <1% of the total).


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


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

Site layout created by Roflcopter et al.