VCMI on Linux

Wow… quite a lot of errors. You can try to comment out whole ERMParser.cpp files together with lines 60 - 78 of VCMI_Lib.cpp. It should help. I don’t know when it’ll be fixed in SVN, it compiles on Windows + MSVC 2010 without problems (and I don’t have any Linux installed).

m_gol,
Try latest revision (2055). Not a real fix but compilation should be fine now.

Considering that it will take time till major distros will get boost 1.46 this is better than forcing everyone to use newest boost.
I’ve added boost version check to ERMParser.

I didn’t notice that m_gol is using boost 1.40… I thought VCMI is incompatible with such old version anyway…

Sorry for not writing back, I was away for a while.

If VCMI is incompatible with boost 1.40, maybe you should include a proper check in the configure script? :slight_smile: Now it’s checking for >= 1.36. Anyway, I upgraded to the latest Ubuntu (Maverick, 10.10) yesterday and now I have libboost 1.42.

I tried to compile it now (revision 2062) and now make fails even faster:

$ make
Making all in lib
make[1]: Entering directory `/home/mgol/Programs/vcmi/lib'
  CXX    libvcmi_la-BattleAction.lo
In file included from BattleAction.h:5,
                 from BattleAction.cpp:2:
../global.h: In function ‘std::string toString(const T&)’:
../global.h:357: error: invalid use of incomplete type ‘struct std::ostringstream’
/usr/include/c++/4.4/iosfwd:71: error: declaration of ‘struct std::ostringstream’
make[1]: *** [libvcmi_la-BattleAction.lo] Error 1
make[1]: Leaving directory `/home/mgol/Programs/vcmi/lib'
make: *** [all-recursive] Error 1

It’s not a problem with boost, it’s a bug on our side. I’ll fix it soon.

Do you have boost 1.46? There is only one file (ERMParser.cpp) which doesn’t work with old boost - everything else should work fine with old one. And most possibly this file will be completely optional for some time.
If I’ll increase minimal boost version to 1.46 most of Linux users will need either to compile boost themselves or find third-party repositories with 1.46 (I doubt that there are any major distros with 1.46 in main repository)

There are some other compilation errors after this one. Will fix.

The current code (r2068) compiles with boost 1.40 (besides the ERM parser). I don’t know whether the versions before that are still supported. But if there’s no report of incompatibility, the check should stay at 1.36.

I have compiled VCMI with Fedora 14 recently. Some DSO Bugs occured during linking, so I had to add a few libraries to the linker add setting of some makefile files.

Are there any conditional possibilites for our makefile files, so that only for Fedora >= 13 those libs are added to the linker or isn’t it so important if those linker settings apply to every linux distro?

Thanks for the link - it explains all that linkage errors I got with gcc-4.5 on Ubuntu.
It looks that same changes are coming to Debian as well so applying your changes to all distros will be required soon.

Hi, i have some strange problem when compiling VCMI on kubuntu 11.04. Everything seems fine, i get the executables, they work, until i load a map. I get these errrors:

Initializing mapHandler (together): 200
Loaded AI named Genius 1.0
Loaded AI named Genius 1.0
Loaded AI named Genius 1.0
Loaded AI named Stupid AI 0.1
CStupidAI [0xb585020]: created
CStupidAI [0xb585020]: init called, saving ptr to IBattleCallback
Segmentation fault
Server finished
Lost connection to server, ending listening thread!                                                                       
Broken pipe                                                                                                               
Something wrong, lost connection while game is still ongoing...
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
  what():  Broken pipe
Aborted

One of the process is crashing. You’ll have to do a post mortem analysis with the core file.

vcmi runs fine for me on ubuntu 10.10.

I’m trying to compile VCMI on OpenSuSE 11.4 64 bit and I get such error. :

  CXX    vcmiclient-CBattleInterface.o
CBattleInterface.cpp: In member function ‘void CBattleInterface::hexLclicked(int)’:
CBattleInterface.cpp:2704:73: warning: suggest parentheses around ‘&&’ within ‘||’
CBattleInterface.cpp: In constructor ‘CBattleResultWindow::CBattleResultWindow(const BattleResult&, const SDL_Rect&, CBattleInterface*)’:
CBattleInterface.cpp:4400:15: error: invalid use of incomplete type ‘struct IMainVideoPlayer’
CGameInfo.h:17:7: error: forward declaration of ‘struct IMainVideoPlayer’
CBattleInterface.cpp:4420:15: error: invalid use of incomplete type ‘struct IMainVideoPlayer’
CGameInfo.h:17:7: error: forward declaration of ‘struct IMainVideoPlayer’
CBattleInterface.cpp:4427:15: error: invalid use of incomplete type ‘struct IMainVideoPlayer’
CGameInfo.h:17:7: error: forward declaration of ‘struct IMainVideoPlayer’
CBattleInterface.cpp:4434:15: error: invalid use of incomplete type ‘struct IMainVideoPlayer’
CGameInfo.h:17:7: error: forward declaration of ‘struct IMainVideoPlayer’
CBattleInterface.cpp: In member function ‘virtual void CBattleResultWindow::show(SDL_Surface*)’:
CBattleInterface.cpp:4464:13: error: invalid use of incomplete type ‘struct IMainVideoPlayer’
CGameInfo.h:17:7: error: forward declaration of ‘struct IMainVideoPlayer’
CBattleInterface.cpp: In member function ‘void CBattleResultWindow::bExitf()’:
CBattleInterface.cpp:4480:13: error: invalid use of incomplete type ‘struct IMainVideoPlayer’
CGameInfo.h:17:7: error: forward declaration of ‘struct IMainVideoPlayer’
make[1]: *** [vcmiclient-CBattleInterface.o] Error 1

The video player is in flux right now. Use svn rev 2281 until it’s fixed.

After updating to Ubuntu 11.10 (amd64, gcc 4.6.1, boost 1.46.1) VCMI compilation fails:

  CXXLD  vcmiclient
/usr/bin/ld: vcmiclient-Client.o: undefined reference to symbol 'boost::system::system_category()'
/usr/bin/ld: note: 'boost::system::system_category()' is defined in DSO /usr/lib/libboost_system.so.1.46.1 so try adding it to the linker command line
/usr/lib/libboost_system.so.1.46.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[1]: *** [vcmiclient] Error 1

Same error goes for vcmiserver.
It looks that gcc is trying to inline some functions which results in these errors. According to config.log -O2 switch was set somewhere.
But there are two things that I still don’t get:

  1. Where this switch is coming from? It was not specified by me so it should come from build system.
  2. Why optimized build results in error? This should be fixed sooner or later.

config.log - pastebin.com/yVQLmu5a

I think they use the new stricter LD.

Add @BOOST_SYSTEM_LIB@ on the LDADD line in client/Makefile.am

I remember that there was a solution for libSDL installed in /usr/lib64 instead of /usr/lib, but I can’t find it anywhere. Could someone repost it?

Try:

Compiling VCMI on ArchLinux x86 fails at linking vcmiclient with the following output:

...
CXXLD  vcmiclient
/usr/bin/ld: vcmiclient-Client.o: undefined reference to symbol 'shm_open@@GLIBC_2.2'
/usr/bin/ld: note: 'shm_open@@GLIBC_2.2' is defined in DSO /lib/librt.so.1 so try adding it to the linker command line
/lib/librt.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [vcmiclient] Error 1
make[2]: Leaving directory `/tmp/heroes3_vcmi/client'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/heroes3_vcmi/client'
make: *** [all-recursive] Error 1

TIA for any helpful hints as to solving this.

It seems the -lrt is needed.
In client/Makefile.am, add -lrt after -lz.

Ivan, you removed it in r2503, what was the reason? May be we need to add a test in configure.in.

Yeah. There is a problem with Mac OS - librt is unavailable on it so there should be some way to check OS and do not add librt for Macs.
Not sure how to do add such test into configure though. Can somebody fix this?