building on FreeBSD

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

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

Re: building on FreeBSD

#31 Post by Dilvish »

Nagilum wrote:FreeBSD now has boost1.55 which I believe is the root cause for this problem.
Unfortunately don't really know how to work around this. :(
That boost code looks like it should be fine, and that portion at least looks like it has has been around since boost 1.45. The comment preceding it says

Code: Select all

  //! A function to replace the std::transform( , , ,tolower) construct
  /*! This function simply takes a string, and changes all the characters
   * in that string to lowercase (according to the default system locale).
   * In the event that a compiler does not support locales, the old
   * C style tolower() is used.
   */
which suggests that perhaps the problem is that your boost was compiled with the BOOST_DATE_TIME_NO_LOCALE flag not defined so it is trying to use the tolower version with locale, but perhaps your current compiler is not supporting locales, or perhaps you simply don't have a locale set?
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

#32 Post by Nagilum »

locale says:

Code: Select all

LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
There are no options for the port that would seem to be related.
So I guess I should rebuild boost with something like:

Code: Select all

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=en_US.UTF-8
being set. Lets see if it make any difference.

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

Re: building on FreeBSD

#33 Post by Nagilum »

It makes no difference.
I also re-did the FO cmake & make.

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

Re: building on FreeBSD

#34 Post by Dilvish »

hmm, I'm not sure if this would cause other problems, but if you built boost with BOOST_DATE_TIME_NO_LOCALE defined, then boost would use the simpler version of std::tolower that doesn't have a locale. Doesn't really seem like a good solution, but might get FO to compile in that environment.
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

#35 Post by Nagilum »

For now I've worked around the issue like this:
[root@orion ~/FreeOrion]# cd server
[root@orion ~/FreeOrion/server]# /usr/local/bin/g++48 -DBOOST_DATE_TIME_NO_LOCALE -DADOBE_STD_SERIALIZATION -DENABLE_BINRELOC -DFREEORION_BUILD_SERVER -DFREEORION_FREEBSD -Wno-deprecated -Wall -Wno-parentheses -fvisibility=hidden -I/usr/local/include -I/root/FreeOrion -I/root/FreeOrion/GG -I/root/FreeOrion/log4cpp -I/root/FreeOrion/OpenSteer/include -I/usr/local/include/python2.7 -o CMakeFiles/freeoriond.dir/__/universe/PythonUniverseGenerator.cpp.o -c /root/FreeOrion/universe/PythonUniverseGenerator.cpp
BOOST_DATE_TIME_NO_LOCALE is somehow dynamically determined but it seems quite complicated and depend on a lot of things. :o
Anyhow now it stops at:

Code: Select all

Scanning dependencies of target freeorion
[ 81%] Building CXX object client/human/CMakeFiles/freeorion.dir/HumanClientApp.cpp.o
[ 81%] Building CXX object client/human/CMakeFiles/freeorion.dir/chmain.cpp.o
/root/FreeOrion/client/human/chmain.cpp:82:5: error: expected unqualified-id before 'if'
     if (GetOptionsDB().Get<bool>("help")) {
     ^
/root/FreeOrion/client/human/chmain.cpp:88:5: error: expected unqualified-id before 'if'
     if (mainSetupAndRunOgre() != 0) {
     ^
/root/FreeOrion/client/human/chmain.cpp:92:5: error: expected unqualified-id before 'return'
     return 0;
     ^
/root/FreeOrion/client/human/chmain.cpp:93:1: error: expected declaration before '}' token
 }
 ^
*** Error code 1

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

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

Re: building on FreeBSD

#36 Post by Nagilum »

Code: Select all

root@pbfbsd ~/orion/root/FreeOrion > svn diff client/human/chmain.cpp
Index: client/human/chmain.cpp
===================================================================
--- client/human/chmain.cpp     (revision 6904)
+++ client/human/chmain.cpp     (working copy)
@@ -60,6 +60,19 @@
         return 1;
     }
 #endif
+#ifdef FREEORION_FREEBSD
+int main(int argc, char* argv[]) {
+    // copy command line arguments to vector
+    std::vector<std::string> args;
+    for (int i = 0; i < argc; ++i)
+        args.push_back(argv[i]);
+
+    // set options from command line or config.xml, or generate config.xml
+    if (mainConfigOptionsSetup(args) != 0) {
+        std::cerr << "main() failed config." << std::endl;
+        return 1;
+    }
+#endif
 #ifdef FREEORION_WIN32
 int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) {
     // copy UTF-16 command line arguments to UTF-8 vector
This helped.

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

Re: building on FreeBSD

#37 Post by Geoff the Medio »

Try combining them, if it's just a duplication...

Code: Select all

#if defined(FREEORION_LINUX) || defined(FREEORION_FREEBSD)
int main(int argc, char* argv[]) {
    // copy command line arguments to vector
    std::vector<std::string> args;
    for (int i = 0; i < argc; ++i)
        args.push_back(argv[i]);

    // set options from command line or config.xml, or generate config.xml
    if (mainConfigOptionsSetup(args) != 0) {
        std::cerr << "main() failed config." << std::endl;
        return 1;
    }
#endif

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

Re: building on FreeBSD

#38 Post by Nagilum »

Combining worked - done.
Thanks!

Success!
First compile of FO completed. :)
Now I have to see if I can make it run too. So far I have done this build in a VirtualBox without X11..

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

Re: building on FreeBSD

#39 Post by Nagilum »

Just to give an update.
It works, I can run FO within the jail. The basic recipe is:

Code: Select all

xhost +
jailme <jid> freeorion -f
Obviously this is far from ideal since the jail to be running and xhost + opens up X to any conections.
But at least it works. Now we have to figure out a way to make this work in a more standard manner.
The best solution would still be if we were able to compile FO with clang.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: building on FreeBSD

#40 Post by adrian_broher »

Nagilum wrote:The best solution would still be if we were able to compile FO with clang.
That's an easy one: just fix the places where clang complains about. :o)

But seriously: I can't reproduce the issue about operator== and operator!= you reported on fedora with clang 3.3. But I get compile errors when the compile reaches the ASL stuff inside the parser project.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: building on FreeBSD

#41 Post by Vezzra »

adrian_broher wrote:But seriously: I can reproduce the issue about operator== and operator!= you reported on fedora with clang 3.3. But I get compile errors when the compile reaches the ASL stuff inside the parser project.
This is going to be an issue on OSX too... once I move to a recent version of Xcode (which I'll have to do once I upgrade to Mavericks AFAIK, and I won't be able to postpone that forever), I'll also have to use clang, as gcc support is dropped in Xcode4+.

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

Re: building on FreeBSD

#42 Post by Nagilum »

adrian_broher wrote:
Nagilum wrote:The best solution would still be if we were able to compile FO with clang.
That's an easy one: just fix the places where clang complains about. :o)
I have no clue about serious C++ I'm afraid. If it was Perl I would use Data::Dump(er) to dump the structure and everything would be plain to see or test.. :-/
adrian_broher wrote:But seriously: I can't reproduce the issue about operator== and operator!= you reported on fedora with clang 3.3. But I get compile errors when the compile reaches the ASL stuff inside the parser project.
That is indeed weird and I currently have no idea what the root cause could be since I get the same error with clang3.4 from ports (in case the base clang had some unusual patches..).

Post Reply