Problem install OTB from sources on windows 10

Context

Install OTB and remote modules from sources on windows 10

Configuration setup

My system: *Windows10
Version of the OTB: 8.1.2
I installed the OTB with: the core binaries with xdk and OTB from sources

Hello,

I’m trying to install OTB (core software + add-ons) on Windows 10 from source. I have followed most of the procedure described in the following message: https://forum.orfeo-toolbox.org/t/install-remote-module-on-windows/728
When I run my Cmake compile command, I I’m not getting any critical errors (Cmake_configOTB.txt file
Cmake_configOTB.txt (14.4 KB) and I can use the nmake install command to install OTB and its modules. Installation goes smoothly up to 64%. From then on, I get an error message that prevents me from finalizing the installation and indicates an error concerning the installation of the otbVectorDimensionalityReduction application. See text file nmake_installOTB.txt
nmake_installOTB.txt (20.2 KB)

I don’t quite understand this message, but at first glance it seems to be a compatibility problem with the version of microsoft visual studio 2019 that I’m using.
Could you please tell me what the problem is and how to fix it?

Thank you

Ranfosic

Hi @Ranfosic

the nmake install states that a flag is needed to compile correctly, this flag is set in the Cmakelists in the SuperBuild folder, make sure you have this : /D_ENABLE_EXTENDED_ALIGNED_STORAGE in your CMAKE_CXX_FLAGS

Best regards

Hello Thibaut,

I tried to configure CMAKE_CXX_FLAGS to add the flag /D_ENABLE_EXTENDED_ALIGNED_STORAGE (
Cmake_configOTB_2.txt (14.4 KB)) but I always get the same error message
nmake_installOTB_2.txt (21.0 KB)
.
Is there another parameter to set?

Thanks.

Best regards,

Ranfosic

Hi,

There is still a problem in your CMAKE_CXX_FLAGS, because there is no space between /EHsc and /D_ENABLE_EXTENDED_ALIGNED_STORAGE.
To make sure everything is ok you should remove everything from your build folder to compile from scratch with the options separated by a space.

Let me know

Best regards

Hello Thibaut,

Thank you for your reply.
I think the cmake configuration is correct now (I added the space as you recommended) but I have a new error with nmake. It’s an error concerning the remote moduleTemporalGapFilling and the call to gsl library functions.
nmake_installOTB_3.txt (6.5 KB)

How can I avoid this error message?

Thanks for your help.

Best regards,

Ranfosic

The OTBTemporalGapFilling is a remote module not developped by the OTB Team, it is compiling on Linux, but I never tested on Windows, but the CI compiles it successfully on Windows, you can look at the Code on the compiles options. You can navigate through the CI folder to look at other files used by the CI
This module is also not maintained since at least 3 years. It looks like there is a missing link to the GSL library in your case, maybe in the CMakeLists of the module there is a missing “find_package(GSL)” you can try, also verify that in your configure there is this message displayed :

“-- Using GSL. Your OTB will be under the GNU GPL License or better.”

Best regards

Hello Thibaut,

Thank you for your reply.
I don’t quite understand the first part of your message.
What does the sentence “You can navigate through the CI folder to look at other files used by the CI” mean?
I need to examine the CI folder (https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/tree/release-8.1/CI) to check that a cmake configuration includes the addition of the TemporalGapFilling module and take inspiration from it?
I tried to add the line find_package(GSL) in the Cmake.list file of the TemporalGapFilling module but it didn’t prevent the error. The message “-- Using GSL. Your OTB will be under the GNU GPL License or better.” is indeed present in the Cmake.list file. The original version of this config file is here
TemporalGapFilling_CMakeLists.txt (256 Bytes).
My C:\OTB\otb\temporalgapfilling\CMake folder contains a file named
FindGSL.cmake (9.9 KB) to configure access to GSL. Is it necessary to specify parameters in this file?
I installed GSL via vcpkg and my general CMake configuration tells me that GSL is recognized (except for the executable configuration).


Three years ago, I had already installed these remote modules on another PC and I didn’t have this kind of problem (there were other problems but it concerned the source code of the modules and it seems to me that this has since been corrected).
Do you have any idea how to solve this problem?

Thanks,

Best regards,

Ranfosic

Oh I see, You said you installed GSL via vcpkg, did you deactivate the build of GSL in the SuperBuild? There may be a conflict if you did compile GSL and also install it via vcpkg. I don’t know how vcpkg works though.
Can you verify you installed the same version of GSL as the superbuild one (2.7.0)?
If your version is different it can explain the undefined reference to some functions in GSL.
You can also check the file SuperBuild/CMake/External_gsl.cmake to see the build option of GSL. You have to make sure the version built by vcpkg uses the same build options

Yes you can look at the files inside the CI folder and the .gitlab-ci.yml file to see how the windows job is compiling OTB. In the CI Job, we build GSL in the SuperBuild (OTB_USE_GSL), we don’t use the one provided by vcpkg.

Regards

Hello Thibaut,

Thank you for your reply.
Sorry but I don’t know how to disable GSL build in superbuild mode.
My version of gsl installed via vcpkg is 2.71#3.
I configured gsl without taking vcpkg into account, in this case the default gsl library is the one available in C:\OTB\OTB-8.1.2-Win64\include but this doesn’t change the error message after nmake compilation (same error message as in the file previously sent
nmake_installOTB_3.txt (6.5 KB)
). The GSL version in this file is 2.7.0.
When I don’t take vcpkg into account in the cmake configuration, I get an alert message telling me that the PkgConfig package is missing “Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)”.
Here are my Cmake command lines:
-configure with gsl from OTB-8.1.2-Win64\include:

cmake C:/OTB/otb -G"NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:\OTB\install -DCMAKE_PREFIX_PATH=C:\OTB\OTB-8.1.2-Win64 -DCMAKE_CXX_FLAGS:STRING=“/DTHROW_QCRITICAL=0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_ENABLE_EXTENDED_ALIGNED_STORAGE” -DSWIG_EXECUTABLE:STRING=C:\swigwin-4.2.0\swigwin-4.2.0\swig.exe -DOTB_USE_QT=ON -DOTB_USE_QWT=ON -DOTB_USE_GLEW=ON -DOTB_USE_OPENGL=ON -DModule_OTBTemporalGapFilling=ON -DModule_OTBPhenology=ON -DModule_OTBBioVars=ON -DOTB_USE_GSL=ON -DCMAKE_BUILD_TYPE=Release -DOTB_USE_OPENCV=ON -DOTB_USE_MUPARSER=ON -DOTB_USE_MUPARSERX=ON -DOTB_USE_6S=ON -DOTB_USE_LIBSVM=ON -DOTB_USE_CURL=ON -DOTB_USE_SHARK=ON -DBUILD_APPLICATIONS=ON -DOTB_WRAP_QT=ON -DOTB_WRAP_PYTHON=ON

  • configuration with vcpkg gsl:

cmake C:/OTB/otb -G"NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:\OTB\install -DCMAKE_PREFIX_PATH=C:\OTB\OTB-8.1.2-Win64 -DCMAKE_CXX_FLAGS:STRING=“/DTHROW_QCRITICAL=0 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_ENABLE_EXTENDED_ALIGNED_STORAGE” -DCMAKE_TOOLCHAIN_FILE=C:\DEV\vcpkg\scripts\buildsystems\vcpkg.cmake -DSWIG_EXECUTABLE:STRING=C:\swigwin-4.2.0\swigwin-4.2.0\swig.exe -DOTB_USE_QT=ON -DOTB_USE_QWT=ON -DOTB_USE_GLEW=ON -DOTB_USE_OPENGL=ON -DModule_OTBTemporalGapFilling=ON -DModule_OTBPhenology=ON -DModule_OTBBioVars=ON -DOTB_USE_GSL=ON -DCMAKE_BUILD_TYPE=Release -DOTB_USE_OPENCV=ON -DOTB_USE_MUPARSER=ON -DOTB_USE_MUPARSERX=ON -DOTB_USE_6S=ON -DOTB_USE_LIBSVM=ON -DOTB_USE_CURL=ON -DOTB_USE_SHARK=ON -DBUILD_APPLICATIONS=ON -DOTB_WRAP_QT=ON -DOTB_WRAP_PYTHON=ON

I don’t quite understand how to set this up. Could you please suggest the usual Cmake configuration command line you use to install OTB and its remote modules from source under the Windows environment?
Thank you

Best regards,

Ranfosic

Hi,

You can find the full configure commande here :
https://cdash.orfeo-toolbox.org/build/15569/configure

We compile in 2 steps :

  • The prepare is building from the CMakeLists in the SuperBuild folder, and then we call the make OTB_DEPENDS target, which build every dependencies of OTB and install it in the “xdk”

  • The main_superbuild is building the CMakeLists in the main otb folder, using the “xdk” folder

The configure that I sent is from the main_superbuild step.

As I don’t know vcpkg at all I can’t help on this side

Best regards

Hello Thibaut,

Thank you for your reply but, sorry, I didn’t understand it.

What initial configuration (folders installed) are you starting from?
You say you start with the CMakeLists in the SuperBuild folder, then call the make OTB_DEPENDS target, which builds all OTB dependencies and installs them in the “xdk” folder.
In the Windows environment, the SuperBuild folder (installed on my computer at C:\OTB\otb\SuperBuild) is the result of the installation of binary packages for Windows (version OTB-8.1.2-Win64 for my part) for which only the dependencies necessary for installation from source are kept using the tool tools/uninstall_otb.bat?
Do these necessary dependencies make up what you call the xdk (https://www.orfeo-toolbox.org/CookBook/Installation.html)?
For my part, these binary dependencies can be found in a folder named C:\OTB\OTB-8.1.2-Win64
I don’t understand what make OTB_DEPENDS is, which builds all the necessary OTB dependencies and installs them in an xdk folder (in your case located in C:/build/otb/xdk). It’s a Cmake command that calls the Windows binary dependencies and installs them in the xdk folder? In my case, I thought that the C:\OTB\OTB-8.1.2-Win64 folder acted as the xdk since it contains most of the dependencies needed for OTB.

In the following lines, I summarize the name and tree structure of my installation folders, as well as the location of the necessary dependencies:
C:\OTB\otb → sources and SuperBuid installation folder
C:\OTB\build → folder for intermediate objects, CMake-specific files, libraries and binaries.
C:\OTB\install → the OTB installation directory once it has been built.
Initially, most OTB dependencies (ITK, Boost, gdal, curl, gsl, libsvm, muparser, opencv, shark, tiff, tinyxml) are located in my C:\OTB\OTB-8.1.2-Win64 folder.
I’ve installed MSYS2 and pkg_config.exe is in C:\msys64\ucrt64\bin.
numpy is in the C:\msys64\ucrt64\include\python3.11\numpy folder
SWIG is in C:/swigwin-4.2.0/swigwin-4.2.0/

I tried to configure it using the command you gave me and the installation of my folders. The Cmake configuration didn’t give me any particular error except for the GDAL test. I had to set the GDAL_CONFIG_CHECKING:BOOL=OFF parameter to get no more configuration errors.
How to leave GDAL_CONFIG_CHECKING:BOOL=ON without getting an error message?

However, I don’t know how to configure pkg_config and numpy by command lines (I can do it through the Cmake GUI). What are the cmake commands for these parameters, or are they detected automatically?
Here’s my configuration
Cmake_configOTB_3.txt (17.5 KB)

After nmake install, I have an error message at 77%
nmake_installOTB_4.txt (962 Bytes)

What is the difference between the “DCMAKE_PREFIX_PATH=” command and the
“DCMAKE_INSTALL_PREFIX:PATH=” command? Should they be configured similarly?

In my case, according to the names of my folders, If I understood, I should configure the command
DCMAKE_INSTALL_PREFIX:PATH=C:/OTB/OTB-8.1.2-Win64 ?

Thanks for your help.
Best regards,

Ranfosic

Hello Thibaut,

Thank you for your reply but, sorry, I didn’t understand it.

What initial configuration (folders installed) are you starting from?
You say you start with the CMakeLists in the SuperBuild folder, then call the make OTB_DEPENDS target, which builds all OTB dependencies and installs them in the “xdk” folder.
In the Windows environment, the SuperBuild folder (installed on my computer at C:\OTB\otb\SuperBuild) is the result of the installation of binary packages for Windows (version OTB-8.1.2-Win64 for my part) for which only the dependencies necessary for installation from source are kept using the tool tools/uninstall_otb.bat?
Do these necessary dependencies make up what you call the xdk (Installation — Orfeo ToolBox 9.0.0 documentation)?
For my part, these binary dependencies can be found in a folder named C:\OTB\OTB-8.1.2-Win64
I don’t understand what make OTB_DEPENDS is, which builds all the necessary OTB dependencies and installs them in an xdk folder (in your case located in C:/build/otb/xdk). It’s a Cmake command that calls the Windows binary dependencies and installs them in the xdk folder? In my case, I thought that the C:\OTB\OTB-8.1.2-Win64 folder acted as the xdk since it contains most of the dependencies needed for OTB.

In the following lines, I summarize the name and tree structure of my installation folders, as well as the location of the necessary dependencies:
C:\OTB\otb → sources and SuperBuid installation folder
C:\OTB\build → folder for intermediate objects, CMake-specific files, libraries and binaries.
C:\OTB\install → the OTB installation directory once it has been built.
Initially, most OTB dependencies (ITK, Boost, gdal, curl, gsl, libsvm, muparser, opencv, shark, tiff, tinyxml) are located in my C:\OTB\OTB-8.1.2-Win64 folder.
I’ve installed MSYS2 and pkg_config.exe is in C:\msys64\ucrt64\bin.
numpy is in the C:\msys64\ucrt64\include\python3.11\numpy folder
SWIG is in C:/swigwin-4.2.0/swigwin-4.2.0/

I tried to configure it using the command you gave me and the installation of my folders. The Cmake configuration didn’t give me any particular error except for the GDAL test. I had to set the GDAL_CONFIG_CHECKING:BOOL=OFF parameter to get no more configuration errors.
How to leave GDAL_CONFIG_CHECKING:BOOL=ON without getting an error message?

However, I don’t know how to configure pkg_config and numpy by command lines (I can do it through the Cmake GUI). What are the cmake commands for these parameters, or are they detected automatically?
Here’s my configuration
Cmake_configOTB_3.txt (17.5 KB)

After nmake install, I have an error message at 77%
nmake_installOTB_4.txt (962 Bytes)

What is the difference between the “DCMAKE_PREFIX_PATH=” command and the
“DCMAKE_INSTALL_PREFIX:PATH=” command? Should they be configured similarly?

In my case, according to the names of my folders, If I understood, I should configure the command
DCMAKE_INSTALL_PREFIX:PATH=C:/OTB/OTB-8.1.2-Win64 ?

Thanks for your help.
Best regards,

Ranfosic

Hi,

If I understand correctly, you try to use the dependencies from the binary package after doing uninstall_otb.bat ? In that case you don’t build the Superbuild dependencies : you don’t need to do the make OTB_DEPENDS, which is a target to build all the dependencies from sources. So, The folder C:/OTB/OTB-8.1.-2-Win64 acts as the xdk in your case. all you have to do is build otb, setting the CMAKE_PREFIX_PATH to C:/OTB/OTB-8.1.-2-Win64.

In order to recognize pkg config, you have to add C:/msys64 (maybe there is a cmake subfolder here?) to the CMAKE_PREFIX_PATH so cmake can detect it.
For numpy you have to get it installed in your python installation via pip install numpy and it will work as CMake will detect it.

About GDAL_CONFIG_CHECKING failing, it happens sometimes on windows only, you can just let it to OFF as it does not cause any further issue.

CMAKE_PREFIX_PATH is the variable telling cmake to search for dependencies when there is a find_package(pkgname) call.
CMAKE_INSTALL_PREFIX is the variable telling cmake where to install your project.

You have to install your otb in the same folder as the dependencies in C:/OTB/OTB-8.1.2-Win64, because all the dlls from OTB AND the dependencies have to be in the same “bin” folder. CMAKE_INSTALL_PREFIX has to be C:/OTB/OTB-8.1.2-Win64

The error in QGIS descriptor is really weird, don’t you have write permission issues on this folder? You can try deactivating the OTB_WRAP_QGIS to see if the compilation goes to 100% for a first successfull build.

Best regards