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

Error during CMake #18

Open
mondsen opened this issue May 18, 2021 · 10 comments
Open

Error during CMake #18

mondsen opened this issue May 18, 2021 · 10 comments

Comments

@mondsen
Copy link

mondsen commented May 18, 2021

I am trying to build using the instructions provided in the readme but I run into errors with cmake prior to the build. My setup:

RPi 4 with Ubuntu 20.04
Monero in ~/monero build from source

When executing
cmake -DMONERO_SOURCE_DIR=~/monero -DMONERO_BUILD_DIR=~/monero/build ..

I get the following

-- 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
CMake Error at CMakeLists.txt:89 (load_cache):
  load_cache Cannot load cache file from ~/monero/build/CMakeCache.txt


CMake Error at CMakeLists.txt:105 (message):
  Invalid Monero source dir - does not appear to match source used for build
  directory


-- Configuring incomplete, errors occurred!
See also "/home/ethereum/monero-lws/build/CMakeFiles/CMakeOutput.log".

For the first error: in ~/monero/build there is no such file because CMake was never run for building Monero. From the instructions on the GitHub readme I just ran make and it works. Maybe that causes this?

For the second error: the build files are in subfolders. Maybe this is a problem? Example:
monero/build/Linux/HEAD_detached_at_v0.17.1.9/release
I've tried to specify full path but that does not work either

@selsta
Copy link

selsta commented May 18, 2021

Try to use the full path instead of ~

@mondsen
Copy link
Author

mondsen commented May 18, 2021

Try to use the full path instead of ~

Same error.

@selsta
Copy link

selsta commented May 18, 2021

For the first error: in ~/monero/build there is no such file because CMake was never run for building Monero.

You have to build monero first.

monero/build/Linux/HEAD_detached_at_v0.17.1.9/release

Correct, by default ^ is your monero build path by default, if you build v0.17.1.9 tag.

@mondsen
Copy link
Author

mondsen commented May 18, 2021

Hmm, I have build monero from source and I've tried with specifying full build path as mentioned. Is CMake expecting the root of the build oder binary directory or something else?

@selsta
Copy link

selsta commented May 18, 2021

Is CMake expecting the root of the build oder binary directory or something else?

The root directory of the build directory. Can you post full logs again of what you are entering and what the cmake output is?

@serhack
Copy link
Contributor

serhack commented May 18, 2021

-DMONERO_BUILD_DIR=~/monero/build

You need to specify the directory where are located additional CMakeFiles for monero repository. Then you should change that to monero/build/Linux/HEAD_detached_at_v0.17.1.9/release. Remember to remove the folder on monero-lws if you change to set up variables otherwise CMake will use the cached value.

@shermand100
Copy link

shermand100 commented Jun 17, 2021

Hi, today I've built this on a Raspberry Pi4, but not without issues (which I found solutions to), and I thought I'd share here to help with your trending.
Using a Raspberry Pi 4, with Raspberry Pi OS.

My first issue was as described in the title here. Error on CMakeFile

CMake Error at CMakeLists.txt:105 (message):
Invalid Monero source dir - does not appear to match source used for build
directory

I had previously built Monero with the instructions found here: https://github.com/moneroexamples/monero-compilation/blob/master/README.md (due to also wanting to install the block explorer)

To solve this Invalid Source Error above I used sethsimmons example on a closed issue and overcame the above error with

cmake -DMONERO_SOURCE_DIR=/home/pinodexmr/monero -DMONERO_BUILD_DIR=/home/pinodexmr/monero/build/release ..

Then proceeding to make

I also encountered an error at 93%:

undefined reference to `__atomic_load_8'

This was fixed with adding set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") to line 74 of your CMakeLists.txt (I've not played with editing these files before so I don't know if line number is important.)

It seems to be a Raspberry Pi specific thing as I found this fix here Which itself references another Raspberry Pi project with the same error.

@vtnerd Hopefully that may help others to know, or can the above line be added permanently to the CMakeLists.txt, does that break other things?

@vtnerd
Copy link
Owner

vtnerd commented Jun 19, 2021

cmake -DMONERO_SOURCE_DIR=/home/pinodexmr/monero -DMONERO_BUILD_DIR=/home/pinodexmr/monero/build/release ..

This was the build directory, not /build. Perhaps the wording needs to be more clear, its the directory that contains {bin/, CMakeCache.txt, contrib/, src/} and so forth.

This was fixed with adding set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") to line 74 of your CMakeLists.txt (I've not played with editing these files before so I don't know if line number is important.)

This seems architecture specific, so I'll have to investigate a bit further.

@shermand100
Copy link

This seems architecture specific, so I'll have to investigate a bit further.

If that's your gut feeling on that then it's most likely Raspberry Pi OS specific. I've encountered a few oddities when interacting with projects using their system.

CMakeOutput.log has the top line of The system is: Linux - 5.10.17-v7l+ - armv7l if that's helpful.

@plowsof
Copy link

plowsof commented Nov 16, 2022

After 'doing it wrong' you must remember to rm -rf when inside your monero-lws/build folder then something like the above ^ or below works fine:

cmake -DMONERO_SOURCE_DIR=/home/debian/monero -    
DMONERO_BUILD_DIR=/home/debian/monero/build/Linux/master/release ..

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

6 participants