Unable to compile Open Image Denoise for Blender

I am trying to compile Open Image Denoise by running install_deps.sh which executes the following to begin compilation:

cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D WITH_EXAMPLE=OFF"
cmake_d="$cmake_d -D WITH_TEST=OFF"
cmake_d="$cmake_d -D OIDN_STATIC_LIB=ON"
cmake $cmake_d ../
make -j$THREADS && make install
make clean

but CMakes throws the following error:

Unpacking OpenImageDenoise-1.1.0
-- The CXX compiler identification is GNU 5.4.0
-- 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:35 (if):
  if given arguments:

    "3.5.1" "VERSION_GREATER_EQUAL" "3.13.0"

  Unknown arguments specified

The error seems to be saying that VERSION_GREATER_EQUAL does not exist. Additionally, despite the fact that my CMake version is 3.10.x, OIDN thinks that I have CMake 3.5.1 installed. Anyways, I tried compiling OIDN using CMake 3.16.4, CMake 3.12.4 and CMake 3.5.1 but I still get same error. Can someone tell me what I’m doing wrong here?

Note that this is happening is despite the fact that I’ve been compiling Open Image Denoise from about past 6 months ago for Blender until 3 months ago without any issues. So it is likely that something has changed within the past 3 months or so. Would appreciate if someone can tell me what I should do to fix this.

going off the logs you posted, all evidence seem to point at cmake 3.5.1 being used.

  1. VERSION_GREATER_EQUAL is only available in cmake 3.7+
  2. CMake it self reports it is 3.5.1 (oidn doesn’t detect this, it’s a predefined CMake variable)

i’d validate with cmake --version

@LazyDodo Doing cmake --version shows that the CMake version is either 3.16.4, 3.12.4 or 3.5.1. The default version is actually 3.10.x that comes with my freshly installed, and upgraded, Ubuntu 16.04 LTS.

To install 3.5.1 I had to do sudo apt --purge remove cmake first and then installed CMake manually. Are you sure this is still because of having the wrong version of CMake?

Also, when I also manually do echo $CMAKE_VERSION (according to this) before running install_deps.sh nothing prints and the variable is empty. So whatever is happening is after running install_deps.sh. Doing a simple search in install_deps.sh shows that install_deps.sh does not directly assign any value to CMAKE_VERSION either. Any thoughts on this?

Yes it’s not an environment variable, it’s a cmake variable cmake sets so echoing it on the console or from bash will do nothing.

I added the following lines just before compiling OIDN and now CMake is not complaining anymore, but I have new errors:

apt-get -y purge --remove --purge cmake
cd /
mkdir temp
cd temp
wget https://github.com/Kitware/CMake/releases/download/v3.12.4/cmake-3.12.4-Linux-x86_64.tar.gz
tar -xvf cmake-3.12.4-Linux-x86_64.tar.gz
cd cmake-3.12.4-Linux-x86_64
cp -r bin /usr/
cp -r doc /usr/share/
cp -r man /usr/share/
cp -r share /usr/
cd /
rm -rf temp
cd $cwd
cd $_src

This means that somehow, after running install_deps.sh CMake version 3.5.1 is installed. Although it is not doing this directly but maybe some other packages do this … .
And here are the new errors:

Any ideas on how to fix these?

I remember that to solve cmake problems in Kubuntu 18.04 I uninstalled cmake ubuntu packages, and then installed cmake latest version with pip (you need to install python-pip package first):

Before installing it with pip, you will first have to clean any version of cmake that you have tried to install manually. Use for example “whereis cmake” from the terminal to know where it is installed.

Well if you were reading the previous posts carefully ( :slight_smile: ) I said that I am installing a recent version of CMake by removing the old one before installing the dependencies of Blender but that didn’t work. Later on, I discovered that the install_deps.sh script is causing CMake 3.5.1 to get installed for some weird reason. Now I am getting other errors that don’t know how to fix.

install_deps must be reinstalling the repositories version because that is version 16.04 has:

If you uninstall again the cmake repositories package and then you install cmake with pip, I am not sure that if you run again install_deps.sh it will detect cmake installed with pip, or it will reinstall cmake package again.

Do you know where in install_deps.sh the command to install original repositories is called?

No, I don’t really know. Only a user here, I have no idea how that script works.

@LazyDodo Based on this The issue is not having a new version of TBB installed. I tried apt-get install libtbb-dev but it looks like this will install a version that is around 5 years old on Ubuntu 16.04 LTS. I think you should add something to install_deps.sh script to install a newer version of it.

i’m the windows maintainer, but i’ll page @mont29 for you he should be your guy there.

I could compile Blender with OIDN 1.1.0 after installing one of the latest versions of TBB and CMake manually, and right before OIDN compilation began. I was afraid installing TBB before running install_deps.sh would still not work as it seems that install_deps.sh script somehow causes old versions of packages to get installed.

Here’s how I installed TBB (source):

git clone https://github.com/wjakob/tbb.git
cd tbb/build
cmake ..
make -j
sudo make install