Compiling Catapult on Debian Stretch

Hi all.

I’m trying to compile catapult-server in a Debian way as far as possible. That’s my goal.

Satisfied needed dependencies

Dependency Debian version Task
cmake 3.7.2 apt install cmake
python 3 3.5.3 apt install python3
boost 1.62.0.1 apt install libboost-all-dev
gtest 1.8.0-6 apt install libgtest-dev. Then, I had to do this: cd /usr/src/gtest; cmake CMakeLists.txt; make; and cp *.a /usr/lib/ *
mongo ** 1.4.2-1+b1 apt instal libmongoc-dev libmongoc-1.0-0
mongo-cxx *** 1.1.2-5 apt install libmongoclient-dev libmongoclient0
zmq 4.2.1-4 apt install libzmq3-dev
rocksdb 4.5.1-2 apt install librocksdb-dev

C and CXX compiler: GNU 6.3.0

First “solved” problem: setting mongo libraries

In the building phase, I had to hard-code some variables used to locate mongo dependencies in catapult-server/extensions/mongo/CMakeLists.txt:

## find and set mongo includes and libraries
function(catapult_add_mongo_dependencies TARGET_NAME)
    add_definitions(-DBSONCXX_STATIC -DMONGOCXX_STATIC)
    include_directories(SYSTEM /usr/lib/x86_64-linux-gnu/)
    target_link_libraries(${TARGET_NAME} /usr/lib/x86_64-linux-gnu/libmongoclient.so /usr/lib/x86_64-linux-gnu/libbson-1.0.so /usr/lib/x86_64-linux-gnu/libmongoc-1.0.so ${MONGO_ADDITIONAL_LIBS})
endfunction()

It’s not elegant and we are still to know if it really works or not.

After build: problem compiling

The configuration and generation of build files was done well. After this I made make publish, but when I executed make, an error appeared at cache_db target:

Scanning dependencies of target catapult.cache_db
[ 11%] Building CXX object src/catapult/cache_db/CMakeFiles/catapult.cache_db.dir/RdbColumnContainer.cpp.o
/root/catapult-server/src/catapult/cache_db/RdbColumnContainer.cpp: In constructor 'catapult::cache::RdbColumnContainer::RdbColumnContainer(catapult::cache::RocksDatabase&, size_t)':
/root/catapult-server/src/catapult/cache_db/RdbColumnContainer.cpp:42:76: error: invalid use of incomplete type 'class rocksdb::PinnableSlice'
     : static_cast<size_t>(*reinterpret_cast<const uint64_t*>(iter.storage().data()));
                                                                            ^
In file included from /root/catapult-server/src/catapult/cache_db/RdbColumnContainer.cpp:22:0:
/root/catapult-server/src/catapult/cache_db/RocksDatabase.h:30:8: note: forward declaration of 'class rocksdb::PinnableSlice'
  class PinnableSlice;
        ^~~~~~~~~~~~~
src/catapult/cache_db/CMakeFiles/catapult.cache_db.dir/build.make:62: recipe for target 'src/catapult/cache_db/CMakeFiles/catapult.cache_db.dir/RdbColumnContainer.cpp.o' failed
make[2]: *** [src/catapult/cache_db/CMakeFiles/catapult.cache_db.dir/RdbColumnContainer.cpp.o] Error 1
CMakeFiles/Makefile2:434: recipe for target 'src/catapult/cache_db/CMakeFiles/catapult.cache_db.dir/all' failed
make[1]: *** [src/catapult/cache_db/CMakeFiles/catapult.cache_db.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

I don’t know if upgrading my C(++) compiler solve the problem or if I need to made minor changes to source code.

Has someone successfully compiled catapult? I’ll appreciate your support.

Regards.

Maybe instead of compiling yourself just use ready to use docker image:

Hi, @CryptoBeliever.

Docker image is a good solution to distribute services. However, in Venezuela, we have our own GNU/Linux distribution and a strong Debian culture. Taking this and other reasons based on the community contribution, we are engaged to making Catapult work in Debian Stable. The second step in this line will be to package it for Debian.

Thanks for your orientation.

I’m afraid I can’t help here much. Didn’t try compile yet.
@gimre have you some time to look at it? Write libraries versions and so on :slight_smile:

Successful catapult compilation in slackware linux.
Episodio 1: Compilación de NEM Catapult en Slackware 14.2

for multiple reasons i would discourage that.
We’re relying on specific versions of libraries that might conflict with OS packages