opengisch / OSGeo4A

OSGeo4A is a build environment to cross-compile opensource GIS software for android devices
MIT License
30 stars 22 forks source link

Add poppler lib to SDK for GeoPDFs #94

Closed nirvn closed 3 years ago

nirvn commented 3 years ago

Trying to cut through bad luck.

nirvn commented 3 years ago

Na, still haunted by misfortune, seems Qt servers are going through some trouble or something, the last attempts to build SDKs all died due to errors like this:

Could not determine a remote URL for qtlocation with version 5.14.2
The command '/bin/sh -c /tmp/qt/install-qt.sh --version ${QT_VERSION} --target android --directory "${QT_PATH}" --toolchain any       qtbase       qtsensors       qtquickcontrols       qtquickcontrols2       qtmultimedia       qtlocation       qtimageformats       qtgraphicaleffects       qtdeclarative       qtandroidextras       qttools       qtsvg       qtwebview       qtconnectivity       qtcharts' returned a non-zero code: 1

Error: Process completed with exit code 1.
nirvn commented 3 years ago

@m-kuhn , BTW, the last legit build error had poppler complaining it couldn't find #include <png.h>, which is odd since that header is installed by the libpng recipe. To try and see if it'd do any good, I added libpng as a dependency to the poppler recipe (even though libpng was a dependency of the parent gdal recipe which I had assumed would be enough).

m-kuhn commented 3 years ago

That is the correct approach, gdal might as well decide that it will build libpoppler earlier than libpng

nirvn commented 3 years ago

@m-kuhn , alright, Qt download fixed, getting the same include error:

[ 46%] Building CXX object utils/CMakeFiles/pdftohtml.dir/HtmlOutputDev.cc.o
/usr/src/build/build/poppler/poppler-poppler-21.01.0/utils/HtmlOutputDev.cc:82:14: fatal error: 'png.h' file not found
#    include <png.h>
             ^~~~~~~
1 error generated.
make[2]: *** [utils/CMakeFiles/pdftohtml.dir/build.make:141: utils/CMakeFiles/pdftohtml.dir/HtmlOutputDev.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:689: utils/CMakeFiles/pdftohtml.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 46%] Linking CXX executable pdfunite
[ 46%] Built target pdfunite
make: *** [Makefile:141: all] Error 2
The command '/bin/sh -c ARCHES="${ARCHES}" /usr/src/build_arches.sh' returned a non-zero code: 255

I'm perplexed.

nirvn commented 3 years ago

@m-kuhn , the logs confirm libpng is built prior to poppler, and it seems the header file is copied where it should?

...
[100%] Built target pngimage
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/src/build/stage/armeabi-v7a/lib/libpng16.so
-- Installing: /usr/src/build/stage/armeabi-v7a/lib/libpng16.a
-- Installing: /usr/src/build/stage/armeabi-v7a/lib/libpng.so
-- Installing: /usr/src/build/stage/armeabi-v7a/lib/libpng.a
-- Installing: /usr/src/build/stage/armeabi-v7a/include/png.h
-- Installing: /usr/src/build/stage/armeabi-v7a/include/pngconf.h
-- Installing: /usr/src/build/stage/armeabi-v7a/include/libpng16/png.h
-- Installing: /usr/src/build/stage/armeabi-v7a/include/libpng16/pngconf.h
-- Installing: /usr/src/build/stage/armeabi-v7a/include/libpng16/pnglibconf.h
...
nirvn commented 3 years ago

OK, progress made, poppler builds now. However, gdal fails with this error:

/opt/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpoppler
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [GNUmakefile:75: libgdal.la] Error 1
nirvn commented 3 years ago

It might have to do with the installed library filename (i.e. libpoppler.so vs libpoppler_$ARCH.so):

Install the project...
-- Install configuration: "Release"
-- Installing: /usr/src/build/stage/armeabi-v7a/lib/libpoppler_armeabi-v7a.so
m-kuhn commented 3 years ago

That's the "new way" with aab support (alternative to apk). If possible we should adjust gdal to accept this file. The easy way would be to rename the .so after the install.

nirvn commented 3 years ago

(failure unrelated to code change, Qt remote server down)