Skip to content

Commit

Permalink
pkg-config? nope
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Jul 23, 2024
1 parent bda0203 commit 7efa8fd
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu-22.04-risc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
docker-context: "./ubuntu-22.04-risc"
dockerfile: "./ubuntu-22.04-risc/Dockerfile"
dockerhub_imagename: "chianetwork/ubuntu-22.04-risc-builder"
docker-platforms: linux/riscv64
# docker-platforms: linux/riscv64
image_subpath: "ubuntu-22.04-risc-builder"
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
86 changes: 54 additions & 32 deletions ubuntu-22.04-risc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,81 @@ RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y tree build-essential cmake curl wget git make pkg-config libgmp-dev libboost-dev libssl-dev zlib1g zlib1g-dev libreadline-dev libffi-dev && \
rm -rf /var/lib/apt/lists/*

#FROM base as ld
#
#RUN curl -L -O https://ftpmirror.gnu.org/gnu/binutils/binutils-2.38.tar.gz && \
# tar -xvzf binutils-2.38.tar.gz && \
# cd binutils-2.38 && \
# ./configure --enable-ld --disable-gas --disable-gmp --disable-gold --disable-gprof --prefix=/ld/usr && \
# make && \
# make install && \
# ls -la /ld/usr/bin && \
# ld --version
FROM base as ld

RUN curl -L -O https://ftpmirror.gnu.org/gnu/binutils/binutils-2.38.tar.gz && \
tar -xvzf binutils-2.38.tar.gz && \
cd binutils-2.38 && \
./configure --enable-ld --disable-gas --disable-gmp --disable-gold --disable-gprof --prefix=/opt/ld && \
make && \
make install && \
tree /opt && \
/opt/ld/bin/ld --version

FROM base as sqlite

RUN wget -q https://sqlite.org/2022/sqlite-autoconf-3400100.tar.gz && \
tar -xzf sqlite-autoconf-3400100.tar.gz && \
RUN curl -L -O https://sqlite.org/2022/sqlite-autoconf-3400100.tar.gz && \
tar -xvzf sqlite-autoconf-3400100.tar.gz && \
cd sqlite-autoconf-3400100 && \
CFLAGS="-DSQLITE_MAX_VARIABLE_NUMBER=500000" ./configure --prefix=/opt/sqlite3 && \
make && \
make install && \
tree /opt/sqlite3 && \
ls -la /opt/sqlite3/bin && \
tree /opt && \
/opt/sqlite3/bin/sqlite3 -version

FROM base as final

#COPY --from=ld /ld/usr /usr
COPY --from=ld /opt/ld /usr

COPY --from=sqlite /opt/sqlite3 /opt/sqlite3

RUN ls -la /usr/bin && \
RUN tree /opt && \
ld --version && \
tree /opt/sqlite3 && \
/opt/sqlite3/bin/sqlite3 -version

ENV PYENV_ROOT=/root/.pyenv
ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"

RUN tree /opt && \
curl https://pyenv.run | bash && \
export PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS} --enable-shared" && \
export LDFLAGS="$(PKG_CONFIG_PATH=/opt/sqlite3/lib/pkgconfig pkg-config --libs --define-variable=prefix=/opt/sqlite3 sqlite3)" && \
export CPPFLAGS="$(PKG_CONFIG_PATH=/opt/sqlite3/lib/pkgconfig pkg-config --cflags --define-variable=prefix=/opt/sqlite3 sqlite3)" && \
echo LDFLAGS="${LDFLAGS}" && \
echo CPPFLAGS="${CPPFLAGS}" && \
pyenv install --skip-existing 3.8 && \
pyenv install --skip-existing 3.9 && \
pyenv install --skip-existing 3.10 && \
pyenv install --skip-existing 3.11 && \
pyenv install --skip-existing 3.12 && \
pyenv global 3.12
RUN curl https://pyenv.run | bash

ARG PYTHON_CONFIGURE_OPTS="--enable-shared"

# for 3.8 - 3.10
ARG LDFLAGS="-L/opt/sqlite3/lib -lsqlite3"
ARG CPPFLAGS=-I/opt/sqlite3/include

RUN pyenv install 3.8
#RUN pyenv install 3.9
#RUN pyenv install 3.10

# for 3.11+
#ARG LIBSQLITE3_LIBS=-L/opt/sqlite3/lib -lsqlite3
#ARG LIBSQLITE3_CFLAGS=-I/opt/sqlite3/include
#ARG PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS} LIBSQLITE3_LIBS='-L/opt/sqlite3/lib -lsqlite3'"
#ARG PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS} LIBSQLITE3_CFLAGS=-I/opt/sqlite3/include"

ARG PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS} PKG_CONFIG_PATH=/opt/sqlite3/lib/pkgconfig"

RUN tree /opt
ARG PKG_CONFIG_PATH=/opt/sqlite3/lib/pkgconfig
RUN pkg-config sqlite3 --cflags
RUN pkg-config sqlite3 --libs

RUN pyenv install 3.11
#RUN pyenv install 3.12

RUN pyenv global 3.11 3.8

ENV LD_LIBRARY_PATH="/opt/sqlite3/lib"

RUN ldd $(python3.8 -c 'import _sqlite3; print(_sqlite3.__file__)')
#RUN ldd $(python3.9 -c 'import _sqlite3; print(_sqlite3.__file__)')
#RUN ldd $(python3.10 -c 'import _sqlite3; print(_sqlite3.__file__)')
RUN ldd $(python3.11 -c 'import _sqlite3; print(_sqlite3.__file__)')
#RUN ldd $(python3.12 -c 'import _sqlite3; print(_sqlite3.__file__)')

ENV PATH="/root/.cargo/bin:${PATH}"
ENV RUST_BACKTRACE=1

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
cargo install sccache
#RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
# cargo install sccache

0 comments on commit 7efa8fd

Please sign in to comment.