isce-framework / isce3

InSAR Scientific Computing Environment ***NOTICE - This repository is currently a mirror of an internally hosted project and is in the process of migrating the development to this public repository. In near future we will accept external pull requests.***
Other
126 stars 35 forks source link

GDAL 3.10.0 support? #25

Open marklit opened 2 hours ago

marklit commented 2 hours ago
$ python -V # Python 3.11.10
$ sudo apt update
$ sudo apt install \
    libeigen3-dev \
    fftw3 \
    fftw3-dev \
    pkg-config

# $ sudo apt -y install python3-pybind11
# $ pip install -U "pybind11[global]"
$ pip install pyre-check
$ sudo ldconfig

$ cd /mnt/d/code_gis
$ git clone https://github.com/isce-framework/isce3
$ cd isce3

$ export CPLUS_INCLUDE_PATH=/mnt/d/code_gis/gdal-3.10.0/
$ export C_INCLUDE_PATH=/mnt/d/code_gis/gdal-3.10.0/
$ sudo ldconfig

$ mkdir build
$ cd build

$ CC=gcc \
  CXX=g++ \
  GDAL_ROOT=/mnt/d/code_gis/gdal-3.10.0 \
  cmake \
    -DCMAKE_INSTALL_PREFIX=../install \
    ../

$ make -j$(nproc) VERBOSE=ON
In file included from /home/mark/.nasa_sar/include/pybind11/detail/common.h:328,
                 from /home/mark/.nasa_sar/include/pybind11/attr.h:13,
                 from /home/mark/.nasa_sar/include/pybind11/detail/class.h:12,
                 from /home/mark/.nasa_sar/include/pybind11/pybind11.h:12,
                 from /mnt/d/code_gis/isce3/build/_deps/pyre-src/extensions/pyre/grid/../external.h:18,
                 from /mnt/d/code_gis/isce3/build/_deps/pyre-src/extensions/pyre/grid/external.h:12,
                 from /mnt/d/code_gis/isce3/build/_deps/pyre-src/extensions/pyre/grid/grids.cc:8:
/mnt/d/code_gis/gdal-3.10.0/version:1:1: error: too many decimal points in number
    1 | 3.10.0
      | ^~~~~~
$ pip freeze | grep pybind
pybind11==2.13.6
marklit commented 2 hours ago

I tried GDAL 3.9.3 but I'm still getting the same error message.

$ export CPLUS_INCLUDE_PATH=/mnt/d/code_gis/gdal-3.9.3/
$ export C_INCLUDE_PATH=/mnt/d/code_gis/gdal-3.9.3/
$ sudo ldconfig

$ mkdir build
$ cd build

$ CC=gcc \
  CXX=g++ \
  GDAL_ROOT=/mnt/d/code_gis/gdal-3.9.3 \
  cmake \
    -DCMAKE_INSTALL_PREFIX=../install \
    ../

$ make -j$(nproc) VERBOSE=ON
/mnt/d/code_gis/gdal-3.9.3/version:1:1: error: expected unqualified-id before numeric constant
In file included from /home/mark/.nasa_sar/include/pybind11/detail/common.h:328,
                 from /home/mark/.nasa_sar/include/pybind11/attr.h:13,
                 from /home/mark/.nasa_sar/include/pybind11/detail/class.h:12,
                 from /home/mark/.nasa_sar/include/pybind11/pybind11.h:12,
                 from /mnt/d/code_gis/isce3/build/_deps/pyre-src/extensions/pyre/timers/../external.h:18,
                 from /mnt/d/code_gis/isce3/build/_deps/pyre-src/extensions/pyre/timers/external.h:12,
                 from /mnt/d/code_gis/isce3/build/_deps/pyre-src/extensions/pyre/timers/wall_timers.cc:8:
/mnt/d/code_gis/gdal-3.9.3/version:1:1: error: expected unqualified-id before numeric constant
piyushrpt commented 2 hours ago

Is it picking up the right version of pybind11. grep -i pybind11 CMakeCache.txt - the error suggest some form of clash between Python headers.

Also pyre-check is unrelated to this project.

aivazis commented 1 hour ago

I think the problem is the file version in the gdal directory that has been added to the include path. This file shadows the file version from the STL. Do things improve if instead of setting CPLUS_INCLUDE_PATH to the root gdal directory, you instead point it to where the gdal headers are?

piyushrpt commented 1 hour ago

What versions of cmake are you in? Maybe there have been changes to GDAL auto detect as well due to the new version file as suggested above.

On my laptop with homebrew

cmake 3.30.5
pybind11 2.13.6 
clang 16.0.0
python 3.11.10
gdal 3.9.3

Built fine without issues

piyushrpt commented 54 minutes ago

I do not see a file named version. GDAL handles all its versions via gdal_version.h. Are you sure GDAL_ROOT is correctly set and there is are lib, include and bin folders under it

aivazis commented 49 minutes ago

@marklit's output complains that /mnt/d/code_gis/gdal-3.10.0/version is not parsable because the (assumed) real literal 3.10.0 has too many decimal points. clearly during compilation, some file #include <version>, a standard STL header, and it is being shadowed by the identically named file in the main gdal distribution directory. in turn, this directory is visible to the compiler because of the CPLUS_INCLUDE_PATH environment variable setting. let's wait for @marklit to verify that this is the case...

piyushrpt commented 41 minutes ago

I agree with a file named version shadowing the system file but I don't think its part of the standard / official GDAL distribution. Hence my question on if the GDAL_ROOT that he is passing to cmake is correctly set.