I found I couldn’t build mapcrafter, a high performance Minecraft map renderer written in C++, on my own RHEL6.6 without some workaround and additional RPM packages. This is just a memo. It may be useful info for CentOS users, I guess.
At first, you need to install the newer boost packages from the EPEL repo. If you didn’t enable the repo, issue a following command or enable the repo manually.
# yum install http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
EPEL offers boost-1.48 with the package name, boost148-*, you can install them.
# yum install boost148-devel boost148-iostreams boost148-system boost148-filesystem boost148-program_options
As mapcrafter is written in C++11 and RHEL6 is shipped with old gcc-4.4, you also need to install the latest devtoolset including gcc-4.9 from scl, Software Collection repo. Check whether the scl repo is enabled and enable it.
# subscription-manager repos --list-enabled
# subscription-manager repos --enable=rhel-server-rhscl-6-rpms
After enabling the repo, install the newer gcc-c++ package from the repo.
# yum install devtoolset-3-gcc-c++
OK, now you can download the latest source codes of mapcrafter with git command.
# git clone https://github.com/mapcrafter/mapcrafter.git
# cd mapcrafter
Add two lines to the CMakeList.txt under the mapcrafter/
directory in order to make the gcc use boost148. NEVER EDIT other CMakeList.txt
such as mapcrafter/src/CMakeList.txt
.
--- mapcrafter.orig/CMakeLists.txt 2015-08-13 12:23:29.059788712 +0900
+++ mapcrafter/CMakeLists.txt 2015-08-13 12:25:42.440261458 +0900
@@ -49,6 +49,8 @@
include_directories(${ZLIB_INCLUDE_DIRS})
endif()
+SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/usr/include/boost148")
+SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/usr/lib64/boost148")
find_package(Boost COMPONENTS iostreams system filesystem program_options REQUIRED)
if(OPT_USE_BOOST_THREAD)
find_package(Boost COMPONENTS thread REQUIRED)
Run cmake command via scl command.
# scl enable devtoolset-3 'cmake .'
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /opt/rh/devtoolset-3/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-3/root/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-3/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-3/root/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Boost version: 1.48.0
-- Found the following Boost libraries:
-- iostreams
-- system
-- filesystem
-- program_options
-- 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
-- Boost version: 1.48.0
-- Found the following Boost libraries:
-- unit_test_framework
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3")
-- Found PNG: /usr/lib64/libpng.so (found version "1.2.49")
-- Found JPEG: /usr/lib64/libjpeg.so
-- Performing Test HAVE_NULLPTR
-- Performing Test HAVE_NULLPTR - Success
-- Performing Test HAVE_ENUM_CLASS_COMPARISON
-- Performing Test HAVE_ENUM_CLASS_COMPARISON - Success
-- Looking for include file endian.h
-- Looking for include file endian.h - found
-- Looking for include file sys/endian.h
-- Looking for include file sys/endian.h - not found
-- Looking for include file sys/ioctl.h
-- Looking for include file sys/ioctl.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file syslog.h
-- Looking for include file syslog.h - found
-- Performing Test HAVE_ENDIAN_CONVERSION
-- Performing Test HAVE_ENDIAN_CONVERSION - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /root/mapcrafter
Let’s build mapcrafter binaries!
# scl enable devtoolset-3 'make'
Scanning dependencies of target version.cpp
[ 1%] Built target version.cpp
Scanning dependencies of target mapcraftercore
[ 3%] Building CXX object src/mapcraftercore/CMakeFiles/mapcraftercore.dir/version.cpp.o
[ 5%] Building CXX object src/mapcraftercore/CMakeFiles/mapcraftercore.dir/config/configparser.cpp.o
[ 7%] Building CXX object src/mapcraftercore/CMakeFiles/mapcraftercore.dir/config/iniconfig.cpp.o
......
Linking CXX executable testtextures
[100%] Built target testtextures
You may see some warnings in compiling and linking. Ignore them 🙂
# make install
[ 1%] Built target version.cpp
[ 74%] Built target mapcraftercore
[ 75%] Built target mapcrafter
[ 77%] Built target mapcrafter_markers
[ 94%] Built target test_all
[ 96%] Built target nbtdump
[ 98%] Built target testconfig
[100%] Built target testtextures
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/mapcrafter
-- Removed runtime path from "/usr/local/bin/mapcrafter"
-- Installing: /usr/local/bin/mapcrafter_markers
.........
Check if the binaries exist under /usr/local/bin
.
# ll /usr/local/bin/
total 332
-rwxr-xr-x. 1 root root 177673 Aug 13 12:49 mapcrafter
-rwxr-xr-x. 1 root root 142925 Aug 13 12:49 mapcrafter_markers
-rwxr-xr-x. 1 root root 9362 Aug 13 12:43 mapcrafter_png-it.py
-rwxr-xr-x. 1 root root 3837 Aug 13 12:43 mapcrafter_textures.py
I don’t know why ‘make install‘ don’t copy .so
to /usr/lib64/
. If you, of course me too, don’t want to install .so
under /usr/lib64/
, you need to edit mapcrafter/src/mapcraftercore/cmake_install.cmake
.
# cp mapcrafter/src/mapcraftercore/libmapcraftercore.so /usr/lib64/
You can consult with documentation for textures and resources used by mapcrafter. Enjoy!