Hi guys, I’m very glad to become one member of VCMI. I registered just now. I have been a big fan of heros 3 since I was a kid.
I’m now reading the code, build it and try to do some improvement if possible. I tried to build the source on both Ubuntu 12.04 and Maverick(OSx 10.9). I’ve already solved a lot of problems I encountered, but still failed to deal with some difficulties. I did a lot of research on Google, but without luck, still can’t solve it. Could you guys help me out? I would really appreciate it.
Here are the problems:
Source version: vcmi-0.95 (release)
1.Building on Maverick(OSx 10.9):
I followed exactly as what the wiki says to build on Mac OS. I installed the boost and sdl2 library through Homebrew. Then after I ran cmake, it also complains about the SDL2 related error. So I searched online, and got the SDL2_image, SDL2_mixer and SDL2_ttf framework, then put them into the /Library/Framworks directory (as the official website says). And after I ran cmake, it shows me the following message:
-- Boost version: 1.51.0
-- Found the following Boost libraries:
-- program_options
-- filesystem
-- system
-- thread
-- locale
-- checking for module 'SDL2_image'
-- package 'SDL2_image' not found
-- checking for module 'SDL2_mixer'
-- package 'SDL2_mixer' not found
-- checking for module 'SDL2_ttf'
-- package 'SDL2_ttf' not found
-- cotire 1.5.2 loaded.
-- MINIZIP_INCLUDE_PATH (missing: MINIZIP_LIB)
-- Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
BattleAI
EmptyAI
StupidAI
VCAI
minizip
vcmi
This warning is for project developers. Use -Wno-dev to suppress it.
-- Generating done
-- Build files have been written to: /Users/dreamer/workspace/vcmi/build
I’m not sure why it still complains that it can’t find the SDL2 related package. Since no error generated, I assumed it’s good to build the code with XCode and moved on to the next step. I started XCode, click ‘Build’. The compilation is pretty good, but when linking to library, error occurred:
Ld bin/Debug/libvcmi.dylib normal x86_64
cd /Users/dreamer/workspace/vcmi
export MACOSX_DEPLOYMENT_TARGET=10.9
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/dreamer/workspace/vcmi/bin/Debug -F/Users/dreamer/workspace/vcmi/bin/Debug -filelist /Users/dreamer/workspace/vcmi/build/lib/vcmi.build/Debug/vcmi.build/Objects-normal/x86_64/vcmi.LinkFileList -install_name @rpath/libvcmi.dylib -Xlinker -rpath -Xlinker @executable_path/../Frameworks -Xlinker -rpath -Xlinker @executable_path/ -mmacosx-version-min=10.9 -dynamiclib -Wl,-headerpad_max_install_names /Users/dreamer/workspace/vcmi/bin/Debug/libminizip.dylib /Users/dreamer/workspace/lib/libboost_program_options.a /Users/dreamer/workspace/lib/libboost_filesystem.a /Users/dreamer/workspace/lib/libboost_system.a /Users/dreamer/workspace/lib/libboost_thread.a /Users/dreamer/workspace/lib/libboost_locale.a /usr/local/lib/libSDL2.dylib -framework Cocoa /usr/lib/libz.dylib -liconv -ldl -stdlib=libc++ -single_module -Xlinker -dependency_info -Xlinker /Users/dreamer/workspace/vcmi/build/lib/vcmi.build/Debug/vcmi.build/Objects-normal/x86_64/vcmi_dependency_info.dat -o /Users/dreamer/workspace/vcmi/bin/Debug/libvcmi.dylib
Undefined symbols for architecture x86_64:
"VCMIDirsOSX::libraryName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
vtable for VCMIDirsOSX in VCMIDirs.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried very hard, but really can’t solve this problem. :’(
2.Building on Ubuntu 12.04:
This Ubuntu is installed on my Parallel 9 on my Maverick. I updated gcc and g++ from 4.6 to 4.7 to support the C++11.
After solving all the dependency issues, I typed “make” to build the whoe project. If I just type make to build, then the compilation stucks when it’s trying link(compile?) the “GameState.cpp.o” (I don’t quite remember the exact name). If I type “make -j2”, it also stuck at this step. I mean the terminal just hangs there(like busy waiting).
I’m not sure if this is caused by the dependencies of multiple threading when run ubuntu on VM. I’ve already ordered a 256G SSD for my old laptop, and plan to install a real ubuntu on that machine. I’ll try compile the project again on that machine tomorrow when it’s delivered.
I really want to delve into this project and really appreciate your help. Thank you!