Skip to content

fatal error: gdal.h: No such file or directory #96

@lithium555

Description

@lithium555

Hi! I have erorr:

go build cmd/main.go
# github.com/lukeroth/gdal
/root/go/pkg/mod/github.com/lukeroth/gdal@v0.0.0-20211109203239-b571df3ee436/gdal.go:44:11: cannot define new methods on non-local type C.CPLErr
/root/go/pkg/mod/github.com/lukeroth/gdal@v0.0.0-20211109203239-b571df3ee436/gdal.go:60:11: cannot define new methods on non-local type C.OGRErr
In file included from /root/go/pkg/mod/github.com/lukeroth/gdal@v0.0.0-20211109203239-b571df3ee436/algorithms.go:4:0:
./go_gdal.h:8:10: fatal error: gdal.h: No such file or directory
 #include <gdal.h>
          ^~~~~~~~
compilation terminated.

I tried to solve this problem, like here https://stackoverflow.com/questions/72887400/install-gdal-on-linux-ubuntu-20-04-4lts-for-python but it didnt help.

I tried to fix troubles with gdall library, I installed on OS:

sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin
sudo apt-get install libgdal-dev

But it didnt help.

Whitch GDAL version I have at present time:

apt list --installed | grep "gdal"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

gdal-bin/bionic,now 2.2.3+dfsg-2 arm64 [installed]
gdal-data/bionic,now 2.2.3+dfsg-2 all [installed,automatic]
libgdal-dev/bionic,now 2.2.3+dfsg-2 arm64 [installed]
libgdal20/bionic,now 2.2.3+dfsg-2 arm64 [installed,automatic]


gdalinfo --version
GDAL 2.2.3, released 2017/11/20

If we speak about another libraries, which we need to install near GDAL, I installed them in Docker container via command:

RUN apt-get update && apt-get upgrade -yy && apt-get install -yy \
    wget \
    git \
    build-essential \
    git \
    clang-3.8 \
    libpng-dev \
    libopencv-dev \
    libgeos-dev \
    libproj-dev && \
    apt remove cmake -y && \
    pip3 install --upgrade pip && \
    pip3 install cmake --upgrade && \
    apt autoremove -y

Version of Ubuntu:

 lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions