FreeOrion

Forums for the FreeOrion project
It is currently Wed May 22, 2013 5:06 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: linux compillation fix
PostPosted: Sun Jun 27, 2010 9:59 pm 
Offline
Space Squid
User avatar

Joined: Mon May 24, 2010 10:22 am
Posts: 75
Location: Poland
Index: ServerNetworking.cpp
===================================================================
--- ServerNetworking.cpp (revision 3636)
+++ ServerNetworking.cpp (working copy)
@@ -188,7 +188,10 @@
if (m_new_connection) {
// wait half a second if the first data read is an error; we
// probably just need more setup time
+
+#ifndef FREEORION_WIN32
Sleep(500);
+#endif
} else {
if (error == boost::asio::error::eof ||
error == boost::asio::error::connection_reset)

Normally this macro should be putted in function def/declaration but i prefer to have system specific fixes done as much explicitly as possible.


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Sun Jun 27, 2010 10:19 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
In MultiplayerCommon.h (which is included in ServerNetworking.cpp):
Code:
#ifndef FREEORION_WIN32
/** Puts the calling thread to sleep for \a ms milliseconds. */
void Sleep(int ms);
#endif


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Sun Jun 27, 2010 10:53 pm 
Offline
Space Squid
User avatar

Joined: Mon May 24, 2010 10:22 am
Posts: 75
Location: Poland
Sure i know where Sleep() is defined but what Sleep is used if there is no #FREEORION_WIN32 defined? If you want to do this in MultiplayerCommon files then something like that is needed:

void Sleep() in header:

void Sleep() { in cpp
#FREEORION_WIN32

...

#endif
}
In short there is no Sleep() defined under linux, but this maybe are some issue with my build process because I have trouble with it right now - undefined reference to GG::CLR_ZERO and all looks fine, I'm little puzzled with it.


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Sun Jun 27, 2010 11:32 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
tezeriusz wrote:
Sure i know where Sleep() is defined but what Sleep is used if there is no #FREEORION_WIN32 defined?

If FREEORION_WIN32 is not defined, then #ifndef FREEORION_WIN32 is true, and the declaration of Sleep() in MultiplayerCommon.h is compiled. If FREEORION_WIN32 is defined, then the declaration in MultiplayerCommon.h is not compiled, which is fine because the Win32 API provides a Sleep() function.

Quote:
In short there is no Sleep() defined under linux...

Unless you're building on Linux with FREEORION_WIN32 defined, yes there is: Sleep is declared in MultiplalyerCommon.h by the quoted lines in my previous post.

Quote:
...maybe are some issue with my build process because I have trouble with it right now - undefined reference to GG::CLR_ZERO and all looks fine, I'm little puzzled with it.

In what file? GG::CLR_ZERO is declared in GG's Clr.h, and MultiplayerCommon.h has a line: #include <GG/Clr.h>


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Mon Jun 28, 2010 12:17 am 
Offline
Space Squid
User avatar

Joined: Mon May 24, 2010 10:22 am
Posts: 75
Location: Poland
tezeriusz wrote:
#ifndef

Damn I'm blind :/
missed that little 'n'

About that undefrefernce i just set VERBOSE=1 to make and got the answer. There is no libgigi.so or any gigi lib added to linking process. I have installed it in customized location and didn't have problem with it (at last one week ago when I played with FO a little). So the question is why (attached CMakeCache and versbos make output)
Attachment:
File comment: CMakeCache and verbose output from make
szczaw.tar.gz [5.75 KiB]
Downloaded 15 times
.
It looks like it should work but it don't, but why? I didn't change anything only rebuild GiGi and almost rebuild FO. And why i got that error with Sleep() during compilation?(now after cmake -i . i it is fine). Have PKG_CONFIG_PATH set, just in case.

Ok bed calling, gn.
Ah and i almost forget (great sightless and forgetful;])

last output:
CMakeFiles/freeoriond.dir/__/util/MultiplayerCommon.cpp.o: In function `PlayerSetupData':
/home/t0/workspace/FreeOrion/FreeOrion/util/MultiplayerCommon.cpp:434: undefined reference to `GG::CLR_ZERO'
/home/t0/workspace/FreeOrion/FreeOrion/util/MultiplayerCommon.cpp:434: undefined reference to `GG::CLR_ZERO'
CMakeFiles/freeoriond.dir/__/universe/Universe.cpp.o: In function `Universe::GenerateEmpires(std::vector<int, std::allocator<int> >&, std::map<int, PlayerSetupData, std::less<int>, std::allocator<std::pair<int const, PlayerSetupData> > > const&)':
/home/t0/workspace/FreeOrion/FreeOrion/universe/Universe.cpp:4210: undefined reference to `GG::CLR_ZERO'


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Mon Jun 28, 2010 6:02 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
No gigi library could be why you get errors about GG::CLR_ZERO not being defined. Is GiGi built, and if so have you told CMake where it is?


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Mon Jun 28, 2010 7:40 am 
Offline
Space Squid
User avatar

Joined: Mon May 24, 2010 10:22 am
Posts: 75
Location: Poland
Geoff the Medio wrote:
No gigi library could be why you get errors about GG::CLR_ZERO not being defined. Is GiGi built, and if so have you told CMake where it is?

Sure i buid GiGi and sure that i give cmake GiGi location, this is why i atached CMakeCache.txt, to confirm that. I will tray today to clean cmake cache and do FO configuration compilation from scratch.


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Mon Jun 28, 2010 1:47 pm 
Offline
Space Squid
User avatar

Joined: Mon May 24, 2010 10:22 am
Posts: 75
Location: Poland
Just finished verifcation of that issue. On clean system I installed bullet and GiGi in my home directory. PKG_CONFIG_PATH to GiGi was set and bullet libs was set from cmake -i . wizzard. There is still problem during linking.


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Mon Jun 28, 2010 4:42 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Can you set the GiGi path(es) directly in ccmake instead of using pkg config?

By installing GiGi, did you build it first, or use some downloaded version?

What if you copy the link command produced by make, and add the gigi lib to it?


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Mon Jun 28, 2010 10:53 pm 
Offline
Space Squid
User avatar

Joined: Mon May 24, 2010 10:22 am
Posts: 75
Location: Poland
Ok i fix them all :)

There is no diff how i got GiGi libs to cmakecache, both way tried. I build GiGi myself.

Fixes:
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 3636)
+++ CMakeLists.txt (working copy)
@@ -131,7 +131,7 @@
link_directories(${BOOST_LIBRARYDIR})
set(THIS_EXE_LINK_LIBS ${THIS_EXE_LINK_LIBS} ${GIGI_GIGI_LIBRARY} ${ZLIB_LIBRARY})
else ()
- set(THIS_EXE_LINK_LIBS ${THIS_EXE_LINK_LIBS} ${Boost_LIBRARIES})
+ set(THIS_EXE_LINK_LIBS ${THIS_EXE_LINK_LIBS} ${Boost_LIBRARIES} ${GIGI_GIGI_LIBRARY})
endif ()

executable_all_variants(freeorionca)

----cut here--------

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 3636)
+++ CMakeLists.txt (working copy)
@@ -109,7 +109,7 @@
link_directories(${BOOST_LIBRARYDIR})
set(THIS_EXE_LINK_LIBS ${GIGI_GIGI_LIBRARY} ${ZLIB_LIBRARY})
else ()
- set(THIS_EXE_LINK_LIBS ${Boost_LIBRARIES} ${ZLIB_LIBRARY})
+ set(THIS_EXE_LINK_LIBS ${Boost_LIBRARIES} ${ZLIB_LIBRARY} ${GIGI_GIGI_LIBRARY})
endif ()

executable_all_variants(freeoriond)

----cut here ----

Should main CMakeLists.txt include isotreams lib
as:
set(MINIMUM_BOOST_COMPONENTS date_time filesystem serialization signals system thread iostreams)
or it is only needed in ....AI/CMakeLists.txt


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Tue Jun 29, 2010 3:13 am 
Offline
Programming Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 1:33 pm
Posts: 1092
At first I thought this was a case of another user with a messed up system. Then I tried a clean build, and I can reproduce this on my system too. :oops: So, please "svn up" to get some changes that make your patch unnecessary. I was trying to get the server and AI client to build without linking to GiGi binaries, and only half completed the job. Thanks for the bug report, and sorry for the noise.


Top
 Profile  
 
 Post subject: Re: linux compillation fix
PostPosted: Tue Jun 29, 2010 3:35 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
tzlaine wrote:
I was trying to get the server and AI client to build without linking to GiGi binaries, and only half completed the job.

You may have been successful in setting up the no-GiGi binary build, before I added additional references to GG::Clr constants in recent commits...


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

All times are UTC


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 © 2000, 2002, 2005, 2007 phpBB Group