mirror of
https://github.com/chirpstack/chirpstack.git
synced 2024-12-18 20:57:55 +00:00
Implement fully static AMD64 build.
This commit is contained in:
parent
9e15c48217
commit
de114d5d22
@ -3,3 +3,6 @@ linker = "arm-linux-gnueabihf-gcc"
|
||||
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
linker = "aarch64-linux-gnu-gcc"
|
||||
|
||||
[target.x86_64-unknown-linux-musl]
|
||||
rustflags = ["-C", "target-feature=+crt-static", "-C", "link-arg=-s", "-C", "link-arg=-lc", "-C", "link-arg=-lgcc"]
|
@ -1,6 +1,9 @@
|
||||
.git
|
||||
.cargo
|
||||
.rust
|
||||
**/target
|
||||
api/rust/target
|
||||
backend/target
|
||||
lrwn/target
|
||||
lrwn/filters/target
|
||||
**/node_modules
|
||||
Dockerfile
|
||||
|
13
Cargo.lock
generated
13
Cargo.lock
generated
@ -968,7 +968,6 @@ dependencies = [
|
||||
"pbkdf2",
|
||||
"petgraph",
|
||||
"pin-project",
|
||||
"pq-sys",
|
||||
"prometheus-client",
|
||||
"prost",
|
||||
"prost-types",
|
||||
@ -2748,15 +2747,6 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-src"
|
||||
version = "111.25.3+1.1.1t"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "924757a6a226bf60da5f7dd0311a34d2b52283dd82ddeb103208ddc66362f80c"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.87"
|
||||
@ -2765,7 +2755,6 @@ checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"openssl-src",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
@ -3144,7 +3133,6 @@ version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd"
|
||||
dependencies = [
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
@ -3369,7 +3357,6 @@ checksum = "87ac9d87c3aba1748e3112318459f2ac8bff80bfff7359e338e0463549590249"
|
||||
dependencies = [
|
||||
"cmake",
|
||||
"libc",
|
||||
"libz-sys",
|
||||
"num_enum",
|
||||
"pkg-config",
|
||||
]
|
||||
|
2
Cross.toml
Normal file
2
Cross.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[target.x86_64-unknown-linux-musl]
|
||||
dockerfile="cross/Dockerfile.x86_64-unknown-linux-musl"
|
@ -36,7 +36,6 @@ diesel_migrations = { version = "2.0" }
|
||||
r2d2 = "0.8"
|
||||
bigdecimal = "0.3"
|
||||
redis = { version = "0.23", features = ["r2d2", "cluster", "tls-rustls"] }
|
||||
pq-sys = { version = "0.4", features = ["pkg-config"] }
|
||||
|
||||
# Logging
|
||||
tracing = "0.1"
|
||||
@ -69,7 +68,7 @@ gcp_auth = "0.8"
|
||||
lapin = "2.1"
|
||||
tokio-executor-trait = "2.1"
|
||||
tokio-reactor-trait = "1.1"
|
||||
rdkafka = { version = "0.29", features = ["cmake-build"] }
|
||||
rdkafka = { version = "0.29", default-features = false, features = ["tokio", "cmake-build"] }
|
||||
|
||||
# gRPC and Protobuf
|
||||
tonic = "0.9"
|
||||
@ -100,11 +99,11 @@ anyhow = "1.0"
|
||||
pbkdf2 = { version = "0.12", features = ["simple"] }
|
||||
rand_core = { version = "0.6", features = ["std"] }
|
||||
jsonwebtoken = "8.2"
|
||||
openssl = { version = "0.10", features = ["vendored"] }
|
||||
openssl = { version = "0.10" }
|
||||
openidconnect = { version = "3.0", features = ["accept-rfc3339-timestamps"] }
|
||||
|
||||
# MQTT
|
||||
paho-mqtt = { version = "0.12", features = ["vendored-ssl"] }
|
||||
paho-mqtt = { version = "0.12", features = ["ssl"] }
|
||||
hex = "0.4"
|
||||
|
||||
# Codecs
|
||||
|
@ -3,6 +3,8 @@
|
||||
// TODO: remove this + all dead code.
|
||||
#![allow(dead_code)]
|
||||
|
||||
extern crate openssl;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate diesel_migrations;
|
||||
|
43
cross/Dockerfile.x86_64-unknown-linux-musl
Normal file
43
cross/Dockerfile.x86_64-unknown-linux-musl
Normal file
@ -0,0 +1,43 @@
|
||||
FROM ghcr.io/cross-rs/x86_64-unknown-linux-musl:latest
|
||||
|
||||
ENV ZLIB_VERSION=1.2.13
|
||||
ENV POSTGRESQL_VERSION=11.20
|
||||
ENV OPENSSL_VERSION=1.1.1t
|
||||
ENV MUSL_PREFIX=x86_64-linux-musl
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get --assume-yes install \
|
||||
protobuf-compiler
|
||||
|
||||
RUN echo "Building OpenSSL" && \
|
||||
cd /tmp && \
|
||||
curl -fLO "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" && \
|
||||
tar xvzf "openssl-$OPENSSL_VERSION.tar.gz" && cd "openssl-$OPENSSL_VERSION" && \
|
||||
env CC=$MUSL_PREFIX-gcc ./Configure no-shared no-zlib -fPIC --prefix=/usr/local/$MUSL_PREFIX-target -DOPENSSL_NO_SECURE_MEMORY linux-x86_64 && \
|
||||
env C_INCLUDE_PATH=/usr/local/$MUSL_PREFIX/include/ make depend && \
|
||||
env C_INCLUDE_PATH=/usr/local/$MUSL_PREFIX/include/ make && \
|
||||
make install_sw && \
|
||||
rm -r /tmp/*
|
||||
|
||||
RUN echo "Building zlib" && \
|
||||
cd /tmp && \
|
||||
curl -fLO "https://zlib.net/zlib-$ZLIB_VERSION.tar.gz" && \
|
||||
tar xzf "zlib-$ZLIB_VERSION.tar.gz" && cd "zlib-$ZLIB_VERSION" && \
|
||||
CC=$MUSL_PREFIX-gcc ./configure --static --prefix=/usr/local/$MUSL_PREFIX-target && \
|
||||
make && make install && \
|
||||
rm -r /tmp/*
|
||||
|
||||
|
||||
RUN echo "Building libpq" && \
|
||||
cd /tmp && \
|
||||
curl -fLO "https://ftp.postgresql.org/pub/source/v$POSTGRESQL_VERSION/postgresql-$POSTGRESQL_VERSION.tar.gz" && \
|
||||
tar xzf "postgresql-$POSTGRESQL_VERSION.tar.gz" && cd "postgresql-$POSTGRESQL_VERSION" && \
|
||||
CC=$MUSL_PREFIX-gcc CPPFLAGS="-I/usr/local/$MUSL_PREFIX/include -I/usr/local/$MUSL_PREFIX-target/include" LDFLAGS="-L/usr/local/$MUSL_PREFIX/lib -L/usr/local/$MUSL_PREFIX-target/lib" ./configure --with-openssl --without-readline --prefix=/usr/local/$MUSL_PREFIX-target && \
|
||||
cd src/interfaces/libpq && make all-static-lib && make install-lib-static && \
|
||||
rm -r /tmp/*
|
||||
|
||||
# Workaround for re-defined unicode_to_utf8 which also exists in quickjs library.
|
||||
RUN objcopy --redefine-sym unicode_to_utf8=unicode_to_utf8_rename /usr/local/$MUSL_PREFIX-target/lib/libpq.a
|
||||
|
||||
|
||||
ENV PKG_CONFIG_PATH=/usr/local/$MUSL_PREFIX-target/lib/pkgconfig
|
@ -23,18 +23,6 @@ services:
|
||||
ports:
|
||||
- "8080:8080"
|
||||
|
||||
chirpstack-build-amd64:
|
||||
image: chirpstack/chirpstack-dev-cache:latest
|
||||
platform: linux/amd64
|
||||
volumes:
|
||||
- ./:/chirpstack
|
||||
|
||||
chirpstack-build-arm64:
|
||||
image: chirpstack/chirpstack-dev-cache:latest
|
||||
platform: linux/arm64
|
||||
volumes:
|
||||
- ./:/chirpstack
|
||||
|
||||
chirpstack-ui:
|
||||
build:
|
||||
context: ./ui
|
||||
|
@ -1,8 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "1.68.2"
|
||||
channel = "1.69.0"
|
||||
components = ["rustfmt", "clippy"]
|
||||
targets = [
|
||||
"armv7-unknown-linux-gnueabihf",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
]
|
||||
profile = "default"
|
Loading…
Reference in New Issue
Block a user