Remote module installation - cmake error

Hi everyone,

I tried to follow the remote modules installation instructions to install lsgrm.

Superbuild went fine, I then added the lsgrm.remote.cmake to otb/Modules/Remote and re-ran cmake but got the following error.

cmake /home/loic/OTB/otb/

CMake Error: The source “/home/loic/OTB/otb/CMakeLists.txt” does not match the source “/home/loic/OTB/otb/SuperBuild/CMakeLists.txt” used to generate cache. Re-run cmake with a different source directory.

Thanks for any help,

Loïc

Hi Loïc,
When you want to re-run cmake you need to do it in the corresponding folder. For instance from what you said you tried to run cmake /home/loic/OTB/otb in the folder where you build the SuperBuild project. So cmake is telling you that you cannot run two different project in the same place. If you want to re-run the otb cmake (different from the superbuild one) you need to go under the following folder /home/loic/OTB/superbuild_build/OTB/build/ (with superbuild_build the folder where you build the superbuild project).
You can add the lsgrm.remote.cmake before building the superbuild if you want to avoid re-running OTB build.
I hope it helps,
Antoine

Hi Antoine,

Indeed the main issue is that I’m not very familiar with cmake !
I re-ran everything from scratch to make sure I wasn’t working in a messed up environment from my previous attempts; here’s my full command history.

mkdir OTB
cd OTB/
git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git
mkdir -p build/Downloads install
cd build/Downloads/
wget https://www.orfeo-toolbox.org/packages/SuperBuild-archives-develop.tar.bz2
tar xvjf SuperBuild-archives-develop.tar.bz2
cd ..
wget http://tully.ups-tlse.fr/cressonr/lsgrm/raw/master/lsgrm.remote.cmake -P 
~/OTB/otb/Modules/Remote/
cmake -D CMAKE_INSTALL_PREFIX=~/OTB/install -DModule_lsgrm=ON -DOTB_USE_MPI=ON 
../otb/SuperBuild
make -j 45

As you see I tried adding the remote module before the superbuild as you suggested, but cmake gave me a

CMake Warning:
  Manually-specified variables were not used by the project:

MODULE_lsgrm

So obviously the resulting build does not contain the remote module.

Kind regards,
Loïc

Almost! :wink:
When you try to set this kind of compile option for OTB through the SuperBuild you need to pass with this: -DOTB_ADDITIONAL_CACHE="-DModule_lsgrm=ON".
Or you can go under OTB/build/OTB/build and run cmake -DModule_lsgrm=ON . then make -j 45.

Still not working unfortunately :cry:
When I navigate to OTB/build/OTB/build and run cmake -DModule_lsgrm=ON ., I get a cmake Warning.

  Manually-specified variables were not used by the project:

    Module_lsgrm

And passing -DOTB_ADDITIONAL_CACHE="-DModule_lsgrm=ON" to the superbuild, cmake tells me

CMake Warning at /usr/share/cmake-3.10/Modules/ExternalProject.cmake:1656 (message):
  Line 'Module_lsgrm=ON' does not match regex.  Ignoring.

Looking at the file of your remote module the correct option should be Module_LSGRM, module name is case sensitive, and can be found at the first line of your cmake file: otb_fetch_module(LSGRM [...])

Great, it works now, and I learned a few things about cmake in the process.
Below the full command history in case someone is having similar issues.

mkdir OTB
cd OTB/
git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git
mkdir -p build/Downloads install
cd build/Downloads/
wget https://www.orfeo-toolbox.org/packages/SuperBuild-archives-develop.tar.bz2
tar xvjf SuperBuild-archives-develop.tar.bz2
cd ..
wget http://tully.ups-tlse.fr/cressonr/lsgrm/raw/master/lsgrm.remote.cmake -P 
~/OTB/otb/Modules/Remote/
cmake -D CMAKE_INSTALL_PREFIX=~/OTB/install -DOTB_USE_MPI=ON 
../otb/SuperBuild
make
cd OTB/build/ # Note that we are going two levels deeper (~/OTB/build/OTB/build)
cmake -DModule_LSGRM=ON -DModule_otbGRM=ON -DOTB_USE_MPI=ON -D CMAKE_INSTALL_PREFIX=~/OTB/install .
make
make install

Thanks for the guidance,
Kind regards,
Loïc