Upgrade gdal version in superbuild
Summary
Upgrade GDAL version in the superbuild to 2.4.1
Rationale
see associated issue.
Implementation Details
We are not calling GDALDestroyDriverManager
but GDALDestroy
instead. That is why we added a patch in GDAL, so that the OGRCleanupAll
calls GDALDestroy
too.
Additional notes
The CMake function try_run
does not automatically passe the compilation flags. So we need to add it manually, that is why we added a new macro for c compilation (without those flags).
Copyright
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
- All discussions are resolved
- At least 2
votes from core developers, no vote. - The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
- Optionally, run
git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i
on latest changes and commit
Merge request reports
Activity
changed milestone to %7.0.0
added CNES backlog packaging + 1 deleted label
I'm not sure the error comes from the SuperBuild, I think all superbuild targets are built with c++ 14 (see the CMakeLists.txt of the Superbuild), and GDAL is built successfully. I think the problem is that gdalVersionTest.cxx is not compiled with C++ 11.
In
Modules/ThirdParty/GDAL/otb-module-init.cmake
I think we should add-DCMAKE_CXX_FLAGS=-std=c++11
to CMake flags in thegdal_try_run
macro used to compilegdalVersionTest.cxx
with cmake'stry_run
.But that doesn't work :D
Edited by Cédric Traizet- Resolved by Cédric Traizet
Also... There is a mistake on one of the ci script... As you need it in this MR you can change it is you want to.main_superbuild.cmake.patch
(I can reproduce the error on my ubuntu 16.04, when I try to build this branch with superbuild, and with a normal build on the develop branch with gdal 3.0 and gdal config checking to on)
Edited by Cédric TraizetGreat if you have it on your machine can you add few lines to
cpl_port.h
to see what is the value of__cplusplus
? Or even try to run the command manually to see if you can then introduced the correct flag.command:
g++ -I path/to/gdal/include -std=c++11 -o gdalVersionTest.cxx.o -c otb/Modules/ThirdParty/GDAL/gdalVersionTest.cxx
Edited by Antoine RegimbeauIt works with your command (and doesn't work without the flag). The flag doesn't seems to be introduced as the command used is, from CMake logs:
Building CXX object CMakeFiles/cmTC_7a3e8.dir/gdalVersionTest.cxx.o /usr/bin/c++ -I/home/cedric/Documents/GDAL/install-3.0.0/include -fopenmp -msse2 -mfpmath=sse -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 -o CMakeFiles/cmTC_7a3e8.dir/gdalVersionTest.cxx.o -c /home/cedric/OTB/otb/Modules/ThirdParty/GDAL/gdalVersionTest.cxx
Edited by Cédric TraizetOn my side I solve the issue by adding in
CMAKE_CXX_FLAGS
-std=c++14
. It is weird because normally this should be handled by cmake variableCMAKE_CXX_STANDARD
but if you have a look at one clean configure there is no such flags as "-std=c++XX".EDIT It looks like the flag is added for each target command line. But we still need to find how to add it in the
try_run
.Edited by Antoine Regimbeau@ctraizet if you have a recent cmake (over 3.8) try to set the cmake policy CMP0067 to new in the main cmake file. https://cmake.org/cmake/help/v3.8/policy/CMP0067.html#policy:CMP0067. But I do not know what is the status of the required version of CMake in otb.
A other solution for older CMake is to add the flag under theCOMPILE_DEFINITIONS
argument intry_run
in thegdal_try_run
macro, and in thetry_compile
forHAS_OGR
test line 108. It worked for me (CMake 3.5).
You can also move the-w
from theCMAKE_FLAGS
to theCOMPILE_DEFINITIONS
.Edited by Antoine RegimbeauHi @ctraizet ,
I have got a similar problem while compiling OTB with CMake. And the error is
. I've tried a lot of solutions but nothing worked. From the above could you elaborate on the second solution, please?
Cmake version is 3.14.6
I know that in the CMakeFile it states 3.1.0, but in the fact I am not sure it is still the case. For instance if we want to support itk 5 we will need to update to 3.10.
The current solution has its limitation as you can see in the CI. Here clang is using its C compiler so the option is not accepted...Edited by Antoine Regimbeauyes, I created another macro for c tests.
But why do we have tests in c in the first place...
Edited by Cédric Traizetadded 100 commits
-
4e70b282...d6662e0e - 98 commits from branch
develop
- dfadf97d - Merge branch 'develop' into upgrade_gdal_superbuild
- a12e6c09 - SEGF: call GDALDestroy as it is not called automatically in GDAL 2.4
-
4e70b282...d6662e0e - 98 commits from branch
added 1 commit
- e41cf15c - SB: add pkg config path for openjpeg in gdal
added 16 commits
-
e41cf15c...38e4e896 - 15 commits from branch
develop
- 36b85484 - Merge branch 'develop' into upgrade_gdal_superbuild
-
e41cf15c...38e4e896 - 15 commits from branch
mentioned in merge request !517 (merged)
added 23 commits
-
fa0ba183...b300873c - 22 commits from branch
develop
- 53e66458 - Merge branch 'develop' into upgrade_gdal_superbuild
-
fa0ba183...b300873c - 22 commits from branch
mentioned in commit 1ae2296c
mentioned in issue #1853 (closed)
mentioned in issue #1823 (closed)
mentioned in issue #1966 (closed)
added refactoring label