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

cmake error on Ubuntu #26

Closed
Choyaa opened this issue Jan 17, 2022 · 5 comments
Closed

cmake error on Ubuntu #26

Choyaa opened this issue Jan 17, 2022 · 5 comments

Comments

@Choyaa
Copy link

Choyaa commented Jan 17, 2022

hi, I really admire your work.
I met the problem when compiling C++ library with cmake , I have installed cmake==3.22.1.
ubuntu@ubuntu:~/Documents/instant-ngp-master/build$ cmake -version cmake version 3.22.1

I tried 'cmake . -B build', but got error as below:
ubuntu@ubuntu:~/Documents/instant-ngp-master$ cmake . -B build
CMake Error: The source directory "/home/ubuntu/Documents/instant-ngp-master/build" does not exist.
after 'mkdir build', it got a new error as below:
ubuntu@ubuntu:~/Documents/instant-ngp-master$ mkdir build
ubuntu@ubuntu:~/Documents/instant-ngp-master$ cmake . -B build
CMake Error: The source directory "/home/ubuntu/Documents/instant-ngp-master/build" does not appear to contain CMakeLists.txt.

I have never met such error but copied CMakeLists.txt to build/CMakeLists.txt, a new error as below:
ubuntu@ubuntu:~/Documents/instant-ngp-master$ cmake . -B build
`-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- The CUDA compiler identification is NVIDIA 11.1.105
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda-11.1/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- No release type specified. Setting to 'Release'.
CMake Error at CMakeLists.txt:96 (add_subdirectory):
add_subdirectory given source "dependencies/glfw" which is not an existing
directory.

CMake Error at CMakeLists.txt:98 (set_target_properties):
set_target_properties Can not find target to add properties to: glfw
...`

I also tried the compile method I used before:
mkdir build cd build cmake .., got same error.

I am not familiar with CMAKE, and just learned ‘cmake . -B build‘ could create the build directory automatically . My Ubuntu is 18.04, Now I have no idea what to do next , and would appreciate your help.

@Tom94
Copy link
Collaborator

Tom94 commented Jan 17, 2022

Hi there! Looks like you forgot the --recursive flag when cloning this repository.

Running git submodule update --init --recursive should fix it up. Then, run cmake again.

(And thank you very much for the kind words!)

@Tom94 Tom94 closed this as completed Jan 17, 2022
@Tom94 Tom94 reopened this Jan 17, 2022
@Choyaa
Copy link
Author

Choyaa commented Jan 18, 2022

Thanks!!! I got it

Hi there! Looks like you forgot the --recursive flag when cloning this repository.

Running git submodule update --init --recursive should fix it up. Then, run cmake again.

(And thank you very much for the kind words!)

@Tom94 Tom94 closed this as completed Jan 18, 2022
@grey-area
Copy link

Worth noting I had exactly the same output and it wasn't because I hadn't recursively cloned the repo; in my case it was an old version of CMake.

The -B flag was introduced in CMake 3.13.

When running "cmake . -B build", older versions of CMake will look for source files in "bulid"

@resurgo97
Copy link

I had a similar problem and git submodule update --init --recursive after cloning did not solve it.
Neither was it because of the version of CMake.
Rather, adding --recursive flag when cloning in the first place only worked for me.

@nudro
Copy link

nudro commented Jul 22, 2022

upgrading cmake (https://askubuntu.com/questions/1203635/installing-latest-cmake-on-ubuntu-18-04-3-lts-run-via-wsl-openssl-error), and:

git clone https://github.com/NVlabs/instant-ngp.git --recursive

worked for me.

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

5 participants