FS#62386 - [gdal] FTBS with non-set LD_SHARED in GNUmakefile.

Attached to Project: Community Packages
Opened by Oid Maps (dreieck) - Thursday, 18 April 2019, 07:52 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 18 April 2019, 14:11 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To No-one
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I am trying to build gdal 2.3.2 from source, using the official Arch Linux package (http://archlinux.org/packages/community/x86_64/gdal/) as a recipe, but changing `./configure`-options.

When the build process reaches `frmts/pdf` or `frmts/openjpeg`, the build fails on `make plugin`, missing a definition of the variable `LD_SHARED`.

Example: Executing `make plugin` in `frmts/openjpeg`, prints the following to the terminal:

```
/bin/sh /home/felics/tmp/install/build/gdal/src/gdal-2.3.2/libtool --mode=compile --silent --tag=CXX g++ -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2 -Wall -Wextra -Winit-self -Wunused-parameter -Wformat -Werror=format-security -Wno-format-nonliteral -Wlogical-op -Wshadow -Werror=vla -Wdate-time -Wnull-dereference -Wduplicated-cond -Wextra-semi -Wfloat-conversion -Wmissing-declarations -Wnon-virtual-dtor -Woverloaded-virtual -fno-operator-names -Wzero-as-null-pointer-constant -Wsuggest-override -Wimplicit-fallthrough -I.. -DGNM_ENABLED -I/home/felics/tmp/install/build/gdal/src/gdal-2.3.2/port -I/usr/include/webp/include -I/usr/include/ -I/usr/include//include -I/usr/include/openjpeg-2.3 -I/usr/include/jasper -I/usr/include/jasper/include -I/usr/include -I/usr/include -I/usr/include/include -I/usr/include -I/usr/include/include -I/usr/include -I/usr/include/include -I/usr/include -I/usr/include/include -DGDAL_COMPILATION -DHAVE_XERCES -I/usr/include -I/usr/include/xercesc -I/home/felics/tmp/install/build/gdal/src/gdal-2.3.2/port -I/usr/include/webp/include -I/usr/include/ -I/usr/include//include -I/usr/include/openjpeg-2.3 -I/usr/include/jasper -I/usr/include/jasper/include -I/usr/include -I/usr/include -I/usr/include/include -I/usr/include -I/usr/include/include -I/usr/include -I/usr/include/include -I/usr/include -I/usr/include/include -DGDAL_COMPILATION -c -o openjpegdataset.o openjpegdataset.cpp
openjpegdataset.o -L/usr/lib -lgdal -lcrypto -lcryptopp -larmadillo -lproj -lfreexl -L/usr/lib -lgeos_c -L/usr/include/webp/lib -lwebp -L/usr/include/ -L/usr/include//lib -lodbc -lodbcinst -lexpat -lxerces-c -lpthread -lopenjp2 -L/usr/include/jasper -L/usr/include/jasper/lib -ljasper -L/usr/lib -lnetcdf -lhdf5 -L/opt/hdf4/lib -lmfhdf -ldf -L/usr/include -L/usr/include/lib -lgif -lCharLS -L/usr/include -L/usr/include/lib -ljpeg -lgeotiff -ltiff -lpng -L/usr/include -L/usr/include/lib -lcfitsio -L/opt/grass/lib -lgrass_vector -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase -lgrass_raster -lgrass_imagery -lgrass_gproj -lgrass_gmath -lgrass_gis -lgrass_datetime -L/usr/lib -lpq -lzstd -llzma -lz -L/usr/include -L/usr/include/lib -lpthread -lm -lrt -ldl -lspatialite -lsqlite3 -lrasterlite2 -lsqlite3 -lpcre -lcurl -lNCSEcw -lNCSEcwC -lNCSCnet -lNCSUtil -lOpenCL -lxml2 -lz -llzma -licui18n -licuuc -licudata -lm -ldl -L/usr/lib/ -lmariadb -lz -ldl -lm -lpthread -lssl -lcrypto -L/usr/lib -lkea -L/usr/lib -lhdf5_cpp -lhdf5 -lsz -lz -ldl -lm \
-o gdal_JP2OpenJPEG.so
make: openjpegdataset.o: Command not found
make: *** [GNUmakefile:20: gdal_JP2OpenJPEG.so] Error 127
```

The corresponding lines of the `GNUmakefile`s in these directories are:

For `frmts/pdf/GNUmakefile`:

```
include ../../GDALmake.opt

OBJ = pdfdataset.o pdfio.o pdfobject.o pdfcreatecopy.o ogrpdflayer.o pdfwritabledataset.o pdfreadvectors.o

[...]

plugin: $(PLUGIN_DL)

$(PLUGIN_DL): $(OBJ)
$(LD_SHARED) $(OBJ) ../../ogr/ogrsf_frmts/o/ogrmemdatasource.o ../../ogr/ogrsf_frmts/o/ogrmemdriver.o ../../ogr/ogrsf_frmts/o/ogrmemlayer.o $(LDFLAGS) $(CONFIG_LIBS) -o $(PLUGIN_DL) $(PDFIUM_PLUGIN_LIB) $(POPPLER_PLUGIN_LIB) $(PODOFO_PLUGIN_LIB)
```
(The full `frmts/pdf/GNUmakefile` I have uploaded there: http://ix.io/1GvT)

`frmts/openjpeg/GNUmakefile` is:

```

include ../../GDALmake.opt

OBJ = openjpegdataset.o

CPPFLAGS := -I.. $(CPPFLAGS)

default: $(OBJ:.o=.$(OBJ_EXT))

clean:
rm -f $(OBJ) $(O_OBJ) *.so *.lo

install-obj: $(O_OBJ:.o=.$(OBJ_EXT))

PLUGIN_SO = gdal_JP2OpenJPEG.so

plugin: $(PLUGIN_SO)

$(PLUGIN_SO): $(OBJ)
$(LD_SHARED) $(LNK_FLAGS) $(OBJ) $(CONFIG_LIBS_INS) $(LIBS) \
-o $(PLUGIN_SO)
```

The `GDALmake.opt`, which is included by the `frmts/*/GNUmakefile`s, contains a statement
```
LD_SHARED =
```
and does not try to set `LD_SHARED` somewhere else. The complete `GDALmake.opt` I have uploaded there: `http://ix.io/1GvU`


It seems that `LD_SHARED` is not set, and so `make plugin` tries to execute the command `$(OBJ) ../../ogr/ogrsf_frmts/o/ogrmemdatasource.o ../../ogr/ogrsf_frmts/o/ogrmemdriver.o ../../ogr/ogrsf_frmts/o/ogrmemlayer.o $(LDFLAGS) $(CONFIG_LIBS) -o $(PLUGIN_DL) $(PDFIUM_PLUGIN_LIB) $(POPPLER_PLUGIN_LIB) $(PODOFO_PLUGIN_LIB)`, which obviously will fail, since the first element in `$(OBJ)` is not an executable.


Here more detailed information about how I go about:

I am working on Arch/ Artix Linux.

I use the following steps to build gdal, in this order (taken from the official Arch Linux package's `PKGBUILD` http://archlinux.org/packages/community/x86_64/gdal/):

0. For a clean environment, I set
`CFLAGS=''`
`CXXFLAGS=''`
`LDFLAGS=''`
1. downloading and extracting https://download.osgeo.org/gdal/2.3.2/gdal-2.3.2.tar.xz
2. downloading patches:
* `gdal-poppler-0.69.0.patch`: https://github.com/OSGeo/gdal/commit/69e0701253.patch
* `gdal-perl-vendor.patch`: http://ix.io/1GvP
* `gdal-poppler-0.75.patch`: http://ix.io/1GvQ
3. Applying fixes and patches, in this order, commands carried out from within the source directory of extraction:
* Fix build with poppler >= 0.69.0
`patch -Np2 -i ../gdal-poppler-0.69.0.patch`
* Fix build with poppler 0.72
`find frmts/pdf -type f | xargs sed -e 's|GBool|bool|g' -e 's|gFalse|false|g' -e 's|getCString|c_str|g' -i`
* Fix build with poppler 0.73
`sed -e 's|#include <goo/gtypes.h>|typedef unsigned char Guchar;|' -i frmts/pdf/pdfsdk_headers.h`
* Fix build with poppler 0.75
`patch -p2 -i ../gdal-poppler-0.75.patch`
* Fix mandir
`sed -i "s|^mandir=.*|mandir='\${prefix}/share/man'|" configure`
* Fix Perl bindings installation path
`patch -Np1 -i ../gdal-perl-vendor.patch`
(Up to here, I have changed nothing from the official Arch Linux package.)
4. Configuring the build:
```
./configure --prefix=/usr --with-netcdf --with-libtiff --with-sqlite3 --with-geotiff \
--with-mysql --with-curl --with-hdf5 --with-perl --with-geos \
--with-png --with-poppler --with-spatialite --with-openjpeg \
--enable-pdf-plugin \
--with-libz='/usr/include' \
--with-liblzma \
--with-pg='/usr/bin/pg_config' \
--with-zstd=yes \
--with-grass='/opt/grass' --with-libgrass='/opt/grass/include/grass' \
--with-cfitsio='/usr/include' \
--with-pcraster=internal \
--with-dds=no \
--with-gta=no \
--with-pcidsk=internal \
--with-jpeg='/usr/include' --with-charls \
--with-jpeg12 \
--with-gif='/usr/include' \
--with-ogdi=no \
--with-fme=no \
--with-sosi=no \
--with-mongocxx=no \
--with-hdf4='/opt/hdf4' \
--with-kea=yes \
--with-jasper='/usr/include/jasper' \
--with-fgdb=no \
--with-ecw=yes \
--with-kakadu=no \
--with-mrsid=no --with-jp2mrsid=no --with-mrsid_lidar=no \
--with-msg=no \
--with-bsb \
--without-oci \
--with-grib \
--with-gnm \
--with-mysql='/usr/bin/mysql_config' \
--with-ingres=no \
--with-xerces=yes \
--with-expat=yes \
--with-libkml=no \
--with-odbc='/usr/include/' \
--with-dods-root=no \
--with-xml2='/usr/bin/xml2-config' \
--with-rasterlite2=yes \
--with-pcre \
--without-teigha --with-teigha-plt \
--with-idb \
--without-sde \
--with-epsilon=no \
--with-webp='/usr/include/webp' \
--with-sfcgal=no \
--with-qhull='/usr/include' \
--with-opencl \
--with-freexl=yes \
--with-libjson-c=internal \
--with-pam \
--with-podofo=yes \
--with-pdfium=no \
--with-proj --with-proj5-api=yes \
--with-perl \
--without-php \
--with-python \
--with-java=no \
--without-mdb \
--without-rasdaman \
--with-armadillo=yes \
--with-cryptopp=yes \
--with-crypto=yes \
--with-mrf \
--without-null 2>&1 | tee configure.log
```
The output of this configure step (combined `stdout` and `stderr`) is attached as `configure.log`.
Additionally, `./configure` createad a `config.log`. It is also attached.
5. Trying to compile:
`make`
will eventually fail. Errorneous terminal output from `frmts/openjpeg` I have given above.
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Thursday, 18 April 2019, 14:11 GMT
Reason for closing:  Not a bug
Additional comments about closing:  If you modify Arch Linux packages for other distros, in order to build code which Arch Linux does not build, and hit upstream bugs, this is entirely between you and upstream.
Comment by Eli Schwartz (eschwartz) - Thursday, 18 April 2019, 14:10 GMT
- This is not the Artix Linux bugtracker, it is the Arch Linux bugtracker.
- The Arch Linux package works fine, and therefore has no FTBFS. This is because you are modifying the software in order to distribute components which Arch Linux does not distribute, and those components have *upstream* bugs.

Just because the two different Linux distributions in question both provide the gdal software, doesn't mean it makes sense to report bugs with one distro, in another distro. Did you report the same bug to Debian, Fedora, and Gentoo?

Loading...