Skip to content

Instantly share code, notes, and snippets.

@isopen
Last active October 24, 2025 02:36
Show Gist options
  • Save isopen/2be1547e3e98a053cbc3a26851a5ebcd to your computer and use it in GitHub Desktop.
Save isopen/2be1547e3e98a053cbc3a26851a5ebcd to your computer and use it in GitHub Desktop.
TDLib ARM Client in ARM32 Assembly (ARMv7)
FROM debian:bullseye
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture armhf && \
apt update && \
apt install -y --no-install-recommends \
libc6:armhf \
libstdc++6:armhf \
ca-certificates \
build-essential \
git \
cmake \
zlib1g-dev \
binutils \
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf \
wget \
perl \
libssl-dev \
gperf
RUN cd /tmp && \
wget https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz && \
tar -xzf zlib-1.2.13.tar.gz && \
cd zlib-1.2.13 && \
CC=arm-linux-gnueabihf-gcc ./configure --prefix=/opt/zlib-arm --static && \
make -j8 && \
make install
RUN cd /tmp && \
wget https://www.openssl.org/source/openssl-3.2.1.tar.gz && \
tar -xzf openssl-3.2.1.tar.gz && \
cd openssl-3.2.1 && \
./Configure linux-generic32 \
-march=armv7-a \
--prefix=/opt/openssl-arm \
--with-zlib-include=/opt/zlib-arm/include \
--with-zlib-lib=/opt/zlib-arm/lib \
no-shared \
no-dso \
no-engine \
zlib && \
make -j8 CC=arm-linux-gnueabihf-gcc && \
make install
RUN cd /tmp && \
git clone https://github.com/tdlib/td.git
RUN cd /tmp/td && \
mkdir build-x86 && \
cd build-x86 && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j8 && \
find . -name "*mime_type_to_extension*" -o -name "*auto*" | head -10
RUN cd /tmp/td/build-x86 && \
make generate_mime_types_gperf
RUN cd /tmp/td && \
find build-x86 -name "*.cpp" -path "*/auto/*" -exec cp {} tdutils/generate/auto/ \; 2>/dev/null || echo "Files not found..."
RUN cd /tmp/td && \
mkdir build-arm && \
cd build-arm && \
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=arm \
-DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \
-DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
-DOPENSSL_ROOT_DIR=/opt/openssl-arm \
-DOPENSSL_INCLUDE_DIR=/opt/openssl-arm/include \
-DOPENSSL_CRYPTO_LIBRARY=/opt/openssl-arm/lib/libcrypto.a \
-DOPENSSL_SSL_LIBRARY=/opt/openssl-arm/lib/libssl.a \
-DZLIB_ROOT=/opt/zlib-arm \
.. && \
make -j8 tdjson
RUN cp /tmp/td/build-arm/libtdjson.so /usr/lib/ && \
ldconfig
WORKDIR /app
COPY arm_tdjson_example.s .
RUN arm-linux-gnueabihf-as -o arm_tdjson_example.o arm_tdjson_example.s
RUN arm-linux-gnueabihf-gcc -o arm_tdjson_example arm_tdjson_example.o -ldl -L/tmp/td/build-arm
CMD ["./arm_tdjson_example"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment