Closed joshuaroy873 closed 3 months ago
Hi @joshuaroy873
I think this is the important bit of the build log:
[Killed signal terminated program cc1plus](c++: fatal error: Killed signal terminated program cc1plus)
Usually this indicative of a lack of resources during compilation. Can you check your memory usage during builds? If I recall correclty, WSL also has some restrictions on the amount of RAM that it has access to. A simple solution usually is to reduce the parallelism if you don't mind wating a bit longer:
ninja -j 4
will use only 4 threads which will require less RAM.
Latest update: I tried to recreate everything as given in https://mitsuba.readthedocs.io/en/latest/src/developer_guide/compiling.html. Sorry for changing the environment in the middle of an issue.
I installed Ubuntu 20.04 WSL, installed the packages as directed in the website, and used 4 threads to ensure that it wasn't terminated due to lack of resources.
I am getting the following error:
jpalathi@DESKTOP-2V947MI:~/mitsuba3/build$ ninja -j 4
[2/274] Linking CXX executable mitsuba
FAILED: mitsuba
: && /usr/bin/clang++-10 -stdlib=libc++ -D_LIBCPP_VERSION -fcolor-diagnostics -O3 -DNDEBUG -stdlib=libc++ src/mitsuba/CMakeFiles/mitsuba-bin.dir/mitsuba.cpp.o -o mitsuba -Wl,-rpath,/home/jpalathi/mitsuba3/build:/home/jpalathi/mitsuba3/build/ext/drjit/drjit: libmitsuba.so -ldl libasmjit-mitsuba.so -ldl libpng-mitsuba.so /usr/lib/x86_64-linux-gnu/libz.so -lm libpugixml.so libjpeg-mitsuba.so libIlmImf-mitsuba.so libImath-mitsuba.so libHalf-mitsuba.so libIexMath-mitsuba.so libIlmThread-mitsuba.so libIex-mitsuba.so -pthread /usr/lib/x86_64-linux-gnu/libz.so ext/drjit/drjit/libdrjit-extra.so ext/drjit/drjit/libdrjit-core.so libnanothread.so ext/rgb2spec/librgb2spec.a libembree3.so && :
/usr/bin/ld: libmitsuba.so: undefined reference to `mitsuba::ReconstructionFilter<float, mitsuba::Color<float, 3ul> >::is_box_filter() const'
/usr/bin/ld: libmitsuba.so: undefined reference to `mitsuba::ReconstructionFilter<float, mitsuba::Color<float, 3ul> >::m_class'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[5/274] cd /home/jpalathi/mitsuba3/build/ext/embree/kernels && /usr/bin/cmake -D file=/home/jpalathi/mitsuba3/build/ext/embree/libembree_avx512.a -P /home/jpalathi/mitsuba3/ext/embree/common/cmake/check_globals.cmake
ninja: build stopped: subcommand failed.
P.S. I also had to install an extra pip
package called typing-extensions
as it was required for the compilation.
It looks like you're using the most recent master
source files, you should be using the latest stable release:
git clone --recursive https://github.com/mitsuba-renderer/mitsuba3.git --branch v3.5.2
Looks like your right. After trying the stable build, it is giving the c++: fatal error: Killed signal terminated program cc1plus
error. This time I monitored my resources, and it is maxing out. I'll try it on another PC with Ubuntu and 32 GB RAM. Thanks for the response till now.
Hello @joshuaroy873,
Two things to note:
ninja -j 4
. This will use a lot less RAM, and you will be able to complete the build. For your use-case it should be a one-time thing, so it should be fine if it takes longer. You don't need to change machines.Git it working in my Ubuntu workstation. Now, I'm getting a different error:
[440/1047] Building CXX object ext/openexr/OpenEXR/IlmImf/CMakeFiles/IlmImf.dir/ImfHuf.cpp.o
FAILED: ext/openexr/OpenEXR/IlmImf/CMakeFiles/IlmImf.dir/ImfHuf.cpp.o
/usr/bin/c++ -DILMIMF_EXPORTS -DIlmImf_EXPORTS -I/home/common/Desktop/Joshua_Files/mitsuba3/build/ext/openexr/OpenEXR/IlmImf -I/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf -I/home/common/Desktop/Joshua_Files/mitsuba3/build/ext/openexr/OpenEXR/config -I/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/IlmBase/Iex -I/home/common/Desktop/Joshua_Files/mitsuba3/build/ext/openexr/IlmBase/config -I/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/IlmBase/Half -I/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/IlmBase/Imath -I/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/IlmBase/IexMath -I/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/IlmBase/IlmThread -fdiagnostics-color=always -O3 -DNDEBUG -fPIC -march=native -Wall -Wextra -Wno-unused-local-typedefs -fno-math-errno -ffp-contract=fast -fno-trapping-math -MD -MT ext/openexr/OpenEXR/IlmImf/CMakeFiles/IlmImf.dir/ImfHuf.cpp.o -MF ext/openexr/OpenEXR/IlmImf/CMakeFiles/IlmImf.dir/ImfHuf.cpp.o.d -o ext/openexr/OpenEXR/IlmImf/CMakeFiles/IlmImf.dir/ImfHuf.cpp.o -c /home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf/ImfHuf.cpp
/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf/ImfHuf.cpp: In function ‘void Imf_2_5::hufUncompress(const char*, int, short unsigned int*, int)’:
/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf/ImfHuf.cpp:1105:5: error: ‘uint64_t’ was not declared in this scope
1105 | uint64_t nBytes = (static_cast<uint64_t>(nBits)+7) / 8 ;
| ^~~~~~~~
/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf/ImfHuf.cpp:56:1: note: ‘uint64_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
55 | #include <algorithm>
+++ |+#include <cstdint>
56 |
/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf/ImfHuf.cpp:1107:16: error: ‘nBytes’ was not declared in this scope; did you mean ‘nBits’?
1107 | if ( ptr + nBytes > compressed+nCompressed)
| ^~~~~~
| nBits
/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf/ImfHuf.cpp:1124:31: error: ‘nBytes’ was not declared in this scope; did you mean ‘nBits’?
1124 | if( ptr-compressed + nBytes > nCompressed)
| ^~~~~~
| nBits
[443/1047] Building CXX object ext/openexr/OpenEXR/IlmImf/CMakeFiles/IlmImf.dir/ImfOutputFile.cpp.o
/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf/ImfOutputFile.cpp: In function ‘void Imf_2_5::{anonymous}::convertToXdr(Imf_2_5::OutputFile::Data*, Imf_2_5::Array<char>&, int, int, int)’:
/home/common/Desktop/Joshua_Files/mitsuba3/ext/openexr/OpenEXR/IlmImf/ImfOutputFile.cpp:339:19: warning: unused parameter ‘inSize’ [-Wunused-parameter]
339 | int inSize)
| ~~~~^~~~~~
[457/1047] Linking CXX shared module python/drjit/drjit_ext.cpython-312-x86_64-linux-gnu.so
lto-wrapper: warning: using serial compilation of 128 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
ninja: build stopped: subcommand failed.
Any inputs? Thanks.
Note that, AFAIK, OptiX is not supported on WSL. If you have to use a Windows machine, I think it's better to compile directly for Windows (do you agree @njroussel?)
Yes, I don't know why I didn't of this. There seems to be some unofficial ways to get OptiX to run in WSL, but I'd strill strongly recommend running and building it natively.
@joshuaroy873 Looks like you're using gcc/g++ >= 13. With gcc 13, there have been some breaking changes. Are you using Ubuntu 24.04?
In any case, you should build with clang. The following command should isntall it:
sudo apt install clang libc++-dev libc++abi-dev
And then you must set it do be your default compiler for the current shell session with:
export CC=clang export CXX=clang++
Finally you can build it with:
mkdir build
cd build
cmake -GNinja ..
ninja
My bad. I forgot to include the system information and command history used in my workstation. Please find it below:
System information:
OS: Ubuntu 24.04
CPU: Intel i7-10700K
GPU: GeForce RTX 2060
Python version: Python 3.12.3
LLVM version: 14.0.0 (output to llvm-config --version command)
CUDA version: Cuda compilation tools, release 12.0, V12.0.140 Build cuda_12.0.r12.0/compiler.32267302_0
NVidia driver: I have an error when I run nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
I'm planning on reinstalling Ubuntu to mitigate this issue now.
Terminal history:
git clone --recursive https://github.com/mitsuba-renderer/mitsuba3.git --branch v3.5.2
sudo apt install clang libc++-dev libc++abi-dev cmake ninja-build
sudo apt install libpng-dev libjpeg-dev
sudo apt install libpython3-dev
sudo apt install python3-pytest python3-pytest-xdist python3-numpy
cd mitsuba3/
mkdir build
cd build
cmake -GNinja ..
vi mitsuba.conf (to edit "enabled" : ["cuda_ad_mono_polarized"])
ninja
As you mentioned, running export CC=clang export CXX=clang++
did help in mitigating my previous error. Now I have a new error:
[836/1047] Linking CXX executable mitsuba
FAILED: mitsuba
: && /usr/bin/clang++ -stdlib=libc++ -D_LIBCPP_VERSION -fcolor-diagnostics -O3 -DNDEBUG -stdlib=libc++ src/mitsuba/CMakeFiles/mitsuba-bin.dir/mitsuba.cpp.o -o mitsuba -Wl,-rpath,/home/common/Desktop/Joshua_Files/mitsuba3/build: libmitsuba.so -ldl libasmjit-mitsuba.so -ldl libpng-mitsuba.so /usr/lib/x86_64-linux-gnu/libz.so -lm libpugixml.so libjpeg-mitsuba.so libIlmImf-mitsuba.so libImath-mitsuba.so libHalf-mitsuba.so libIexMath-mitsuba.so libIlmThread-mitsuba.so libIex-mitsuba.so /usr/lib/x86_64-linux-gnu/libz.so libdrjit-autodiff.so libdrjit-core.so libnanothread.so ext/rgb2spec/librgb2spec.a libembree3.so && :
/usr/bin/ld: libmitsuba.so: undefined reference to `mitsuba::ReconstructionFilter<float, mitsuba::Color<float, 3ul> >::m_class'
/usr/bin/ld: libmitsuba.so: undefined reference to `mitsuba::ReconstructionFilter<float, mitsuba::Color<float, 3ul> >::is_box_filter() const'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[853/1047] Linking CXX shared module python/drjit/drjit_ext.cpython-312-x86_64-linux-gnu.so
ninja: build stopped: subcommand failed.
If this is because of the NVidia driver, I'm assuming this'll be gone once I reinstall my system. If not, then I'll reach reach out again.
Thanks.
This is unrelated to the Nvidia driver, I believe.
I think you've done everything properly, with maybe the exception of the mitsuba.conf
edit. Did you replace it to be:
"enabled" : ["cuda_ad_mono_polarized"]
?
Unfortunately, I think Mitsuba 3 always needs to at least compile scalar_rgb
. To be safe, my recommendation would be to compile all the default variants and add cuda_ad_mono_polarized
to it:
"enabled" : ["scalar_rgb", "scalar_spectral", "cuda_ad_rgb", "llvm_ad_rgb", "cuda_ad_mono_polarized"]
Yes, you're right. I did only enable "cuda_ad_mono_polarized"
. Thanks for the response. I'll try it out.
This is unrelated to the Nvidia driver, I believe.
I think you've done everything properly, with maybe the exception of the
mitsuba.conf
edit. Did you replace it to be:"enabled" : ["cuda_ad_mono_polarized"]
?
Unfortunately, I think Mitsuba 3 always needs to at least compile
scalar_rgb
. To be safe, my recommendation would be to compile all the default variants and addcuda_ad_mono_polarized
to it:"enabled" : ["scalar_rgb", "scalar_spectral", "cuda_ad_rgb", "llvm_ad_rgb", "cuda_ad_mono_polarized"]
Thanks a bunch. This worked. Really helpful.
Summary
I'm having issues compiling mitsuba3. I'm a bit new to build and compile troubleshooting, so please bare with me. I followed the following steps (as per the instructions), but I keep getting an error.
Big picture: I'm trying to install the following software: https://github.com/NVlabs/instant-rm Their installation summary is: Instant RM is based on Mitsuba 3 and Dr.Jit. The cuda_ad_mono_polarized variant is required to run Instant RM. As this variant is not included in the version of Mitsuba available on PyPI, Mitsuba should not be installed using pip and you will need to install it from the sources with this variant. Selecting variants can be achieved by adding "cuda_ad_mono_polarized" to the listd named "enabled" in the mitsuba.conf file which is generated when running CMake. Note that compiling Mitsuba also installs Dr.Jit from the source. We recommend using Mitsuba 3.5.2.
System configuration
System information:
OS: Windows 10 - WSL - Ubuntu 22.04 CPU: Intel i7-13700H GPU: None Python version: Python 3.10.12 LLVM version: 14.0.0 (output to
llvm-config --version
command) CUDA version: None (modified listd named"enabled"
inmitsuba.conf
tollvm_ad_mono_polarized
, so assuming no CUDA required) NVidia driver: NoneMitsuba version: 3.5.2
Description
Steps to reproduce
1.
2.
vi mitsuba.conf
(modified listd named"enabled"
to onlyllvm_ad_mono_polarized
, removing everything else)ninja