Error when building OTB with MS Visual Studio 2019

Problem solved. THX。

Dear @zlyjob,

It would have been nice to leave your first message explaining your problem, and then explain how you fixed it. That way, if someone else has the same issue, they can find a solution.

Best regards.
Julien :slight_smile:

Hi Julien,
Sorry, you konw, I am new to here, I just don’t want to disturb anyone when I don’t have to. :sweat_smile:
Now I list all the fixed errors and soluiuons here.

And a new error.

ninja: error: ‘C:/otb8/install_Releasex64/lib/qwt_i.lib’, needed by ‘bin/OTBMonteverdiGUI-8.0.dll’, missing and no known rule to make it

Thank you for any help or clue about the new error.
Regards.

Leo


My environment setting:

set CURRENT_DIR=C:\otb8
set TOOLS_DIR=%CURRENT_DIR%\tools
set COMPILER_ARCH=x64
set COMPILER_MODE=Release
set COMPILER_NAME=%COMPILER_MODE%%COMPILER_ARCH%
set BUILD_DIR=build_%COMPILER_MODE%%COMPILER_ARCH%
set SYSPATH=C:\Windows\system32;C:\Windows
set PATH=%SYSPATH%
set PATH=%PATH%;%TOOLS_DIR%\patch-2.5.9-7\bin
set PATH=%PATH%;%TOOLS_DIR%\wget-1.11.4-1\bin
set PATH=%PATH%;%TOOLS_DIR%\Git-2.9.0\bin;%TOOLS_DIR%\Git-2.9.0\usr\bin
set PATH=%PATH%;%TOOLS_DIR%\ninja
set PATH=%PATH%;%TOOLS_DIR%\jom\bin
set PATH=%PATH%;%TOOLS_DIR%\7zip-16.02
set PATH=%PATH%;%TOOLS_DIR%\swigwin-3.0.10
set PATH=%PATH%;C:\Python3.8.7;C:\Python3.8.7\Scripts
::set PATH=%PATH%;%TOOLS_DIR%\cmake-3.14.7\bin
set PATH=%PATH%;%TOOLS_DIR%\C:\Program Files\CMake\bin
if not exist “%CURRENT_DIR%\install_%COMPILER_NAME%” mkdir “%CURRENT_DIR%\install_%COMPILER_NAME%”
set PATH=%PATH%;%CURRENT_DIR%\install_%COMPILER_NAME%\bin
set PATH=%PATH%;%CURRENT_DIR%\install_%COMPILER_NAME%\lib
call “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat” %COMPILER_ARCH%
if not exist “%CURRENT_DIR%%BUILD_DIR%” mkdir “%CURRENT_DIR%%BUILD_DIR%”

cd %CURRENT_DIR%%BUILD_DIR%

cmake %CURRENT_DIR%\src\SuperBuild -DCMAKE_PREFIX_PATH=%CURRENT_DIR%\install_%COMPILER_NAME% -DCMAKE_INSTALL_PREFIX=%CURRENT_DIR%\install_%COMPILER_NAME% -DSWIG_EXECUTABLE=%TOOLS_DIR%\swigwin-3.0.10\swig.exe -DCMAKE_BUILD_TYPE=%COMPILER_MODE% -DDOWNLOAD_LOCATION=%CURRENT_DIR%\downloads -DOTB_WRAP_PYTHON=ON -GNinja
ninja


The first error:

Input patch file: C:/otb8/src/SuperBuild/patches/QT5/qt5-2-png-freetype-detection-all.diff

(Stripping trailing CRs from patch.)

patching file qtbase/src/gui/configure.json

patch unexpectedly ends in middle of line

Hunk #2 succeeded at 396 with fuzz 2 (offset -1 lines).

[254/292] Performing build step for ‘QT5’

FAILED: QT5/src/QT5-stamp/QT5-build

cmd.exe /C “cd /D C:\otb8\build_Releasex64\QT5\build && “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -P C:/otb8/build_Releasex64/QT5/src/QT5-stamp/QT5-build-Release.cmake && “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -E touch C:/otb8/build_Releasex64/QT5/src/QT5-stamp/QT5-build”

CMake Error at C:/otb8/build_Releasex64/QT5/src/QT5-stamp/QT5-build-Release.cmake:49 (message):

Command failed: The system cannot find the file specified

‘make’

See also

C:/otb8/build_Releasex64/QT5/src/QT5-stamp/QT5-build-*.log

[257/292] Performing build step for ‘GDAL’

ninja: build stopped: subcommand failed.

Solution:

Modified C:\otb8\build_Releasex64\QT5\src\QT5-stamp\QT5-build-Release.cmake & QT5-install-Release.cmake
set(command “make”) → set(command “nmake”)
set(command “make;install”) ->set(command “nmake;install”)


The second error:

[288/292] Performing configure step for ‘OTB’
FAILED: OTB/src/OTB-stamp/OTB-configure
cmd.exe /C “cd /D C:\otb8\build_Releasex64\OTB\build && “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -P C:/otb8/build_Releasex64/OTB/src/OTB-stamp/OTB-configure-Release.cmake && “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” -E touch C:/otb8/build_Releasex64/OTB/src/OTB-stamp/OTB-configure”
CMake Error at C:/otb8/build_Releasex64/OTB/src/OTB-stamp/OTB-configure-Release.cmake:4 (set):
Syntax error in cmake code at

C:/otb8/build_Releasex64/OTB/src/OTB-stamp/OTB-configure-Release.cmake:4

when parsing string

C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe;-DCURL_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DCURL_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/libcurl_imp.lib;-DShark_DIR:PATH=C:/otb8/install_Releasex64/lib/cmake/Shark;-DLIBSVM_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DLIBSVM_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/svm.lib;-DMUPARSER_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DMUPARSER_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/muparser.lib;-DMUPARSERX_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include/muparserx;-DMUPARSERX_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/muparserx.lib;-DSWIG_EXECUTABLE:STRING=C:\otb8\tools\swigwin-3.0.10\swig.exe;-DPYTHON_INCLUDE_DIR:PATH=C:/Python3.8.7/include;-DPYTHON_EXECUTABLE:STRING=C:/Python3.8.7/python.exe;-DQT_QMAKE_EXECUTABLE:STRING=C:/otb8/install_Releasex64/bin/qmake;-DGLEW_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DGLEW_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/glew32.lib;-DGLUT_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DGLUT_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/libfreeglut.lib;-DQWT_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DQWT_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/qwt_i.lib;-DGSL_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DGSL_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/gsl.lib;-DGDAL_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DGDAL_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/gdal_i.lib;-DITK_DIR:PATH=C:/otb8/install_Releasex64/lib/cmake/ITK-4.13;-DTINYXML_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include;-DTINYXML_LIBRARY:FILEPATH=C:/otb8/install_Releasex64/lib/tinyxml.lib;-DBoost_INCLUDE_DIR:PATH=C:/otb8/install_Releasex64/include/boost-1_72;-GNinja;-CC:/otb8/build_Releasex64/OTB/tmp/OTB-cache-Release.cmake;C:/otb8/src/SuperBuild/..

Invalid character escape ‘\o’.
ninja: build stopped: subcommand failed.

Solution:
Modified:
C:/otb8/build_Releasex64/OTB/src/OTB-stamp/OTB-configure-Release.cmake

DSWIG_EXECUTABLE:STRING=C:\otb8\tools\swigwin-3.0.10\swig.exe

“\” → “/”


The third error

cd doc\ && ( if not exist Makefile C:\otb8\install_Releasex64\bin\qmake.exe -o Makefile C:\otb8\build_Releasex64\QWT\src\QWT\doc\doc.pro ) && “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe” -f Makefile install

Microsoft (R) Program Maintenance Utility Version 14.29.30143.0
Copyright (C) Microsoft Corporation. All rights reserved.

    C:\otb8\install_Releasex64\bin\qmake.exe -install qinstall C:\otb8\build_Releasex64\QWT\src\QWT\doc\html C:\otb8\install_Releasex64\doc\html
    C:\otb8\install_Releasex64\bin\qmake.exe -install qinstall C:\otb8\build_Releasex64\QWT\src\QWT\qwtconfig.pri C:\otb8\install_Releasex64\features\qwtconfig.pri
    C:\otb8\install_Releasex64\bin\qmake.exe -install qinstall C:\otb8\build_Releasex64\QWT\src\QWT\qwtfunctions.pri C:\otb8\install_Releasex64\features\qwtfunctions.pri
    C:\otb8\install_Releasex64\bin\qmake.exe -install qinstall C:\otb8\build_Releasex64\QWT\src\QWT\qwt.prf C:\otb8\install_Releasex64\features\qwt.prf

[289/292] Performing build step for ‘OTB’
FAILED: OTB/src/OTB-stamp/OTB-build
cmd.exe /C “cd /D C:\otb8\build_Releasex64\OTB\build && “C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe” --build .”
ninja: error: ‘C:/otb8/install_Releasex64/lib/qwt_i.lib’, needed by ‘bin/OTBMonteverdiGUI-8.0.dll’, missing and no known rule to make it
ninja: build stopped: subcommand failed.

Any help or tips on new error are welcome. Thank you a lot.

Hi,

For the third error, in an install tree of OTB on windows I can find the qwt.lib and not qwt_i.lib. You can try to modify external_qwt.cmake with :
set(_SB_QWT_LIBRARY ${SB_INSTALL_PREFIX}/lib/qwt.lib) instead of qwt_i.lib

Hi, thank you very much.
I have fixed this errorr by simply duplicated a qwt_i.lib from qwt.lib.
Regards,

1 Like