building on FreeBSD

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Message
Author
User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

building on FreeBSD

#1 Post by Nagilum »

Since we recently discussed a possible FreeBSD port I'll try to provide timely feedback on the current state (meaning latest svn version) of FO on FreeBSD.
Currently (6765) "cmake ." fails:

Code: Select all

root@pbfbsd ~/FreeOrion > cmake .
-- The C compiler identification is Clang 3.3.0
-- The CXX compiler identification is Clang 3.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/CC
-- Check for working CXX compiler: /usr/bin/CC -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:58 (message):
  Unknown platform type! Your setup is not a supported platform for
  FreeOrion.


-- Configuring incomplete, errors occurred!
See also "/root/FreeOrion/CMakeFiles/CMakeOutput.log".
See also "/root/FreeOrion/CMakeFiles/CMakeError.log".
I also have a couple of gcc's installed which I could use if needed.
Attachments
CMakeError.log
(2.97 KiB) Downloaded 178 times
CMakeOutput.log
(13.66 KiB) Downloaded 163 times

User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: building on FreeBSD

#2 Post by Nagilum »

Fixed in svn6766.
Next issue:

Code: Select all

-- Boost version: 1.52.0
-- Found the following Boost libraries:
--   chrono
--   date_time
--   filesystem
--   signals
--   system
--   thread
CMake Error at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:10
8 (message):
  Could NOT find Freetype (missing: FREETYPE_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAI
LURE_MESSAGE)
  cmake/FindFreetype.cmake:178 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  GG/CMakeLists.txt:123 (find_package)


-- Configuring incomplete, errors occurred!
See also "/root/FreeOrion/CMakeFiles/CMakeOutput.log".
See also "/root/FreeOrion/CMakeFiles/CMakeError.log".
Of course I have freetype installed:

Code: Select all

root@pbfbsd ~/FreeOrion > pkg info freetype2
freetype2-2.5.2
Name           : freetype2
Version        : 2.5.2
Origin         : print/freetype2
Architecture   : freebsd:10:x86:64
Prefix         : /usr/local
Categories     : print
Maintainer     : [email protected]
WWW            : http://freetype.sourceforge.net/
Comment        : Free and portable TrueType font rendering engine
Options        :
        LCD_FILTERING  : on
        PNG            : on
Shared Libs required:
        libpng15.so.15
Shared Libs provided:
        libfreetype.so.9
Flat size      : 2.42MiB
Description    :
This includes some tools that are in FreeType 1's contrib directory.

ttf2pfb: Converting TrueType fonts to the Postscript Type 1 format.
ttf2pk:  A simple conversion tool to bring TrueType quality to the
         TeX world.
ttf2bdf: Produce bitmapped fonts from TrueType files for your X11
         applications.
ttfbanner: make posters using a TrueType font

WWW: http://freetype.sourceforge.net/
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


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

Re: building on FreeBSD

#3 Post by Dilvish »

do you have freetype2-dev installed? It looks like it couldn't find the include dirs.
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
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: building on FreeBSD

#4 Post by Nagilum »

"cmake -DREETYPE_INCLUDE_DIRS=/usr/local/include ."
helps.
Next error when building:

Code: Select all

[  8%] Built target log4cpp
[  8%] Building CXX object CMakeFiles/freeorioncommon.dir/combat/CombatLogManager.cpp.o
In file included from /root/FreeOrion/combat/CombatLogManager.cpp:1:
In file included from /root/FreeOrion/combat/CombatLogManager.h:5:
In file included from /root/FreeOrion/combat/CombatSystem.h:5:
In file included from /root/FreeOrion/combat/../universe/Universe.h:6:
/root/FreeOrion/combat/../universe/ObjectMap.h:143:72: error: no member named
      'operator!=' in
      'std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::map<int,
      boost::shared_ptr<UniverseObject>, std::__1::less<int>,
      std::__1::allocator<std::__1::pair<const int,
      boost::shared_ptr<UniverseObject> > > >::__value_type,
      std::__1::__tree_node<std::__1::map<int,
      boost::shared_ptr<UniverseObject>, std::__1::less<int>,
      std::__1::allocator<std::__1::pair<const int,
      boost::shared_ptr<UniverseObject> > > >::__value_type, void *> *, long> >'
        { return std::map<int, boost::shared_ptr<T> >::const_iterator::operator ...
                                                                       ^
/root/FreeOrion/combat/CombatLogManager.cpp:24:13: note: in instantiation of
      member function 'ObjectMap::const_iterator<UniverseObject>::operator!='
      requested here
         it != combat_info.objects.const_end(); ++it)
            ^
In file included from /root/FreeOrion/combat/CombatLogManager.cpp:1:
In file included from /root/FreeOrion/combat/CombatLogManager.h:5:
In file included from /root/FreeOrion/combat/CombatSystem.h:5:
In file included from /root/FreeOrion/combat/../universe/Universe.h:6:
/root/FreeOrion/combat/../universe/ObjectMap.h:154:71: error: no member named
      'operator==' in
      'std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::map<int,
      boost::shared_ptr<UniverseObject>, std::__1::less<int>,
      std::__1::allocator<std::__1::pair<const int,
      boost::shared_ptr<UniverseObject> > > >::__value_type,
      std::__1::__tree_node<std::__1::map<int,
      boost::shared_ptr<UniverseObject>, std::__1::less<int>,
      std::__1::allocator<std::__1::pair<const int,
      boost::shared_ptr<UniverseObject> > > >::__value_type, void *> *, long> >'
  ...if (std::map<int, boost::shared_ptr<T> >::const_iterator::operator ==(m_...
                                                               ^
/root/FreeOrion/combat/../universe/ObjectMap.h:117:13: note: [0min instantiation of
      member function 'ObjectMap::const_iterator<UniverseObject>::Refresh'
      requested here
            Refresh();
            ^
/root/FreeOrion/combat/CombatLogManager.cpp:24:49: note: in instantiation of
      member function 'ObjectMap::const_iterator<UniverseObject>::operator++'
      requested here
         it != combat_info.objects.const_end(); ++it)
                                                ^
2 errors generated.
*** Error code 1

Stop.
make[2]: stopped in /root/FreeOrion
*** Error code 1

Stop.
make[1]: stopped in /root/FreeOrion
*** Error code 1

Stop.
make: stopped in /root/FreeOrion
Last edited by Nagilum on Tue Jan 28, 2014 8:39 pm, edited 1 time in total.

User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: building on FreeBSD

#5 Post by Nagilum »

Dilvish wrote:do you have freetype2-dev installed? It looks like it couldn't find the include dirs.
FreeBSD is somewhat similar to Arch or Gentoo in that respect. There are no -dev packages; when you install it you get it all.

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

Re: building on FreeBSD

#6 Post by Geoff the Medio »

Try specifying UniverseObject as the template parameter to ObjectMap::const_iterator<> in CombatLog::CombatLog in CombatLogManager.cpp on line 24?

User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: building on FreeBSD

#7 Post by Nagilum »

You mean like this? (Sorry, not a C++ programmer)

Code: Select all

     20 {^M
     21     // compile all remaining and destroyed objects' ids^M
     22     object_ids = combat_info.destroyed_object_ids;^M
     23     for (ObjectMap::const_iterator<UniverseObject> it = combat_info.objects.const_begin();^M
     24          it != combat_info.objects.const_end(); ++it)^M
     25     { object_ids.insert(it->ID()); }^M
     26 }^M
If yes the result is this:

Code: Select all

[  8%] Building CXX object CMakeFiles/freeorioncommon.dir/combat/CombatLogManager.cpp.o
In file included from /root/FreeOrion/combat/CombatLogManager.cpp:1:
In file included from /root/FreeOrion/combat/CombatLogManager.h:5:
In file included from /root/FreeOrion/combat/CombatSystem.h:5:
In file included from /root/FreeOrion/combat/../universe/Universe.h:6:
/root/FreeOrion/combat/../universe/ObjectMap.h:143:72: error: no member named
      'operator!=' in
      'std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::map<int,
      boost::shared_ptr<UniverseObject>, std::__1::less<int>,
      std::__1::allocator<std::__1::pair<const int,
      boost::shared_ptr<UniverseObject> > > >::__value_type,
      std::__1::__tree_node<std::__1::map<int, boost::shared_ptr<UniverseObject>,
      std::__1::less<int>, std::__1::allocator<std::__1::pair<const int,
      boost::shared_ptr<UniverseObject> > > >::__value_type, void *> *, long> >'
        { return std::map<int, boost::shared_ptr<T> >::const_iterator::operator !=(o...
                                                                       ^
/root/FreeOrion/combat/CombatLogManager.cpp:24:13: note: in instantiation of member
      function 'ObjectMap::const_iterator<UniverseObject>::operator!=' requested
      here
         it != combat_info.objects.const_end(); ++it)
            ^
In file included from /root/FreeOrion/combat/CombatLogManager.cpp:1:
In file included from /root/FreeOrion/combat/CombatLogManager.h:5:
In file included from /root/FreeOrion/combat/CombatSystem.h:5:
In file included from /root/FreeOrion/combat/../universe/Universe.h:6:
/root/FreeOrion/combat/../universe/ObjectMap.h:154:71: error: no member named
      'operator==' in
      'std::__1::__map_const_iterator<std::__1::__tree_const_iterator<std::__1::map<int,
      boost::shared_ptr<UniverseObject>, std::__1::less<int>,
      std::__1::allocator<std::__1::pair<const int,
      boost::shared_ptr<UniverseObject> > > >::__value_type,
      std::__1::__tree_node<std::__1::map<int, boost::shared_ptr<UniverseObject>,
      std::__1::less<int>, std::__1::allocator<std::__1::pair<const int,
      boost::shared_ptr<UniverseObject> > > >::__value_type, void *> *, long> >'
            if (std::map<int, boost::shared_ptr<T> >::const_iterator::operat...
                                                                      ^
/root/FreeOrion/combat/../universe/ObjectMap.h:117:13: note: in instantiation of
      member function 'ObjectMap::const_iterator<UniverseObject>::Refresh' requested
      here
            Refresh();
            ^
/root/FreeOrion/combat/CombatLogManager.cpp:24:49: note: in instantiation of member
      function 'ObjectMap::const_iterator<UniverseObject>::operator++' requested
      here
         it != combat_info.objects.const_end(); ++it)
                                                ^
2 errors generated.
So one of the errors is gone if I see this right.

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

Re: building on FreeBSD

#8 Post by Geoff the Medio »

Nagilum wrote:You mean like this?
Yes. Looks like it made no difference, though.

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

Re: building on FreeBSD

#9 Post by Dilvish »

this reminds me of the warning you saw here Now, for my compiler, omitting the ::iterator makes my IDE confused, but maybe your compiler in freeBSD is one of those that doesn't want the "iterator::" -- perhaps try editing ObjectMap.h to take those ones out flagged by cppcheck and see what happens
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
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: building on FreeBSD

#10 Post by Nagilum »

FreeBSD 10 default CC is clang3.3 (vs.gcc-4.2.1 on 9). I tried what you said but it made no difference.
I'll now try the easy way out and see what happens when using gcc-4.8.
So just for the record I'll now invoke cmake like:
"CC=gcc48 CXX=g++48 CPP=cpp48 cmake -DFREETYPE_INCLUDE_DIRS=/usr/local/include ."

User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: building on FreeBSD

#11 Post by Nagilum »

Next stop (svn 6766):

Code: Select all

[ 25%] Building CXX object CMakeFiles/freeorioncommon.dir/util/Directories.cpp.o
/root/FreeOrion/util/Directories.cpp:296:4: error: #error Neither FREEORION_LINUX nor FREEORION_WIN32 set
 #  error Neither FREEORION_LINUX nor FREEORION_WIN32 set
    ^
/root/FreeOrion/util/Directories.cpp:19:10: warning: '{anonymous}::g_initialized' defined but not used [-Wunused-variable]
     bool g_initialized = false;
          ^
*** Error code 1
And before I forget the FreeBSD pendant to Linux' "/proc/self/exe" is "/proc/curproc/file".

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

Re: building on FreeBSD

#12 Post by Geoff the Medio »

If there are few differences between the Linux and BSD systems, you might be able to define FREEORION_LINUX and FREEORION_FREEBSD in CMake (using the add_definitions as already is done), and then modify that Directories.cpp code to specify the BSD version of the current binary when FREEORION_FREEBSD is defined.

Or, treat FREEORION_FREEBSD as a separate platform entirely, and add cases for it whenever these situations occur...

Edit: Maybe start by changing the #elif defined(FREEORION_LINUX) line to

Code: Select all

#elif (defined(FREEORION_LINUX) || defined(FREEORION_FREEBSD))

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

Re: building on FreeBSD

#13 Post by Dilvish »

expanding slightly on Geoff's suggestion, the cmake variable "CMAKE_SYSTEM_NAME" at line 51 of CMakeLists.txt is probably coming up "FreeBSD", so you may want to add an extra elseif section for that, which sets FREEORION_FREEBSD in addition to FREEORION_LINUX and ENABLE_BINRELOC
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
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: building on FreeBSD

#14 Post by Nagilum »

Changing util/Directories.cpp:

Code: Select all

#elif defined(FREEORION_LINUX)
to

Code: Select all

#elif defined(FREEORION_LINUX) || defined(FREEORION_FREEBSD)
did the trick for now.
We'll see if it actually works later I suppose.

User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: building on FreeBSD

#15 Post by Nagilum »

Next stop (svn 6766):

Code: Select all

[ 40%] Building CXX object GG/src/CMakeFiles/GiGi.dir/Font.cpp.o
/root/FreeOrion/GG/src/Font.cpp:33:22: fatal error: ft2build.h: No such file or directory
 #include <ft2build.h>
                      ^
compilation terminated.
*** Error code 1
Time to sleep.

Post Reply