Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile on Ubuntu Server 18.04 #151

Closed
skubakdj opened this issue May 20, 2019 · 10 comments
Closed

Can't compile on Ubuntu Server 18.04 #151

skubakdj opened this issue May 20, 2019 · 10 comments

Comments

@skubakdj
Copy link

Hello and thanks for this awesome project!

I'm unable to compile OpenMonero on a fresh instance of Ubuntu Server 18.04. I was able to first build Monero (as described in the instructions), but following the rest of the steps to compile OpenMonero fails at cmake ... Here's the full output:

ubuntu@ip:~/openmonero/build$ cmake ..
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- MONERO_DIR: ~/monero
-- Could NOT find MYSQL (missing: REQUIRED_VARS VERSION_VAR MYSQL_VERSION_STRING) 
-- Configuring directory /home/ubuntu/openmonero/build/config
-- Configuring file config.json
-- Looking for pthread.h
-- Looking for 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.65.1
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   chrono
--   regex
--   serialization
--   program_options
--   date_time
--   atomic
-- MONERO_DIR: ~/monero
-- FindMonero Xmr_CRYPTONOTE_CORE_LIBRARIES /home/ubuntu/monero/build/release/src/cryptonote_core/libcryptonote_core.a
-- FindMonero Xmr_BLOCKCHAIN_DB_LIBRARIES /home/ubuntu/monero/build/release/src/blockchain_db/libblockchain_db.a
-- FindMonero Xmr_CRYPTONOTE_PROTOCOL_LIBRARIES /home/ubuntu/monero/build/release/src/cryptonote_protocol/libcryptonote_protocol.a
-- FindMonero Xmr_CRYPTONOTE_BASIC_LIBRARIES /home/ubuntu/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a
-- FindMonero Xmr_DAEMONIZER_LIBRARIES /home/ubuntu/monero/build/release/src/daemonizer/libdaemonizer.a
-- FindMonero Xmr_BLOCKS_LIBRARIES /home/ubuntu/monero/build/release/src/blocks/libblocks.a
-- FindMonero Xmr_LMDB_LIBRARIES /home/ubuntu/monero/build/release/external/db_drivers/liblmdb/liblmdb.a
-- FindMonero Xmr_RINGCT_LIBRARIES /home/ubuntu/monero/build/release/src/ringct/libringct.a
-- FindMonero Xmr_RINGCT_BASIC_LIBRARIES /home/ubuntu/monero/build/release/src/ringct/libringct_basic.a
-- FindMonero Xmr_COMMON_LIBRARIES /home/ubuntu/monero/build/release/src/common/libcommon.a
-- FindMonero Xmr_MNEMONICS_LIBRARIES /home/ubuntu/monero/build/release/src/mnemonics/libmnemonics.a
-- FindMonero Xmr_EASYLOGGING_LIBRARIES /home/ubuntu/monero/build/release/external/easylogging++/libeasylogging.a
-- FindMonero Xmr_DEVICE_LIBRARIES /home/ubuntu/monero/build/release/src/device/libdevice.a
-- FindMonero Xmr_EPEE_LIBRARIES /home/ubuntu/monero/build/release/contrib/epee/src/libepee.a
-- FindMonero Xmr_CHECKPOINTS_LIBRARIES /home/ubuntu/monero/build/release/src/checkpoints/libcheckpoints.a
-- FindMonero Xmr_VERSION_LIBRARIES /home/ubuntu/monero/build/release/src/libversion.a
-- FindMonero Xmr_CNCRYPTO_LIBRARIES /home/ubuntu/monero/build/release/src/crypto/libcncrypto.a
FOUND Monero_LIBRARIES: cryptonote_core;blockchain_db;cryptonote_protocol;cryptonote_basic;daemonizer;blocks;lmdb;ringct;ringct_basic;common;mnemonics;easylogging;device;epee;checkpoints;version;cncrypto
-- /home/ubuntu/monero/build
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   chrono
--   regex
--   serialization
--   program_options
--   atomic
-- Found HIDAPI: /usr/lib/x86_64-linux-gnu/libhidapi-libusb.so  
CMake Error at src/CMakeLists.txt:30 (target_include_monero_directories):
  Unknown CMake command "target_include_monero_directories".


-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/openmonero/build/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/openmonero/build/CMakeFiles/CMakeError.log".

And here's the content of CMakeError.log:

ubuntu@ip:~/openmonero/build$ cat CMakeFiles/CMakeError.log
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/ubuntu/openmonero/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_c5e3b/fast"
/usr/bin/make -f CMakeFiles/cmTC_c5e3b.dir/build.make CMakeFiles/cmTC_c5e3b.dir/build
make[1]: Entering directory '/home/ubuntu/openmonero/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c5e3b.dir/CheckSymbolExists.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_c5e3b.dir/CheckSymbolExists.c.o   -c /home/ubuntu/openmonero/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_c5e3b
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c5e3b.dir/link.txt --verbose=1
/usr/bin/cc      -rdynamic CMakeFiles/cmTC_c5e3b.dir/CheckSymbolExists.c.o  -o cmTC_c5e3b 
CMakeFiles/cmTC_c5e3b.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text+0x1b): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_c5e3b.dir/build.make:97: recipe for target 'cmTC_c5e3b' failed
make[1]: *** [cmTC_c5e3b] Error 1
make[1]: Leaving directory '/home/ubuntu/openmonero/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_c5e3b/fast' failed
make: *** [cmTC_c5e3b/fast] Error 2

File /home/ubuntu/openmonero/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/ubuntu/openmonero/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_b9c5e/fast"
/usr/bin/make -f CMakeFiles/cmTC_b9c5e.dir/build.make CMakeFiles/cmTC_b9c5e.dir/build
make[1]: Entering directory '/home/ubuntu/openmonero/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_b9c5e.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_b9c5e.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_b9c5e
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b9c5e.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_b9c5e.dir/CheckFunctionExists.c.o  -o cmTC_b9c5e -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_b9c5e.dir/build.make:97: recipe for target 'cmTC_b9c5e' failed
make[1]: *** [cmTC_b9c5e] Error 1
make[1]: Leaving directory '/home/ubuntu/openmonero/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_b9c5e/fast' failed
make: *** [cmTC_b9c5e/fast] Error 2

I also tried to compile using gcc-8 (as mentioned here) and had the same error.

@moneroexamples
Copy link
Owner

Using master or devel branch of OpenMonero?

@moneroexamples
Copy link
Owner

moneroexamples commented May 20, 2019

Can reproduce on master. Will look into it.

CMake Error at src/CMakeLists.txt:30 (target_include_monero_directories):
  Unknown CMake command "target_include_monero_directories".

Edit:
It fails also on Arch Linux for the same reason.

@skubakdj
Copy link
Author

I was using master, though I ran into issues on devel as well (again following the stock instructions).

@moneroexamples
Copy link
Owner

moneroexamples commented May 20, 2019

Sorry, my fault for not making it clear how to compile devel branch of OpenMonero.

For devel branch of OpenMonero, development branch of Monero is needed. And development branch in Monero is master branch.

I updated instructions on compiling development (i.e., master branch of monero): https://github.com/moneroexamples/monero-compilation/blob/master/README.md#example-compilation-of-master-branch-ie-development-version-of-monero-on-ubuntu-1804

So basically you need to use master branch of Monero, instead of release-v0.13, for compiling devel branch of OpenMonero.

Also will need to pull again devel branch of OpenMonero. Just fixed one cmake issue on ubuntu 18.04 and now it compiles on my instance of 18.04.

p.s.
Before re-compiling, its better to clear your current build folders, to have fresh start.

p.s.2
To fix master branch I will need more time. So if its not a problem, for now you can have a look at devel branch.

@skubakdj
Copy link
Author

Thanks for the quick replies! I'll use the devel branch for now.

@moneroexamples
Copy link
Owner

No problem. I fixed master branch, but if you can, devel branch is prefered. All bug fixes, new features, go to devel branch.

@skubakdj
Copy link
Author

Hey @moneroexamples, I just tried building devel on a fresh install of Ubuntu 18.04 but am running into compilation errors again. I installed the deps listed, am using the master branch of Monero, and the devel branch of OpenMonero. The build gets past cmake .. this time but fails on make:

-- Installing: /home/ubuntu/openmonero/build/distribution/include/corvusoft/restbed/context_placeholder_base.hpp
-- Installing: /home/ubuntu/openmonero/build/distribution/library/librestbed.a
[ 25%] Completed 'restbed'
[ 25%] Built target restbed
Scanning dependencies of target myxrmcore
[ 28%] Building CXX object src/xmregcore/src/CMakeFiles/myxrmcore.dir/MicroCore.cpp.o
/home/ubuntu/openmonero/src/xmregcore/src/MicroCore.cpp: In member function ‘virtual void xmreg::MicroCore::get_output_key(uint64_t, const std::vector<long unsigned int, std::allocator<long unsigned int> >&, std::vector<cryptonote::output_data_t>&)’:
/home/ubuntu/openmonero/src/xmregcore/src/MicroCore.cpp:118:54: error: no matching function for call to ‘cryptonote::BlockchainDB::get_output_key(uint64_t&, const std::vector<long unsigned int, std::allocator<long unsigned int> >&, std::vector<cryptonote::output_data_t>&)’
                             absolute_offsets, outputs);
                                                      ^
In file included from /home/ubuntu/monero/src/cryptonote_core/tx_pool.h:46:0,
                 from /home/ubuntu/openmonero/src/xmregcore/src/monero_headers.h:25,
                 from /home/ubuntu/openmonero/src/xmregcore/src/MicroCore.h:8,
                 from /home/ubuntu/openmonero/src/xmregcore/src/MicroCore.cpp:5:
/home/ubuntu/monero/src/blockchain_db/blockchain_db.h:1340:25: note: candidate: virtual cryptonote::output_data_t cryptonote::BlockchainDB::get_output_key(const uint64_t&, const uint64_t&, bool) const
   virtual output_data_t get_output_key(const uint64_t& amount, const uint64_t& index, bool include_commitmemt = true) const = 0;
                         ^~~~~~~~~~~~~~
/home/ubuntu/monero/src/blockchain_db/blockchain_db.h:1340:25: note:   no known conversion for argument 2 from ‘const std::vector<long unsigned int, std::allocator<long unsigned int> >’ to ‘const uint64_t& {aka const long unsigned int&}’
/home/ubuntu/monero/src/blockchain_db/blockchain_db.h:1392:16: note: candidate: virtual void cryptonote::BlockchainDB::get_output_key(const epee::span<const long unsigned int>&, const std::vector<long unsigned int, std::allocator<long unsigned int> >&, std::vector<cryptonote::output_data_t>&, bool) const
   virtual void get_output_key(const epee::span<const uint64_t> &amounts, const std::vector<uint64_t> &offsets, std::vector<output_data_t> &outputs, bool allow_partial = false) const = 0;
                ^~~~~~~~~~~~~~
/home/ubuntu/monero/src/blockchain_db/blockchain_db.h:1392:16: note:   no known conversion for argument 1 from ‘uint64_t {aka long unsigned int}’ to ‘const epee::span<const long unsigned int>&’
/home/ubuntu/openmonero/src/xmregcore/src/MicroCore.cpp: In member function ‘virtual std::vector<long unsigned int, std::allocator<long unsigned int> > xmreg::MicroCore::get_tx_amount_output_indices(uint64_t) const’:
/home/ubuntu/openmonero/src/xmregcore/src/MicroCore.cpp:193:42: error: could not convert ‘cryptonote::BlockchainDB::get_tx_amount_output_indices(tx_id, 1)’ from ‘std::vector<std::vector<long unsigned int, std::allocator<long unsigned int> > >’ to ‘std::vector<long unsigned int, std::allocator<long unsigned int> >’
     return core_storage.get_db()
            ~~~~~~~~~~~~~~~~~~~~~          
             .get_tx_amount_output_indices(tx_id);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
src/xmregcore/src/CMakeFiles/myxrmcore.dir/build.make:62: recipe for target 'src/xmregcore/src/CMakeFiles/myxrmcore.dir/MicroCore.cpp.o' failed
make[2]: *** [src/xmregcore/src/CMakeFiles/myxrmcore.dir/MicroCore.cpp.o] Error 1
CMakeFiles/Makefile2:217: recipe for target 'src/xmregcore/src/CMakeFiles/myxrmcore.dir/all' failed
make[1]: *** [src/xmregcore/src/CMakeFiles/myxrmcore.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Any idea what I'm doing wrong?

@moneroexamples
Copy link
Owner

moneroexamples commented May 24, 2019

I know what's happening, this is the issue in C++ api differences between monero's branches. That's why only devel branch of openmonero will work with development branch of monero (i.e., its master branch) - devel branch is using new monero api.

So i think that your devel branch of OpenMonero maybe incorrectly checked out? You can clone and checkout devel branch as follows;

git clone --recursive -b devel https://github.com/moneroexamples/openmonero.git

Also when copiling monero please remember about USE_SINGLE_BUILDDIR=1 flag. And in case you have multiple monero folders, you need to specify to openmonero which monero folder to use, if different then default. For this cmake -DMONERO_DIR=/some/folder/monero .. can be used.

@skubakdj
Copy link
Author

Looks like that did the trick! Thanks again @moneroexamples!

@moneroexamples
Copy link
Owner

No problem. Glad it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants