I'm new to CMake and trying to build Instant-3D, but I encountered an error. I think this is not directly related to the Instant-3D project itself, but rather a CMake issue, so I'm asking for help here. After examined the cause, I found that the error when building Instant-3D can be reduced to the following problem:
I have the following CMakeList.txt
file:
cmake_minimum_required(VERSION 3.16)
project(instant-ngp
VERSION 1.0
DESCRIPTION "Instant Neural Graphics Primitives"
LANGUAGES C CXX CUDA
)
When I run cmake .
, it completes without any erros. However, running the following command results in an error (which seems to be related to C compiler):
cmake . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
The error messages are as follows:
$ cmake . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- The CUDA compiler identification is NVIDIA 11.1.74
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /home/**/.pyenv/versions/3.8.10/lib/python3.8/site-packages/cmake/data/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/usr/bin/cc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/home/**/Documents/Instant-NGP/instant-ngp/build/CMakeFiles/CMakeScratch/TryCompile-vcxf3D'
Run Build Command(s): /home/**/.pyenv/versions/3.8.10/lib/python3.8/site-packages/cmake/data/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_25273/fast
no such file or directory
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:11 (project)
-- Configuring incomplete, errors occurred!
I have checked that the build-essential
is installed:
$ dpkg -s build-essential
Package: build-essential
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 21
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Version: 12.8ubuntu1.1
Depends: libc6-dev | libc-dev, gcc (>= 4:9.2), g++ (>= 4:9.2), make, dpkg-dev (>= 1.17.11)
Description: Informational list of build-essential packages
If you do not plan to build Debian packages, you don't need this
package. Starting with dpkg (>= 1.14.18) this package is required
for building Debian packages.
.
This package contains an informational list of packages which are
considered essential for building Debian packages. This package also
depends on the packages on that list, to make it easy to have the
build-essential packages installed.
.
If you have this package installed, you only need to install whatever
a package specifies as its build-time dependencies to build the
package. Conversely, if you are determining what your package needs
to build-depend on, you can always leave out the packages this
package depends on.
.
This package is NOT the definition of what packages are
build-essential; the real definition is in the Debian Policy Manual.
This package contains merely an informational list, which is all
most people need. However, if this package and the manual disagree,
the manual is correct.
Original-Maintainer: Matthias Klose <[email protected]>
Does anyone have an idea why adding -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
causes this error and how to fix it?
I will appreciate if you could give me any hints.