I have a bunch of problems building Salome. Starting with the first:
When it comes to OpenCV, I get, apart from lots of warnings,
/home/.../SALOME-9.8.0-native-FD34-SRC/SOURCES/opencv/3rdparty/openexr/Imath/ImathVec.h:227:41: error: ISO C++17 does not allow dynamic exception specifications
for several objects. Nevermind that I actually have OpenCV on my machine, but do not understand how sat would find it. This uses gcc 11.3.1.
You may see this kind of error message in other packages and this is because the newer GCC compilers have switched their default behaviour to the C++ 17 standard but some components do not conform to this standard and therefore an extra compiler option is required in order to specify the supported standard.
For the case of opencv the proper standard to use is C++ 14 and in order to do that you have to edit the script which builds this package for Salome. In order to do that you need to go to the foilder :
PROJECT/products/compil_scripts
and then edit file “opencv.sh”. You need to specify the proper C++ version in the beginning of the script so that it looks like the following:
#!/bin/bash
echo "##########################################################################"
echo "opencv" $VERSION
echo "##########################################################################"
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
CPPSTD="\"-std=c++14\""
CMAKE_OPTIONS=""
CMAKE_OPTIONS+=" -DCMAKE_INSTALL_PREFIX:STRING=${PRODUCT_INSTALL}"
CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE:STRING=Release"
if version_ge $VERSION "3."; then
echo "*** openCV version $VERSION >= 3."
CMAKE_OPTIONS+=" -DBUILD_NEW_PYTHON_SUPPORT=ON"
CMAKE_OPTIONS+=" -DBUILD_EXAMPLES:BOOL=ON"
CMAKE_OPTIONS+=" -DPYTHON3_EXECUTABLE=${PYTHONBIN}"
CMAKE_OPTIONS+=" -DPYTHON3_NUMPY_INCLUDE_DIRS=${NUMPY_INCLUDE_DIR};${NUMPY_INCLUDE_DIR2}"
CMAKE_OPTIONS+=" -DWITH_IPP:BOOL=OFF"
CMAKE_OPTIONS+=" -DBUILD_opencv_java:BOOL=OFF"
CMAKE_OPTIONS+=" -DPYTHON_INCLUDE_DIR=${PYTHON_ROOT_DIR}/include/python${PYTHON_VERSION}"
CMAKE_OPTIONS+=" -DPYTHON_INCLUDE_DIR2=${PYTHON_ROOT_DIR}/include/python${PYTHON_VERSION}"
CMAKE_OPTIONS+=" -DWITH_FFMPEG:BOOL=OFF"
CMAKE_OPTIONS+=" -DWITH_LAPACK:BOOL=OFF"
CMAKE_OPTIONS+=" -DWITH_CUDA:BOOL=OFF"
CMAKE_OPTIONS+=" -DWITH_V4L:BOOL=OFF"
CMAKE_OPTIONS+=" -DWITH_LIBV4L:BOOL=ON"
# bos 19730
CMAKE_OPTIONS+=" -DWITH_VTK:BOOL=OFF"
CMAKE_OPTIONS+=" -DENABLE_PRECOMPILED_HEADERS:BOOL=OFF"
CMAKE_OPTIONS+=" -DCMAKE_CXX_FLAGS=-fPIC"
CMAKE_OPTIONS+=" -DCMAKE_CXX_STANDARD=14"
CMAKE_OPTIONS+=" -DCMAKE_C_FLAGS=-fPIC"
if [[ $DIST_NAME == "FD" && $DIST_VERSION == "34" ]]
then
CMAKE_OPTIONS+=" -DCMAKE_CXX_FLAGS=${CPPSTD}"
fi
CMAKE_OPTIONS+=" -DCMAKE_C_FLAGS=-fPIC"
#
else
echo "*** openCV version $VERSION < 3."
CMAKE_OPTIONS+=" -DWITH_CUDA:BOOL=OFF"
CMAKE_OPTIONS+=" -DWITH_FFMPEG:BOOL=OFF"
# OP opencv on Ubuntu
CMAKE_OPTIONS+=" -DPYTHON_EXECUTABLE=${PYTHON_ROOT_DIR}/bin/python"
CMAKE_OPTIONS+=" -DPYTHON_INCLUDE_DIRS=${PYTHON_ROOT_DIR}/include/python${PYTHON_VERSION}"
CMAKE_OPTIONS+=" -DPYTHON_LIBRARY=${PYTHON_ROOT_DIR}/lib/libpython${PYTHON_VERSION}.so"
CMAKE_OPTIONS+=" -DBUILD_opencv_java=OFF"
fi
Note the line:
if [[ $DIST_NAME == "FD" && $DIST_VERSION == "34" ]]
then
CMAKE_OPTIONS+=" -DCMAKE_CXX_FLAGS=${CPPSTD}"
fi
This line adds the option which selects the C++ standard to enable for the case of Fedora 34. It would be better to remove the if-statement and make this option be applied all the time regradless of the Linux distro such as:
This will resolve the problem. Note that other packages may produce a similar error message in which case you have to do the same in order to modify the appropriate compilation script and specify a C++ version lower than 17.
With these changes I have compiled Salome for both Fedora 35 and 36 without any problems.
Thank you @paspro ! It is certainly nice to at least know which files to look at. With your modifications, the compilation now proceeds a wee further until:
home/…/SALOME-9.8.0-native-FD34-SRC/SOURCES/opencv/modules/core/src/persistence.cpp:7512:31: error: comparing the result of pointer addition ‘(src + ((sizetype)off))’ and NULL [-Werror=address]
7512 | if (src == 0 || src + off == 0)
Regarding omniORB (and some other prerequisites), I chose to use the native version of these packages on Fedora rather than waste time and disk space building them for Salome. I suggest you do the same. It is easy to do:
Go to the PROJECT/applications directory.
Open file SALOME-9.8.0-native.pyconf
Go to the line which mentions omniORB and change it to: omniORB: 'native'
Go to the next line which mentions omniORBpy and change it to: omniORBpy: 'native'
Save the file and close it.
You can do the same for other prerequisites which are available in the Fedora repositories. In order to install these components in Fedora do: