mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-21 03:11:54 +08:00
fix: 修复 mpp 库静态构建错误
This commit is contained in:
@@ -274,6 +274,7 @@ RUN mkdir -p /tmp/ffmpeg-build && cd /tmp/ffmpeg-build \
|
|||||||
&& make -j$(nproc) \
|
&& make -j$(nproc) \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& sed -i 's/^Libs:.*$/& -lstdc++ -lm -lpthread/' /usr/aarch64-linux-gnu/lib/pkgconfig/rockchip_mpp.pc \
|
&& sed -i 's/^Libs:.*$/& -lstdc++ -lm -lpthread/' /usr/aarch64-linux-gnu/lib/pkgconfig/rockchip_mpp.pc \
|
||||||
|
&& rm -f /usr/aarch64-linux-gnu/lib/librockchip_mpp.so* \
|
||||||
&& cd ../.. \
|
&& cd ../.. \
|
||||||
# Build RKRGA - create cross file for meson
|
# Build RKRGA - create cross file for meson
|
||||||
&& echo '[binaries]' > /tmp/aarch64-cross.txt \
|
&& echo '[binaries]' > /tmp/aarch64-cross.txt \
|
||||||
@@ -301,6 +302,7 @@ RUN mkdir -p /tmp/ffmpeg-build && cd /tmp/ffmpeg-build \
|
|||||||
&& ar rcs /usr/aarch64-linux-gnu/lib/librga.a $(find build -name '*.o') \
|
&& ar rcs /usr/aarch64-linux-gnu/lib/librga.a $(find build -name '*.o') \
|
||||||
&& ranlib /usr/aarch64-linux-gnu/lib/librga.a \
|
&& ranlib /usr/aarch64-linux-gnu/lib/librga.a \
|
||||||
&& sed -i 's/^Libs:.*$/& -lstdc++ -lm -lpthread/' /usr/aarch64-linux-gnu/lib/pkgconfig/librga.pc \
|
&& sed -i 's/^Libs:.*$/& -lstdc++ -lm -lpthread/' /usr/aarch64-linux-gnu/lib/pkgconfig/librga.pc \
|
||||||
|
&& rm -f /usr/aarch64-linux-gnu/lib/librga.so* \
|
||||||
&& cd .. \
|
&& cd .. \
|
||||||
# Create pkg-config wrapper for cross-compilation
|
# Create pkg-config wrapper for cross-compilation
|
||||||
&& echo '#!/bin/sh' > /tmp/aarch64-pkg-config \
|
&& echo '#!/bin/sh' > /tmp/aarch64-pkg-config \
|
||||||
@@ -407,4 +409,4 @@ ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
|||||||
LIBYUV_STATIC=1 \
|
LIBYUV_STATIC=1 \
|
||||||
OPUS_STATIC=1 \
|
OPUS_STATIC=1 \
|
||||||
PKG_CONFIG_ALL_STATIC=1 \
|
PKG_CONFIG_ALL_STATIC=1 \
|
||||||
RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc"
|
RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc -C link-arg=-Wl,--allow-multiple-definition"
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ RUN mkdir -p /tmp/ffmpeg-build && cd /tmp/ffmpeg-build \
|
|||||||
&& make -j$(nproc) \
|
&& make -j$(nproc) \
|
||||||
&& make install \
|
&& make install \
|
||||||
&& sed -i 's/^Libs:.*$/& -lstdc++ -lm -lpthread/' /usr/arm-linux-gnueabihf/lib/pkgconfig/rockchip_mpp.pc \
|
&& sed -i 's/^Libs:.*$/& -lstdc++ -lm -lpthread/' /usr/arm-linux-gnueabihf/lib/pkgconfig/rockchip_mpp.pc \
|
||||||
|
&& rm -f /usr/arm-linux-gnueabihf/lib/librockchip_mpp.so* \
|
||||||
&& cd ../.. \
|
&& cd ../.. \
|
||||||
# Build RKRGA - create cross file for meson
|
# Build RKRGA - create cross file for meson
|
||||||
&& echo '[binaries]' > /tmp/armhf-cross.txt \
|
&& echo '[binaries]' > /tmp/armhf-cross.txt \
|
||||||
@@ -290,6 +291,7 @@ RUN mkdir -p /tmp/ffmpeg-build && cd /tmp/ffmpeg-build \
|
|||||||
&& ar rcs /usr/arm-linux-gnueabihf/lib/librga.a $(find build -name '*.o') \
|
&& ar rcs /usr/arm-linux-gnueabihf/lib/librga.a $(find build -name '*.o') \
|
||||||
&& ranlib /usr/arm-linux-gnueabihf/lib/librga.a \
|
&& ranlib /usr/arm-linux-gnueabihf/lib/librga.a \
|
||||||
&& sed -i 's/^Libs:.*$/& -lstdc++ -lm -lpthread/' /usr/arm-linux-gnueabihf/lib/pkgconfig/librga.pc \
|
&& sed -i 's/^Libs:.*$/& -lstdc++ -lm -lpthread/' /usr/arm-linux-gnueabihf/lib/pkgconfig/librga.pc \
|
||||||
|
&& rm -f /usr/arm-linux-gnueabihf/lib/librga.so* \
|
||||||
&& cd .. \
|
&& cd .. \
|
||||||
# Create pkg-config wrapper for cross-compilation
|
# Create pkg-config wrapper for cross-compilation
|
||||||
&& echo '#!/bin/sh' > /tmp/armhf-pkg-config \
|
&& echo '#!/bin/sh' > /tmp/armhf-pkg-config \
|
||||||
@@ -396,7 +398,7 @@ ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
|
|||||||
LIBYUV_STATIC=1 \
|
LIBYUV_STATIC=1 \
|
||||||
OPUS_STATIC=1 \
|
OPUS_STATIC=1 \
|
||||||
PKG_CONFIG_ALL_STATIC=1 \
|
PKG_CONFIG_ALL_STATIC=1 \
|
||||||
RUSTFLAGS="-C linker=arm-linux-gnueabihf-gcc"
|
RUSTFLAGS="-C linker=arm-linux-gnueabihf-gcc -C link-arg=-Wl,--allow-multiple-definition"
|
||||||
|
|
||||||
# Default command
|
# Default command
|
||||||
CMD ["bash"]
|
CMD ["bash"]
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ mod ffmpeg {
|
|||||||
println!("cargo:rustc-link-lib=static=avcodec");
|
println!("cargo:rustc-link-lib=static=avcodec");
|
||||||
println!("cargo:rustc-link-lib=static=avutil");
|
println!("cargo:rustc-link-lib=static=avutil");
|
||||||
|
|
||||||
// Link hardware acceleration dependencies (dynamic)
|
// Link hardware acceleration dependencies
|
||||||
// These vary by architecture
|
// These vary by architecture
|
||||||
if target_arch == "x86_64" {
|
if target_arch == "x86_64" {
|
||||||
// VAAPI for x86_64
|
// VAAPI for x86_64
|
||||||
@@ -347,13 +347,11 @@ mod ffmpeg {
|
|||||||
println!("cargo:rustc-link-lib=va-x11"); // Required for vaGetDisplay
|
println!("cargo:rustc-link-lib=va-x11"); // Required for vaGetDisplay
|
||||||
println!("cargo:rustc-link-lib=mfx");
|
println!("cargo:rustc-link-lib=mfx");
|
||||||
} else {
|
} else {
|
||||||
// RKMPP for ARM
|
for lib in ["rockchip_mpp", "rga"] {
|
||||||
println!("cargo:rustc-link-lib=rockchip_mpp");
|
if !lib_dir.join(format!("lib{lib}.a")).exists() {
|
||||||
let rga_static = lib_dir.join("librga.a");
|
panic!("missing static library: lib{lib}.a");
|
||||||
if rga_static.exists() {
|
}
|
||||||
println!("cargo:rustc-link-lib=static=rga");
|
println!("cargo:rustc-link-lib=static={}", lib);
|
||||||
} else {
|
|
||||||
println!("cargo:rustc-link-lib=rga");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,12 +410,6 @@ mod ffmpeg {
|
|||||||
// For static linking, link FFmpeg libs statically, others dynamically
|
// For static linking, link FFmpeg libs statically, others dynamically
|
||||||
if lib_name.starts_with("av") || lib_name == "swresample" {
|
if lib_name.starts_with("av") || lib_name == "swresample" {
|
||||||
println!("cargo:rustc-link-lib=static={}", lib_name);
|
println!("cargo:rustc-link-lib=static={}", lib_name);
|
||||||
} else if lib_name == "rga"
|
|
||||||
&& link_paths
|
|
||||||
.iter()
|
|
||||||
.any(|path| Path::new(path).join("librga.a").exists())
|
|
||||||
{
|
|
||||||
println!("cargo:rustc-link-lib=static=rga");
|
|
||||||
} else {
|
} else {
|
||||||
// Runtime libraries (va, drm, etc.) must be dynamic
|
// Runtime libraries (va, drm, etc.) must be dynamic
|
||||||
println!("cargo:rustc-link-lib={}", lib_name);
|
println!("cargo:rustc-link-lib={}", lib_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user