help with compiling >r3865 on MacOS needed

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
thawn
Space Krill
Posts: 8
Joined: Wed May 13, 2009 9:43 pm

help with compiling >r3865 on MacOS needed

#1 Post by thawn »

Hi,
Using the MacOS SDK, I have successfully managed to build FreeOrion rev. 3865 on a Mac system (using GG rev 853 to avoid having to build boost 1.44 myself).
However, I did not manage to build any version above that due to trouble getting the newly introduced ogdf library to build correctly. Here is what I tried:
I added the UI/ogdf directory to the file tree in Xcode.
I tried to build both with and without adding the ogdf tree to the build targets common, commonClient or freeorionclient (trying each individually one after each other).
When I do not add the ogdf tree to any build target, I get some file not found errors for some includes in TechTreeWnd.cpp (e.g. ogdf/basic/Graphic.h). Mind you this happens even when I have ogdf in the file tree in xcode.
When I add ogdf to any build target, I get some 30,000 (sic!) errors, many of them file not found errors.

I am sure this is just some configuration issue with how I add the ogdf tree to Xcode but I cannot figure it out by myself.
Can anyone help me?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: help with compiling >r3865 on MacOS needed

#2 Post by Geoff the Medio »

Is there a way to tell XCode to look in a particular directory for include files? Doing this is necessary in Visual Studio on Windows. The OGDF stuff is in the (relatively) path ../../UI/ogdf/ for the MSVC 2010 project, so something similar would probably work for XCode.

You do also need to add the relevant additional source (.cpp) files. The ones that were necessary on Win32 can be seen in this change or the changes to the (hopefully) planetform-independent CMakeLists.txt can be seen in this change. Likely XCode will need the same files.

I'm not sure whether XCode also needs to have header files added to the project to work properly, independent of adding the include directories. If so, the above-linked changes probabaly would be helpful to know which files are needed.

You may also need to remove some references to graphviz stuff from the XCode project files, although it probably will build even if those references are left... they'll just be unused.

I can't help with any specifics about how to use XCode, unfortunately.

thawn
Space Krill
Posts: 8
Joined: Wed May 13, 2009 9:43 pm

Re: help with compiling >r3865 on MacOS needed

#3 Post by thawn »

Thanks for your quick reply! You certainly provided excellent queues to where I can start looking!

1. I'll try to find the place where I can set the include path in Xcode.

2. Quick googling indicates that cmake and xcode work only so well together. Apparently using cmake, you loose all custom settings made in xcode. I'll try to figure out if this is a problem in our case. Maybe the xcode project generated automatically by cmake works out of the box anyways and solves all our problems. But this would certainly be too good to be true ;-)
Anyways I can still take the necessary source files from the cmakelists.txt and add those to the xcode project manually.

I'll report back once I have made progress.

thawn
Space Krill
Posts: 8
Joined: Wed May 13, 2009 9:43 pm

Re: help with compiling >r3865 on MacOS needed

#4 Post by thawn »

O.K. I am getting there. I successfully told Xcode where to look for the header files:
in "Project"->"Edit Active Target FreeOrionClient" I changed the Header Search Path that pointed to the graphwiz library to "$(SRCROOT)/../UI/ogdf/".
Then I added these cpp files to the FreeOrionClient build target:
199 ../../UI/ogdf/src/basic/String.cpp
200 ../../UI/ogdf/src/basic/basic.cpp
201 ../../UI/ogdf/src/basic/CombinatorialEmbedding.cpp
202 ../../UI/ogdf/src/basic/geometry.cpp
203 ../../UI/ogdf/src/basic/Graph.cpp
204 ../../UI/ogdf/src/basic/GraphAttributes.cpp
205 ../../UI/ogdf/src/basic/GraphCopy.cpp
206 ../../UI/ogdf/src/basic/Hashing.cpp
207 ../../UI/ogdf/src/basic/ogdfSystem.cpp
208 ../../UI/ogdf/src/basic/PoolMemoryAllocator.cpp
209 ../../UI/ogdf/src/basic/simple_graph_alg.cpp
210 ../../UI/ogdf/src/energybased/MultilevelGraph.cpp
211 ../../UI/ogdf/src/fileformats/GmlParser.cpp
212 ../../UI/ogdf/src/fileformats/XmlParser.cpp
213 ../../UI/ogdf/src/cluster/ClusterGraph.cpp
214 ../../UI/ogdf/src/layered/sugiyama.cpp
215 ../../UI/ogdf/src/layered/acyclic_subgraph.cpp
216 ../../UI/ogdf/src/layered/CrossingsMatrix.cpp
217 ../../UI/ogdf/src/layered/FastHierarchyLayout.cpp
218 ../../UI/ogdf/src/layered/heuristics.cpp
219 ../../UI/ogdf/src/layered/HierarchyLayoutModule.cpp
220 ../../UI/ogdf/src/layered/ranking.cpp
221 ../../UI/ogdf/src/layered/SplitHeuristic.cpp
222 ../../UI/ogdf/src/packing/TileToRowsCCPacker.cpp

However, now I am still getting the following errors trying to compile:

/universe/Condition.cpp:300: error: no match for 'operator!=' in 'sorted_it != std::multimap<_Key, _Tp, _Compare, _Alloc>::rend() [with _Key = double, _Tp = const UniverseObject*, _Compare = std::less<double>, _Alloc = std::allocator<std::pair<const double, const UniverseObject*> >]()'

/universe/Condition.cpp:330: error: no match for 'operator!=' in 'inv_hist_it != std::multimap<_Key, _Tp, _Compare, _Alloc>::rend() [with _Key = unsigned int, _Tp = double, _Compare = std::less<unsigned int>, _Alloc = std::allocator<std::pair<const unsigned int, double> >]()'

then some 30 warnings complaining about unused variables, mostly the unused variable 'alignment'
for example:
/UI/ogdf/ogdf/basic/System.h:178: warning: unused variable 'alignment'

and finally, g++ fails during linking. I guess that is because something was not build correctly due to the first two errors.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: help with compiling >r3865 on MacOS needed

#5 Post by Geoff the Medio »

thawn wrote:However, now I am still getting the following errors trying to compile:

/universe/Condition.cpp:300: error: no match for 'operator!=' in 'sorted_it != std::multimap<_Key, _Tp, _Compare, _Alloc>::rend() [with _Key = double, _Tp = const UniverseObject*, _Compare = std::less<double>, _Alloc = std::allocator<std::pair<const double, const UniverseObject*> >]()'

/universe/Condition.cpp:330: error: no match for 'operator!=' in 'inv_hist_it != std::multimap<_Key, _Tp, _Compare, _Alloc>::rend() [with _Key = unsigned int, _Tp = double, _Compare = std::less<unsigned int>, _Alloc = std::allocator<std::pair<const unsigned int, double> >]()'
You appear to be using a slightly out of date version of the code, but I think those lines would be these:

Code: Select all

            for (std::multimap<double, const UniverseObject*>::const_reverse_iterator sorted_it = sort_key_objects.rbegin();
                 sorted_it != sort_key_objects.rend(); ++sorted_it)
and

Code: Select all

            for (std::multimap<unsigned int, double>::const_reverse_iterator inv_hist_it = inv_histogram.rbegin();
                 inv_hist_it != inv_histogram.rend(); ++inv_hist_it)
If that's the case, could you try removing the "const_" before "reverse_iterator" in both lines?
then some 30 warnings complaining about unused variables, mostly the unused variable 'alignment'
for example:
/UI/ogdf/ogdf/basic/System.h:178: warning: unused variable 'alignment'
If they're all in OGDF code, you should be able to just ignore those warnings.
and finally, g++ fails during linking. I guess that is because something was not build correctly due to the first two errors.
Most likely.

rkupke
Space Floater
Posts: 19
Joined: Tue Feb 01, 2011 4:09 pm

Re: help with compiling >r3865 on MacOS needed

#6 Post by rkupke »

Here is what I did to get revision 3955 and 3962 to compile:

Code: Select all

Revision 3955

1. Remove all red items from Source. The files are no longer there.

2. Inside Xcode: Select all items in Source > FreeOrion > GG > src > adobe, 
   Get info and remove the items from target GG

3. Get Info for target "FreeOrionClient", replace the header search path for
   graphviz with $(SRCROOT)/../UI/ogdf/

4. Drag the Folder freeorion-sdk -> FreeOrion -> UI -> ogdf
   to Source > FreeOrion > UI and add the items to target FreeOrionClient

5. Fix alignedMemoryAlloc16 in 
   Source > FreeOrion > UI > ogdf > ogdf > basic > System.h
   
   line 178 wrap the declaration (size_t alignment = 16;) in a conditional:
	#ifndef OGDF_SYSTEM_OSX
                size_t alignment = 16;
	#endif
   (not strictly necessary, but removes over 200 warnings)

6. Add freeorion-sdk -> FreeOrion -> UI -> PlayerListWnd.[cpp|h] to
   Source > FreeOrion > UI, add to target FreeOrionClient

7. Add freeorion-sdk -> FreeOrion -> GG -> src -> GroupBox.cpp to
   Source > FreeOrion > GG > src, Add to FreeOrionClient
   Add freeorion-sdk -> FreeOrion -> GG -> GG -> GroupBox.H to
   Source > FreeOrion > GG > GG

8. Add Source > FreeOrion > client > ClientApp.cpp to target FreeOrionServer

9. Add Source > FreeOrion > network > ClientNetworking.cpp to target FreeOrionServer

10. Add Source > FreeOrion > network > MessageQueue.cpp to target FreeOrionServer

11. Remove Header Search Path for graphviz from Project

12. Remove Framework Search Path $(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1) from target FreeOrionClient
13. Remove Library Search Path for graphviz from target FreeOrionClient
14. Remove Library Search Path $(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1) from target FreeOrionClient
15. Remove Library Search Path $(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2) from target FreeOrionClient
16. Remove Library Search Path $(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_3) from target FreeOrionClient
 
17. Remove Library Search Path $(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1) from target FreeOrionServer

18. Remove Library Search Path $(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1) from target FreeOrionAI
19. Remove Library Search Path $(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_2) from target FreeOrionAI

Revision 3962

20. add freeOrion-sdk --> FreeOrion --> UI TechTreeLayout.[cpp|h] to 
    Source > FreeOrion > UI ,add to target FreeOrionClient

[20a fix minor issue with template ">>" --> "> >"]
[20b comment out assert in TechTreeLayout::Node::DoLayout]

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: help with compiling >r3865 on MacOS needed

#7 Post by Geoff the Medio »

rkupke wrote:Here is what I did to get revision 3955 and 3962 to compile:
Do the 3955 changes also apply to 3962? The OGDF code should have been removed from SVN in 3960, so it shouldn't be necessary to add it to the XCode project...

Could you post your updated XCode project file(s) (zipped if appropriate) for the latest SVN, so they can be checked, and then possibly committed?

rkupke
Space Floater
Posts: 19
Joined: Tue Feb 01, 2011 4:09 pm

Re: help with compiling >r3865 on MacOS needed

#8 Post by rkupke »

Yes, the 3955 changes do apply to 3962. I think I can try to build without the ogdf files tomorrow.
My current (3962) project file is attached.
Attachments
FreeOrion.xcodeproj.zip
rev. 3962
(131.24 KiB) Downloaded 183 times

rkupke
Space Floater
Posts: 19
Joined: Tue Feb 01, 2011 4:09 pm

Re: help with compiling >r3865 on MacOS needed

#9 Post by rkupke »

3964 compiles without ogdf.
Attachments
FreeOrion.xcodeproj.zip
Project file Rev. 3964
(109.85 KiB) Downloaded 204 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: help with compiling >r3865 on MacOS needed

#10 Post by Geoff the Medio »

Cool; thanks. Do you release those changes under the GPL 2.0? I may want to commit to SVN after checking them out...

rkupke
Space Floater
Posts: 19
Joined: Tue Feb 01, 2011 4:09 pm

Re: help with compiling >r3865 on MacOS needed

#11 Post by rkupke »

I do release the changes under GPL 2.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: help with compiling >r3865 on MacOS needed

#12 Post by Geoff the Medio »

rkupke wrote:3964 compiles without ogdf.
Could you clarify what files in that zip I'd need to update and commit? Just the project.pbxproj in the FreeOrion.xcodeproj directory?

rkupke
Space Floater
Posts: 19
Joined: Tue Feb 01, 2011 4:09 pm

Re: help with compiling >r3865 on MacOS needed

#13 Post by rkupke »

Xcode stores user settings in <username>.mode* and <username>.pbxuser files. They are not relevant for other users.

All other files (currently just the "project.pbxproj") with the enclosing folder "FreeOrion.xcodeproj" need to be in svn.

Post Reply