Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors building proj 6.0.0 or later #17

Open
mludlum opened this issue Mar 23, 2022 · 1 comment
Open

Errors building proj 6.0.0 or later #17

mludlum opened this issue Mar 23, 2022 · 1 comment

Comments

@mludlum
Copy link

mludlum commented Mar 23, 2022

This repo was a huge help because we needed vertical datum calculations from the proj library in our Android app.

I am having trouble building proj after version 5.2.0. The build scripts of those versions use sqlite3 to build proj.db. I modified proj.Dockerfile with the following in bold (after successive errors with pkg-config, then sqlite3 binaries, etc.), but it still can't find sqlite3.h even though it should be placed in /usr/include based on my manual tests in a working docker image for 5.2.0. Is there a way to append the include path in the docker build?

Changes to proj.Dockerfile

RUN apt-get update && apt-get -y install
wget \
pkg-config \
sqlite3 \
libsqlite3-0 \
libsqlite3-dev

I also tried adding this line to the Dockerfile but that caused a bunch of other errors:

ENV CPATH $CPATH:/usr/include

Excerpt from build output:

#9 14.95 libtool: compile: arm-linux-androideabi-g++ -DHAVE_CONFIG_H -I. -DPROJ_LIB="/proj-build/share/proj" -DMUTEX_pthread -I../include -Wall -Wextra -Winit-self -Wunused-parameter -Wformat -Werror=format-security -Wno-format-nonliteral -Wshorten-64-to-32 -Wshadow -Werror=vla -Wdate-time -Wnull-dereference -Wextra-semi -Wcomma -Wfloat-conversion -Wdocumentation -Wno-documentation-deprecated-sync -Wunused-private-field -Wmissing-prototypes -Wmissing-declarations -Wnon-virtual-dtor -Weffc++ -Woverloaded-virtual -Wweak-vtables -Wdeprecated -Wabstract-vbase-init -Winconsistent-missing-destructor-override -fno-operator-names -Wzero-as-null-pointer-constant -DPROJ_COMPILATION -g -O2 -fvisibility=hidden -MT gridinfo.lo -MD -MP -MF .deps/gridinfo.Tpo -c gridinfo.cpp -o gridinfo.o >/dev/null 2>&1
#9 15.40 iso19111/factory.cpp:66:10: fatal error: 'sqlite3.h' file not found
#9 15.40 #include <sqlite3.h>
#9 15.40 ^~~~~~~~~~~

@ArtificialRaccoon
Copy link
Contributor

ArtificialRaccoon commented Dec 2, 2022

Here is a working dockerfile for building PROJ7.0.0:

ARG PLATFORM=android-23
ARG TOOLCHAIN=arm-linux-androideabi-4.9
ARG ARCH=x86

FROM bad-sqlite3:3.40.0-$ARCH AS sqlite3-dep
FROM rhardih/stand:r18b--$PLATFORM--$TOOLCHAIN

ARG PLATFORM
ENV PLATFORM $PLATFORM

COPY --from=sqlite3-dep /sqlite3-build /sqlite3-build

ARG HOST=arm-linux-androideabi

# List of available versions can be found at
# https://proj.org/download.html
ARG VERSION

RUN apt-get update && apt-get -y install \
  wget pkg-config sqlite3

RUN wget -O proj-$VERSION.tar.gz \
  http://download.osgeo.org/proj/proj-$VERSION.tar.gz && \
  tar -xzvf proj-$VERSION.tar.gz && \
  rm proj-$VERSION.tar.gz

WORKDIR /proj-$VERSION

ENV PATH $PATH:/$PLATFORM-toolchain/bin

ENV PKG_CONFIG_PATH /sqlite3-build/lib/pkgconfig/

RUN ./configure \
  --host=$HOST \
  --enable-tiff=no \
  --without-curl \
  --prefix=/proj-build/

RUN make -j && make install

You will need to have built SQLite3 for android. I did this using BAD and the latest SQLite (3.40.0).

This won't work for builds past PROJ8.2, as they switched entirely to cmake. I'm still trying to get PROJ9.1.1 to build...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants