Bug 15281 - Error compiling GDAL library for RPi-64 if libgdal-dev installed on the host computer
Summary: Error compiling GDAL library for RPi-64 if libgdal-dev installed on the host ...
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2022.11
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-23 21:37 UTC by Himar Alonso
Modified: 2023-01-28 20:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
0001-package-gdal-switch-to-cmake-build.patch (5.62 KB, patch)
2023-01-24 12:09 UTC, Maxim Kochetkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Himar Alonso 2023-01-23 21:37:13 UTC
I get a compiler error when Buildroot tries to compile "tigerpoint.cpp" from the GDAL package if the "libgdal-dev" package is installed on the host computer (Ubuntu 22.04 x86_64).

I am using the default configuration for Raspberry Pi CM4IO 64 bits; the "gdal" library is the only extra package I am adding.

This is the sequence to reproduce the error:
$ git clone https://github.com/buildroot/buildroot.git -b 2022.11.1
$ cd buildroot
$ make raspberrypicm4io_64_defconfig
$ make menuconfig
#  Add: Target packages / Libraries / Other / gdal (BR2_PACKAGE_GDAL=y)
$ make

The error message does not give any clues:
make[1]: *** [package/pkg-generic.mk:293: /home/user/rpitest/buildroot/output/build/gdal-3.5.1/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2

The same error happens on different computers, all running the same Ubuntu version. I have also tried using an external toolchain (Bootlin aarch64--musl--stable-2021.11-1) and I get the same result.

The only way out seems to be removing "libgdal-dev" on the host computer along with its dependencies (note the apt autoremove line below) and a running a clean rebuild as follows:
$ sudo apt purge libgdal-dev
$ sudo apt autoremove
$ make gdal-dirclean
$ make gdal

Given my lack of experience and the little amount of information from the error message I am unable to figure out where the problem could be. There seems to be some conflict between the GDAL library installed on my computer and the one downloaded by Buildroot. I might have made a mistake but I would just not expect Buildroot to look for (e.g.) include paths out of the "buildroot" folder.
Comment 1 Maxim Kochetkov 2023-01-24 12:09:55 UTC
Created attachment 9486 [details]
0001-package-gdal-switch-to-cmake-build.patch

Please try this patch
Comment 2 Himar Alonso 2023-01-25 01:00:34 UTC
This patch solves the problem. I have tried using both the internal and external toolchains. It just works.

Thanks a lot Maxim!! :)