gaussian-splatting icon indicating copy to clipboard operation
gaussian-splatting copied to clipboard

Installing SIBR - cannot find correct version of OpenCV

Open JonathonLuiten opened this issue 2 years ago • 14 comments

I get the following error upon running "cmake -Bbuild ." while trying to install SIBR:

CMake Error at cmake/linux/dependencies.cmake:248 (find_package):
  Could not find a configuration file for package "OpenCV" that is compatible
  with requested version "4.5".

  The following configuration files were considered but not accepted:

    /usr/lib/x86_64-linux-gnu/cmake/opencv4/OpenCVConfig.cmake, version: 4.2.0
    /lib/x86_64-linux-gnu/cmake/opencv4/OpenCVConfig.cmake, version: 4.2.0

Call Stack (most recent call first):
  cmake/linux/include_once.cmake:20 (include)
  src/CMakeLists.txt:46 (include_once)

I am not very familiar with cmake, so although I am sure there is a quick and easy fix, I am not able to easily find it.

JonathonLuiten avatar Jul 10 '23 22:07 JonathonLuiten

Hi,

it seems you have OpenCV version 4.2 installed, when CMake is looking for 4.5. Do you have both of them? If not, could you try upgrading to 4.5?

Snosixtyboo avatar Jul 10 '23 23:07 Snosixtyboo

Hi,

it seems you have OpenCV version 4.2 installed, when CMake is looking for 4.5. Do you have both of them? If not, could you try upgrading to 4.5?

Looking at it, I reckon you are on Focal Fossa where the latest OpenCV is 4.2? Could you try changing the offending line in dependencies.cmake to OpenCV 4.2 and see if it just works?

Snosixtyboo avatar Jul 10 '23 23:07 Snosixtyboo

This works. But now I get a different error at the next step that I have no idea how to fix...

when running "cmake --build build --target install --config RelWithDebInfo"

I get the following:

[ 87%] Linking CXX executable SIBR_texturedMesh_app
/usr/bin/ld: /home/luiten/miniconda3/envs/gaussian_splatting/lib/libicuuc.so.72: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.30'
collect2: error: ld returned 1 exit status
make[2]: *** [src/projects/basic/apps/texturedMesh/CMakeFiles/SIBR_texturedMesh_app.dir/build.make:183: src/projects/basic/apps/texturedMesh/SIBR_texturedMesh_app] Error 1
make[1]: *** [CMakeFiles/Makefile2:1189: src/projects/basic/apps/texturedMesh/CMakeFiles/SIBR_texturedMesh_app.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

JonathonLuiten avatar Jul 11 '23 01:07 JonathonLuiten

On Ubuntu 20.04 I also run into the issue that the libembree-dev package on 20.04 does not provide embree-config.cmake (but the one in Ubuntu 22.04 does provide this file). However, I was able to resolve this particular error by downloading and installing the precompiled binaries for libembree-3.13.5 from https://github.com/embree/embree/releases

dllu avatar Jul 11 '23 01:07 dllu

Hi,

I made a branch for Focal Fossa users. The executables are not usage-tested because we don't have many Linux machines, but the building should now be straightforward (works out of the box in WSL2), see the instructions in the ReadMe under Ubuntu 20.04. I reduced CMake and OpenCV versions such that all dependencies should be fulfilled by the package manager.

Hth, Bernhard

Snosixtyboo avatar Jul 11 '23 17:07 Snosixtyboo

Unfortunately this branch doesn't fix all of my errors.

I am still getting the following:

[ 88%] Linking CXX executable SIBR_texturedMesh_app
/usr/bin/ld: /home/luiten/miniconda3/envs/gaussian_splatting/lib/libicuuc.so.72: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.30'
collect2: error: ld returned 1 exit status
make[2]: *** [src/projects/basic/apps/texturedMesh/CMakeFiles/SIBR_texturedMesh_app.dir/build.make:183: src/projects/basic/apps/texturedMesh/SIBR_texturedMesh_app] Error 1
make[1]: *** [CMakeFiles/Makefile2:1189: src/projects/basic/apps/texturedMesh/CMakeFiles/SIBR_texturedMesh_app.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

JonathonLuiten avatar Jul 11 '23 18:07 JonathonLuiten

@JonathonLuiten if you're getting linker errors with std::condition_variable, it seems likely that your C++ toolchain/compiler is broken. On my Ubuntu 20.04 machine, I don't have that problem.

Perhaps you can run gcc --version, which gcc, etc to debug if you have any special circumstances with your compiler. In particular, it seems probable that you're using some sort of clang with libc++ instead of libstdc++. Try the solution suggested here: https://stackoverflow.com/questions/48876904/undefined-reference-to-stdcondition-variablenotify-one-glibcxx-3-4-11

dllu avatar Jul 11 '23 18:07 dllu

hmmm thanks for trying to help, but still no luck...

LDFLAGS="-stdlib=libstdc++"

doesn't change anything.

and the output of the gcc commands seems fine:

gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

which gcc /usr/bin/gcc

JonathonLuiten avatar Jul 11 '23 18:07 JonathonLuiten

Also if I just run this is the command line, it runs without error:

/usr/bin/ld /home/luiten/miniconda3/envs/gaussian_splatting/lib/libicuuc.so.72

JonathonLuiten avatar Jul 11 '23 18:07 JonathonLuiten

You can try to make sure that your CC and CXX environment variables aren't set to something strange. You can also try to cmake -DCMAKE_CXX_FLAGS=-stdlib=libstdc++

dllu avatar Jul 11 '23 18:07 dllu

Just attaching this as it seems rather insightful: https://stackoverflow.com/questions/49242829/gcc-not-linking-against-libstdc

On Tue, Jul 11, 2023 at 11:23 AM JonathonLuiten @.***> wrote:

Also if I just run this is the command line, it runs without error:

/usr/bin/ld /home/luiten/miniconda3/envs/gaussian_splatting/lib/libicuuc.so.72

— Reply to this email directly, view it on GitHub https://github.com/graphdeco-inria/gaussian-splatting/issues/10#issuecomment-1631287303, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACGXXYJC3OF5TYOJIVD3NLLXPWKYZANCNFSM6AAAAAA2FFQ2QI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

grgkopanas avatar Jul 11 '23 18:07 grgkopanas

The link from George summarizes to "You need to use g++, not gcc".

Any idea how I try to do that? (this c compiling stuff I have 0 experience in)

JonathonLuiten avatar Jul 11 '23 18:07 JonathonLuiten

sudo apt install build-essential sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 40 sudo update-alternatives --config c++

Then in the menu select g++ as the default compiler. Hope this works! I'll go ahead and update the description to specifically say "g++", since Clang has a ton of problems it seems.

Snosixtyboo avatar Jul 11 '23 18:07 Snosixtyboo

no luck.. same error....

Although note that something weird happens with this command:

sudo update-alternatives --config c++ There is only one alternative in link group c++ (providing /usr/bin/c++): /usr/bin/g++ Nothing to configure.

I think I'll give up on the SIBR viewer now... I don't know the exact features, but it's probably not too hard to replicate with open3D... Do feel free to keep dropping suggestions though and I'll try them

JonathonLuiten avatar Jul 11 '23 19:07 JonathonLuiten

sudo apt install build-essential sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 40 sudo update-alternatives --config c++

Then in the menu select g++ as the default compiler. Hope this works! I'll go ahead and update the description to specifically say "g++", since Clang has a ton of problems it seems.

Hey,if we have a nerf model, can we export to 3d gaussian splatting, what do you think?

atztao avatar Jul 24 '23 01:07 atztao

This is unrelated to the issue please open a separate issue if you want to discuss the topic.

grgkopanas avatar Jul 24 '23 02:07 grgkopanas

I met the same issue with @JonathonLuiten. The -DCMAKE_CXX_FLAGS=-stdlib=libstdc++ flag did not work and it suggests using -DCMAKE_CXX_FLAGS=-static-libstdc++. I tried cmake with the latter flag and it complies successfully.

The full compile command is

cmake -Bbuild . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-static-libstdc++
cmake --build build -j24 --target install

I am using Ubuntu 20.04 with the fossa_compatibility branch. gcc and g++ version are (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0. cmake version is 3.16.3.

georgegu1997 avatar Sep 07 '23 05:09 georgegu1997