Build Issue
In a Debian Docker container where tdlib 1.5 is built from source and installed in /usr/lib:
Compiling rtdlib v1.5.0
error: could not compile `rtdlib`.
Caused by:
process didn't exit successfully: `rustc --edition=2018 --crate-name rtdlib /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/rtdlib-1.5.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=81e7ec0e8ce25fd8 -C extra-filename=-81e7ec0e8ce25fd8 --out-dir /root/target/debug/deps -L dependency=/root/target/debug/deps --extern libc=/root/target/debug/deps/liblibc-04b6fbe4e251a6b7.rmeta --extern serde=/root/target/debug/deps/libserde-7ad6a30131e7b981.rmeta --extern serde_derive=/root/target/debug/deps/libserde_derive-90bf2ae47e6c3e96.so --extern serde_json=/root/target/debug/deps/libserde_json-c83e78c0f31214e2.rmeta --cap-lints allow` (signal: 9, SIGKILL: kill)
The build only fails on one host and not the other (exact build sequence including building tdlib). Both hosts use an up-to-date Linux LTS kernel. The host that fails is a VPS with 1GB of RAM.
Thanks for your issue. @traderp
Yes, I do some tests. happend the same error. The reason of this error is out of memory error.
In my test, I use 1GB RAM container to compile td, It's error. stopped in 51% and thrown an exception.
So in order to ensure that td can be compiled, I have not limited the memory.
### if want use 1G RAM to compile td, please use this line.
# docker run --rm -dit --name debian --memory 1g debian:stretch
### else run this.
docker run --rm -dit --name debian debian:stretch
docker stats debian --no-stream
docker exec -i debian bash << 'EOF'
# -----
apt update
apt install -y curl git
apt install -y g++ gperf cmake zlib1g zlib1g-dev openssl libssl-dev
cd
git clone https://github.com/tdlib/td.git
cd td
git checkout -b v1.5.0
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cp libtdjson.so* /usr/lib
cd
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
git clone https://github.com/fewensa/rtdlib
cd rtdlib
cargo build
cargo test
EOF
### not have any limit
# docker run --rm -dit --name deb1 debian:stretch
docker run --rm -dit --name deb1 --memory 1g debian:stretch
docker cp debian:/usr/lib/libtdjson.so /tmp
docker cp /tmp/libtdjson.so deb1:/usr/lib
docker exec -i deb1 bash << 'EOF'
# ---
apt update
apt install -y curl git g++
cd
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
git clone https://github.com/fewensa/rtdlib
cd rtdlib
### (signal: 9, SIGKILL: kill)
cargo build
cargo test
EOF
I think this question is a matter of choice. Now in rtdlib, in order to provide easy-to-use APIs, each struct provides many methods ( example: InputFile, ) and builder struct ( example: RTDInputFileIdBuilder ). But I know, some struct don't need these, especially builder don't need every struct. even so, I can't figure out which is needed and which is not. to many struct for td, In order to reduce compile-time memory, a better strategy is needed to reduce the number of rtdlib struct.
We may need more tests to understand the problem.
I just read td's README and learned that in order to build on a low memory machine, you have to use a helper script.
This may be a limitation of td itself, perhaps providing a docker image with pre-build td and then building on that image would help

Thanks for your help, I didn't find it before, I will test it as soon.
-------- Original Message -------- On Aug 18, 2020, 11:51, Yongsheng Xu wrote:
I just read td's README and learned that in order to build on a low memory machine, you have to use a helper script. This may be a limitation of td itself, perhaps providing a docker image with pre-build td and then building on that image would help image
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.