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

Openmonero not build with monero v0.17.2.0 #175

Open
matyushkins opened this issue Apr 15, 2021 · 13 comments
Open

Openmonero not build with monero v0.17.2.0 #175

matyushkins opened this issue Apr 15, 2021 · 13 comments

Comments

@matyushkins
Copy link

Hey! We’re trying to collect the openmonero with monero source code v0.17.2.0 but we’re receiving errors. could you please check the following?

  1. Thats the errors we receive:
[ 34%] Building CXX object src/CMakeFiles/myxmr.dir/OpenMoneroRequests.cpp.o
In file included from /opt/openmonero/src/../ext/restbed/source/restbed:11,
         from /opt/openmonero/src/OpenMoneroRequests.h:14,
         from /opt/openmonero/src/OpenMoneroRequests.cpp:8:
/opt/openmonero/src/../ext/restbed/source/corvusoft/restbed/request.hpp:19:10: fatal error: corvusoft/restbed/common.hpp: No such file or directory
  19 | #include <corvusoft/restbed/common.hpp>
   |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/myxmr.dir/build.make:128: src/CMakeFiles/myxmr.dir/OpenMoneroRequests.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:269: src/CMakeFiles/myxmr.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
  1. Our Dockerfile for the openmonero build used to work well till the monero v0.17.1.9 (including the v0.17.1.9 ). In the following build the Monero v0.17.2.0 cant be collected. Below is the code for the docker file:
FROM ubuntu:18.04 as xmrbuild

RUN set -o errexit -o nounset \
    && apt update \
    && apt upgrade -y \
    && apt install wget net-tools curl git build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz \
    doxygen libunwind8-dev pkg-config libssl-dev libcurl4-openssl-dev libgtest-dev libreadline-dev libzmq3-dev \ 
    libsodium-dev libhidapi-dev libhidapi-libusb0 libmysql++-dev -y \
    && rm -rf /var/cache/apt/

WORKDIR /opt

RUN git clone --recursive https://github.com/moneroexamples/openmonero.git
RUN git clone --recursive -b release-v0.17 https://github.com/monero-project/monero.git

RUN cd monero/ && USE_SINGLE_BUILDDIR=1 make

RUN mkdir openmonero/build \
    && cd openmonero/build \
    && cmake -DMONERO_DIR=/opt/monero ..

RUN cd openmonero/build \
    && make
  1. We have changed the Docker file for the openmonero with xmr v0.17.2.0 but it doesnt seem to work, thats the code:
FROM ubuntu:20.04 as xmrbuild

RUN set -o errexit -o nounset \
    && export DEBIAN_FRONTEND=noninteractive \
    && apt update \
    && apt upgrade -y -q

RUN set -o errexit -o nounset \
    && export DEBIAN_FRONTEND=noninteractive \
    && apt install wget net-tools curl git build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz \
    doxygen libunwind8-dev pkg-config libssl-dev libcurl4-openssl-dev libgtest-dev libreadline6-dev libzmq3-dev \
    liblzma-dev libldns-dev libexpat1-dev libpgm-dev libprotobuf-dev protobuf-compiler libudev-dev ccache qttools5-dev-tools \
    libsodium-dev libhidapi-dev libhidapi-libusb0 libusb-1.0-0-dev libmysql++-dev librestbed-dev -y -q\
    && rm -rf /var/cache/apt/

WORKDIR /opt

RUN git clone --recursive https://github.com/moneroexamples/openmonero.git
RUN git clone --recursive -b release-v0.17 https://github.com/monero-project/monero.git

RUN cd monero/ && USE_SINGLE_BUILDDIR=1 make

RUN mkdir openmonero/build \
    && cd openmonero/build \
    && cmake -DMONERO_DIR=/opt/monero ..

RUN cd openmonero/build \
    && make

You can see the error we’re receiving with the above parameters (check p.3) at the very beginning of the email (check p.1). So now the openmonero source code cant be collected. What should we do?

@j-berman
Copy link
Contributor

j-berman commented Apr 15, 2021

Looking into this, seems possible I caused some issue here from my fix to #172 didn't do the trick here (edit: the fix didn't cause any errors here, just didn't prevent them as expected)

(@moneroexamples I'll check this out!)

@moneroexamples
Copy link
Owner

@j-berman Thank you.

@j-berman
Copy link
Contributor

@matyushkins

p.3 failed for me with the same error on my first attempt, and then very strangely succeeded on my second attempt. It didn't really make sense for me to try twice, but I tried it anyway, and it worked. I'm guessing there may be some kind of caching issue going on with docker, and it's not pulling the latest from openmonero which includes my fix to #172.

Try building p.3 with the --no-cache option and see if that works: docker build --no-cache .

@matyushkins
Copy link
Author

matyushkins commented Apr 19, 2021

Hi. Dockerfile is always built without a cache.
We rerun build and error on command(cd openmonero/build && make):
Step 8/9 : RUN mkdir openmonero/build && cd openmonero/build && cmake -DMONERO_DIR=/opt/monero .. ---> Running in 960473c01145 -- The C compiler identification is GNU 9.3.0 -- The CXX compiler identification is GNU 9.3.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 -- Found MySQL++: /usr/include/mysql++;/usr/include/mysql, /usr/lib/x86_64-linux-gnu/libmysqlpp.so;/usr/lib/x86_64-linux-gnu/libmysqlclient.so -- Found Restbed include at: /opt/openmonero/ext/restbed -- Configuring directory /opt/openmonero/build/config -- Configuring file config.json -- MONERO_DIR: /opt/monero -- Looking for libunbound -- FindMonero Xmr_CRYPTONOTE_CORE_LIBRARIES /opt/monero/build/release/src/cryptonote_core/libcryptonote_core.a -- FindMonero Xmr_BLOCKCHAIN_DB_LIBRARIES /opt/monero/build/release/src/blockchain_db/libblockchain_db.a -- FindMonero Xmr_CRYPTONOTE_BASIC_LIBRARIES /opt/monero/build/release/src/cryptonote_basic/libcryptonote_basic.a -- FindMonero Xmr_BLOCKS_LIBRARIES /opt/monero/build/release/src/blocks/libblocks.a -- FindMonero Xmr_LMDB_LIBRARIES /opt/monero/build/release/external/db_drivers/liblmdb/liblmdb.a -- FindMonero Xmr_WALLET-CRYPTO_LIBRARIES /opt/monero/build/release/src/crypto/wallet/libwallet-crypto.a -- FindMonero Xmr_RINGCT_LIBRARIES /opt/monero/build/release/src/ringct/libringct.a -- FindMonero Xmr_RINGCT_BASIC_LIBRARIES /opt/monero/build/release/src/ringct/libringct_basic.a -- FindMonero Xmr_COMMON_LIBRARIES /opt/monero/build/release/src/common/libcommon.a -- FindMonero Xmr_EASYLOGGING_LIBRARIES /opt/monero/build/release/external/easylogging++/libeasylogging.a -- FindMonero Xmr_DEVICE_LIBRARIES /opt/monero/build/release/src/device/libdevice.a -- FindMonero Xmr_EPEE_LIBRARIES /opt/monero/build/release/contrib/epee/src/libepee.a -- FindMonero Xmr_CHECKPOINTS_LIBRARIES /opt/monero/build/release/src/checkpoints/libcheckpoints.a -- FindMonero Xmr_VERSION_LIBRARIES /opt/monero/build/release/src/libversion.a -- FindMonero Xmr_CNCRYPTO_LIBRARIES /opt/monero/build/release/src/crypto/libcncrypto.a -- FindMonero Xmr_RANDOMX_LIBRARIES /opt/monero/build/release/external/randomx/librandomx.a -- FindMonero Xmr_HARDFORKS_LIBRARIES /opt/monero/build/release/src/hardforks/libhardforks.a -- FindMonero Xmr_MINIUPNPC_LIBRARIES /opt/monero/build/release/external/miniupnp/miniupnpc/libminiupnpc.a Xmr_WALLET-CRYPTO_LIBRARIES /opt/monero/build/release/src/crypto/wallet/libwallet-crypto.a -- /opt/monero/build WALLET_CRYPTO /opt/monero/build/release/src/crypto/wallet/libwallet-crypto.a FOUND Monero_LIBRARIES: cryptonote_core;blockchain_db;cryptonote_basic;blocks;lmdb;wallet-crypto;ringct;ringct_basic;common;easylogging;device;epee;checkpoints;version;cncrypto;randomx;hardforks;miniupnpc -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: system filesystem thread date_time chrono regex serialization program_options -- Found HIDAPI: /usr/lib/x86_64-linux-gnu/libhidapi-libusb.so -- Configuring directory /opt/openmonero/build/sql -- Configuring file openmonero.sql -- Configuring file openmonero_test.sql -- Configuring done -- Generating done -- Build files have been written to: /opt/openmonero/build Removing intermediate container 960473c01145 ---> ac06e669bc3f Step 9/9 : RUN cd openmonero/build && make ---> Running in 3244989b947d Scanning dependencies of target myxrmcore [ 3%] Building CXX object src/xmregcore/src/CMakeFiles/myxrmcore.dir/MicroCore.cpp.o [ 6%] Building CXX object src/xmregcore/src/CMakeFiles/myxrmcore.dir/tools.cpp.o [ 9%] Building CXX object src/xmregcore/src/CMakeFiles/myxrmcore.dir/UniversalIdentifier.cpp.o [ 12%] Building CXX object src/xmregcore/src/CMakeFiles/myxrmcore.dir/Account.cpp.o [ 15%] Linking CXX static library libmyxrmcore.a [ 15%] Built target myxrmcore Scanning dependencies of target myxmr [ 18%] Building CXX object src/CMakeFiles/myxmr.dir/CmdLineOptions.cpp.o [ 21%] Building CXX object src/CMakeFiles/myxmr.dir/CurrentBlockchainStatus.cpp.o [ 25%] Building CXX object src/CMakeFiles/myxmr.dir/db/MySqlConnector.cpp.o [ 28%] Building CXX object src/CMakeFiles/myxmr.dir/db/MySqlAccounts.cpp.o [ 31%] Building CXX object src/CMakeFiles/myxmr.dir/db/ssqlses.cpp.o [ 34%] Building CXX object src/CMakeFiles/myxmr.dir/OpenMoneroRequests.cpp.o In file included from /opt/openmonero/src/../ext/restbed/source/restbed:11, from /opt/openmonero/src/OpenMoneroRequests.h:14, from /opt/openmonero/src/OpenMoneroRequests.cpp:8: /opt/openmonero/src/../ext/restbed/source/corvusoft/restbed/request.hpp:19:10: fatal error: corvusoft/restbed/common.hpp: No such file or directory 19 | #include <corvusoft/restbed/common.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [src/CMakeFiles/myxmr.dir/build.make:128: src/CMakeFiles/myxmr.dir/OpenMoneroRequests.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:269: src/CMakeFiles/myxmr.dir/all] Error 2 make: *** [Makefile:84: all] Error 2 The command '/bin/sh -c cd openmonero/build && make' returned a non-zero code: 2 The terminal process "/bin/zsh '-c', 'docker build --pull --rm -f "infrastructure/Containers/coins/monero/allin/Dockerfile" -t docker.guarda.co/nodes/monero:0.17.2.0-allinone "infrastructure/Containers/coins/monero/allin"'" terminated with exit code: 2.

@j-berman
Copy link
Contributor

Can you add this command after cloning openmonero?

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

# add this command
RUN more openmonero/cmake/FindRestbed.cmake

Then share what gets output from that added command?

That'll show with certainty whether or not the fix is present in FindRestbed.cmake

@matyushkins
Copy link
Author

Can you add this command after cloning openmonero?

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

# add this command
RUN more openmonero/cmake/FindRestbed.cmake

Then share what gets output from that added command?

That'll show with certainty whether or not the fix is present in FindRestbed.cmake

Step 6/10 : RUN more openmonero/cmake/FindRestbed.cmake
 ---> Running in 2549740abff3
::::::::::::::
openmonero/cmake/FindRestbed.cmake
::::::::::::::
# Based on https://stackoverflow.com/a/35856663/248823

find_path( restbed_SOURCE CMakeLists.txt HINTS 
"${CMAKE_SOURCE_DIR}/ext/restbed" )

if ( restbed_SOURCE )
    set( restbed_FOUND TRUE )
    set( restbed_BUILD "${CMAKE_CURRENT_BINARY_DIR}/restbed_build" )
    set( restbed_DISTRIBUTION "${CMAKE_CURRENT_BINARY_DIR}/distribution" )

    include( ExternalProject )
    ExternalProject_Add(restbed SOURCE_DIR ${restbed_SOURCE}
                         PREFIX restbed_build
                         INSTALL_DIR ${restbed_DISTRIBUTION}
                         CMAKE_ARGS 
                -DCMAKE_INSTALL_PREFIX=${restbed_DISTRIBUTION} 
                -DBUILD_SSL=${BUILD_SSL} 
                -DBUILD_SHARED=NO )

    set( restbed_INCLUDE "${restbed_DISTRIBUTION}/include" )
    set( restbed_LIBRARY 
            "${restbed_DISTRIBUTION}/library/${CMAKE_STATIC_LIBRARY_PREFIX}restbed${CMAKE_STATIC_LIBRARY_SUFFIX}" 
)

    message( STATUS "${Green}Found Restbed include at: 
    ${restbed_SOURCE}${Reset}" )

    mark_as_advanced(restbed_INCLUDE restbed_LIBRARY)

    #add_library(Restbed::Restbed INTERFACE IMPORTED GLOBAL)


    #set_target_properties(Restbed::Restbed PROPERTIES
      #INTERFACE_INCLUDE_DIRECTORIES 
           #${restbed_INCLUDE})

       #target_link_libraries(Restbed::Restbed INTERFACE
        #${restbed_LIBRARY})


else ( )
    message( FATAL_ERROR "${Red}Failed to locate Restbed 
    dependency.${Reset}" )
endif ( )

@j-berman
Copy link
Contributor

Ok, was able to reproduce the error consistently in a vm, and built it successfully in the vm with this workaround:

...

RUN mkdir openmonero/build \
    && cd openmonero/build \
    && cmake -DMONERO_DIR=/opt/monero ..

# add command 1 & command 2
# command 1
RUN cd openmonero/ext/restbed \
    && mkdir build && cd build \
    && cmake .. \
    && make install 
    
# command 2
RUN cp -r openmonero/ext/restbed/distribution/. openmonero/build/distribution/

RUN cd openmonero/build \
    && make

This solution is hacky. I will look into a more concrete fix, but it should work for you in the meantime.

@moneroexamples
Copy link
Owner

I added the changes to FindRestbed.cmake proposed by @matyushkins in this branch

https://github.com/moneroexamples/openmonero/tree/docker_build

I tested the docker build for this branch using following Dockerfile:

FROM ubuntu:20.04 as xmrbuild

RUN set -o errexit -o nounset \
    && export DEBIAN_FRONTEND=noninteractive \
    && apt update \
    && apt upgrade -y -q

RUN set -o errexit -o nounset \
    && export DEBIAN_FRONTEND=noninteractive \
    && apt install wget net-tools curl git build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz \
    doxygen libunwind8-dev pkg-config libssl-dev libcurl4-openssl-dev libgtest-dev libreadline6-dev libzmq3-dev \
    liblzma-dev libldns-dev libexpat1-dev libpgm-dev libprotobuf-dev protobuf-compiler libudev-dev ccache qttools5-dev-tools \
    libsodium-dev libhidapi-dev libhidapi-libusb0 libusb-1.0-0-dev libmysql++-dev librestbed-dev -y -q\
    && rm -rf /var/cache/apt/

WORKDIR /opt

RUN git clone --recursive -b docker_build https://github.com/moneroexamples/openmonero.git
RUN git clone --recursive -b release-v0.17 https://github.com/monero-project/monero.git

RUN cd monero/ && USE_SINGLE_BUILDDIR=1 make 

RUN mkdir openmonero/build \
    && cd openmonero/build \
    && cmake -DMONERO_DIR=/opt/monero ..

RUN cd openmonero/build \
    && make

The docker build succeeds in my tests.

@j-berman
Copy link
Contributor

j-berman commented Apr 25, 2021

@moneroexamples think I'm missing something maybe, but that branch looks like the same as master, no?

@moneroexamples
Copy link
Owner

moneroexamples commented Apr 25, 2021

@j-berman I see. Then its even better, since it works, so I'm confused what is the issue with the build in the docker?

@j-berman
Copy link
Contributor

j-berman commented Apr 25, 2021

@moneroexamples his original dockerfile that points to master builds successfully locally for me too. But strangely, it failed once for me, and then succeeded on all subsequent attempts, even on attempts when I disabled the cache with --no-cache. I figured he may have some caching issue with docker, but it seems that's not the case, and it's failing for him every time he tries. So I spun up a fresh VM, and tried building the dockerfile in there, and it consistently failed to build for me in the VM too. This workaround did the trick for me in the VM, so I'm thinking it'll work for @matyushkins too, although it's not a pretty solution.

I'm thinking maybe there's some kind of race condition in the build process, preventing Restbed from getting placed in the correct place during the build sometimes? That's what I was going to explore next. There's probably a simple fix in there somewhere.

It's an odd issue indeed considering docker is supposed to be consistent across all machines (if it succeeds on one machine, would expect it to succeed on another).

@moneroexamples
Copy link
Owner

@j-berman Now I understand. Thanks. I will try to build few times as well and see how it goes.

@matyushkins
Copy link
Author

Ok, was able to reproduce the error consistently in a vm, and built it successfully in the vm with this workaround:

...

RUN mkdir openmonero/build \
    && cd openmonero/build \
    && cmake -DMONERO_DIR=/opt/monero ..

# add command 1 & command 2
# command 1
RUN cd openmonero/ext/restbed \
    && mkdir build && cd build \
    && cmake .. \
    && make install 
    
# command 2
RUN cp -r openmonero/ext/restbed/distribution/. openmonero/build/distribution/

RUN cd openmonero/build \
    && make

This solution is hacky. I will look into a more concrete fix, but it should work for you in the meantime.

It worked. Everything is assembled and works in a stack. Thank you.

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

3 participants