build otb conda package
Description
I was trying to compile otb in a conda environment until an error occur during the configure step:
Enabled OTBTransform, requested by OTB_BUILD_DEFAULT_MODULES.
-- Enabled OTBUnmixing, requested by OTB_BUILD_DEFAULT_MODULES.
-- Enabled OTBUnsupervised, requested by OTB_BUILD_DEFAULT_MODULES.
-- Enabled OTBVectorDataBase, requested by OTB_BUILD_DEFAULT_MODULES.
-- Enabled OTBVectorDataIO, requested by OTB_BUILD_DEFAULT_MODULES.
-- Enabled OTBVectorDataManipulation, requested by OTB_BUILD_DEFAULT_MODULES.
-- Enabled OTBWatersheds, requested by OTB_BUILD_DEFAULT_MODULES.
-- Enabled OTBWavelet, requested by OTB_BUILD_DEFAULT_MODULES.
-- Enabled OTBlibkml, requested by OTB_BUILD_DEFAULT_MODULES.
-- Using GSL. Your OTB will be under the GNU GPL License or better.
-- Using OTBTemporalGapFilling. Your OTB will be under the Affero GNU GPL License or better.
-- Using iota2. Your OTB will be under the GNU GPL License.
CMake Error at CMake/FindMuParser.cmake:54 (math):
math cannot parse the expression: "((/*
_____ __ _____________ _______ ______ ___________
/ \| | \____ \__ \\_ __ \/ ___// __ \_ __ \
| Y Y \ | / |_> > __ \| | \/\___ \\ ___/| | \/
|__|_| /____/| __(____ /__| /____ >\___ >__|
\/ |__| \/ \/ \/
Copyright (C) 2004 - 2020 Ingo Berg
...
...
CMake 3.17.0 successfully configured OTB using Ninja generator
======================= End of OTB cmake summary =======================
-- Configuring incomplete, errors occurred!
also, the following is present in my CMakeError.log file :
Source file was:
int main() { return 0;}
Performing C++ SOURCE FILE Test CXX_HAS_DISABLE_OPTIMIZATION_FLAG failed with the following output:
Change Dir: /mnt/data/home/tardyb/miniconda3/conda-bld/otb_1592396585387/work/build/CMakeFiles/CMakeTmp
Run Build Command(s):/mnt/data/home/tardyb/miniconda3/conda-bld/otb_1592396585387/_build_env/bin/ninja cmTC_6efe8 && [1/2] Building CXX object CMakeFiles/cmTC_6efe8.dir/src.cxx.o
FAILED: CMakeFiles/cmTC_6efe8.dir/src.cxx.o
/mnt/data/home/tardyb/miniconda3/conda-bld/otb_1592396585387/_build_env/bin/x86_64-conda_cos6-linux-gnu-g++ -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wunused -Wwrite-strings -funit-at-a-time -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Woverloaded-virtual -Wstrict-null-sentinel -std=c++14 -DCXX_HAS_DISABLE_OPTIMIZATION_FLAG -std=c++14 -o CMakeFiles/cmTC_6efe8.dir/src.cxx.o -c src.cxx
src.cxx:1:1: error: expected unqualified-id before '-' token
-O0
^
ninja: build stopped: subcommand failed.
Source file was:
-O0
thanks to @gpasero advices I temporary fix these issues thanks to some corrections, here is the the diff
about FindMuParser.cmake
diff --git OTB/CMake/FindMuParser.cmake OTB/CMake/FindMuParser.cmake
index ecfd7e7..68cf1af 100644
--- OTB/CMake/FindMuParser.cmake
+++ OTB/CMake/FindMuParser.cmake
@@ -39,7 +39,8 @@ endif()
find_path( MUPARSER_INCLUDE_DIR muParser.h
PATH_SUFFIXES muParser )
-if(EXISTS "${MUPARSER_INCLUDE_DIR}/muParserDef.h")
+# if(EXISTS "${MUPARSER_INCLUDE_DIR}/muParserDef.h")
+if(0)
file(READ "${MUPARSER_INCLUDE_DIR}/muParserDef.h" _muParserDef_h_CONTENTS)
string(REGEX REPLACE ".*# *define MUP_VERSION *_T\\(\"([0-9.]+)\"\\).*" "\\1" MUPARSER_VERSION "${_muP
if(MUPARSER_VERSION MATCHES "^[0-9]+\$")
and on OTBSetStandardCompilerFlags.cmake
diff --git OTB/CMake/OTBSetStandardCompilerFlags.cmake OTB/CMake/OTBSetStandardCompilerFlags.cmake
index a9f4e19..156e9ba 100644
--- OTB/CMake/OTBSetStandardCompilerFlags.cmake
+++ OTB/CMake/OTBSetStandardCompilerFlags.cmake
@@ -333,7 +333,7 @@ macro(check_compiler_platform_flags)
set(OTB_CXX_DISABLE_OPTIMIZATION_FLAG "-O0")
endif()
if(DEFINED OTB_CXX_DISABLE_OPTIMIZATION_FLAG)
- CHECK_CXX_SOURCE_COMPILES(${OTB_CXX_DISABLE_OPTIMIZATION_FLAG} CXX_HAS_DISABLE_OPTIMIZATION_FLAG)
+ CHECK_CXX_COMPILER_FLAG(${OTB_CXX_DISABLE_OPTIMIZATION_FLAG} CXX_HAS_DISABLE_OPTIMIZATION_FLAG)
endif()
endmacro()#End the platform check function
I'm using muparser 2.3.2 from conda-forge, this muparser version seems to be unrecognizable.