dockerfile 和容器中运行的是相同命令 以下RUN命令都是在基础镜像创建的容器中成功运行的 但是在dockerfile一次性构建镜像的时候 这四个程序编译到70%左右都会报错 如
#9 53.53 /tmp/ccAdahkN.s: Assembler messages: #9 53.53 /tmp/ccAdahkN.s:2150: Error: unknown mnemonic `emms' -- `emms' #9 53.53 /tmp/ccAdahkN.s:2248: Error: unknown mnemonic `emms' -- `emms' #9 53.54 make: *** [ffbuild/common.mak:81: libavfilter/vf_deshake.o] Error 1
现在只能是下面第一段可以执行生成镜像 需要新建容器后编译安装 虽然可以在容器中完成安装再次生成镜像 但我希望可以一次性生成镜像文件
# 基础镜像 FROM alpine:3.18 WORKDIR /root EXPOSE 22 COPY ./main /root/main # 备份原始安装源 RUN cp /etc/apk/repositories /etc/apk/repositories.bak # 修改为国内源 RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories # 安装基础软件 RUN apk add zsh vim nano less git wget curl ca-certificates ttf-dejavu fontconfig iproute2 dialog make cmake alpine-sdk gcc nasm yasm aom-dev libvpx-dev libwebp-dev x264-dev x265-dev dav1d-dev xvidcore-dev fdk-aac-dev xz wget # 准备软件 RUN git clone https://github.com/fraunhoferhhi/vvdec /root/vvdec RUN git clone https://github.com/fraunhoferhhi/vvenc /root/vvenc RUN git clone https://git.ffmpeg.org/ffmpeg.git /root/ffmpeg RUN git clone https://github.com/ultravideo/kvazaar.git /root/kvazaar
到这里构建一切正常
接下来编译安装就会出问题
WORKDIR /root/vvdec RUN cmake -S . -B build/release-shared -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DVVDEC_INSTALL_VVDECAPP=true -DBUILD_SHARED_LIBS=1 \ && cmake --build build/release-shared -j \ && cmake --build build/release-shared --target install WORKDIR /root/vvenc RUN cmake -S . -B build/release-shared -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 \ && cmake --build build/release-shared -j \ && cmake --build build/release-shared --target install WORKDIR /root/kvazaar RUN ./configure --prefix=/usr/local \ && make \ && make install WORKDIR /root/ffmpeg RUN git checkout 2532e832d2 \ && wget -O Add-support-for-H266-VVC.patch https://patchwork.ffmpeg.org/series/9992/mbox/ \ && git apply --check Add-support-for-H266-VVC.patch \ && git apply Add-support-for-H266-VVC.patch \ && ./configure --prefix=/usr/local \ --enable-pthreads \ --enable-pic \ --arch=arm64 \ --enable-libvvdec \ --enable-libvvenc \ --enable-shared \ --enable-libaom \ --enable-gpl \ --enable-nonfree \ --enable-postproc \ --enable-avfilter \ --enable-pthreads \ --enable-libx264 \ --enable-libx265 \ --enable-libwebp \ --enable-libvpx \ --enable-libfdk-aac \ --enable-libkvazaar \ --enable-libdav1d \ --enable-libxvid \ --enable-version3 \ --enable-ffplay \ && make \ && make install
#17 89.03 In file included from /root/vvdec/source/Lib/vvdec/vvdec.cpp:43: #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h: In instantiation of 'auto vvdec::VVDecImpl::catchExceptions(MembFunc, Args ...) [with MembFunc = int (vvdec::VVDecImpl::*)(const vvdecParams&, void* (*)(void*, vvdecComponentType, unsigned int, unsigned int, void**), void (*)(void*, void*)); Args = {vvdecParams, std::nullptr_t, std::nullptr_t}]': #17 89.03 /root/vvdec/source/Lib/vvdec/vvdec.cpp:217:36: required from here #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h:228:14: error: cast from 'std::nullptr_t' to 'TRet' {aka 'int'} loses precision [-fpermissive] #17 89.03 228 | return (TRet) NULL; #17 89.03 | ^ #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h: In instantiation of 'auto vvdec::VVDecImpl::catchExceptions(MembFunc, Args ...) [with MembFunc = int (vvdec::VVDecImpl::*)(const vvdecParams&, void* (*)(void*, vvdecComponentType, unsigned int, unsigned int, void**), void (*)(void*, void*)); Args = {vvdecParams, void* (*)(void*, vvdecComponentType, unsigned int, unsigned int, void**), void (*)(void*, void*)}]': #17 89.03 /root/vvdec/source/Lib/vvdec/vvdec.cpp:259:36: required from here #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h:228:14: error: cast from 'std::nullptr_t' to 'TRet' {aka 'int'} loses precision [-fpermissive] #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h: In instantiation of 'auto vvdec::VVDecImpl::catchExceptions(MembFunc, Args ...) [with MembFunc = int (vvdec::VVDecImpl::*)(); Args = {}]': #17 89.03 /root/vvdec/source/Lib/vvdec/vvdec.cpp:283:37: required from here #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h:228:14: error: cast from 'std::nullptr_t' to 'TRet' {aka 'int'} loses precision [-fpermissive] #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h: In instantiation of 'auto vvdec::VVDecImpl::catchExceptions(MembFunc, Args ...) [with MembFunc = int (vvdec::VVDecImpl::*)(vvdecAccessUnit&, vvdecFrame**); Args = {vvdecAccessUnit, vvdecFrame**}]': #17 89.03 /root/vvdec/source/Lib/vvdec/vvdec.cpp:318:28: required from here #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h:228:14: error: cast from 'std::nullptr_t' to 'TRet' {aka 'int'} loses precision [-fpermissive] #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h: In instantiation of 'auto vvdec::VVDecImpl::catchExceptions(MembFunc, Args ...) [with MembFunc = int (vvdec::VVDecImpl::*)(vvdecFrame**); Args = {vvdecFrame**}]': #17 89.03 /root/vvdec/source/Lib/vvdec/vvdec.cpp:332:28: required from here #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h:228:14: error: cast from 'std::nullptr_t' to 'TRet' {aka 'int'} loses precision [-fpermissive] #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h: In instantiation of 'auto vvdec::VVDecImpl::catchExceptions(MembFunc, Args ...) [with MembFunc = int (vvdec::VVDecImpl::*)(vvdecFrame*); Args = {vvdecFrame*}]': #17 89.03 /root/vvdec/source/Lib/vvdec/vvdec.cpp:354:28: required from here #17 89.03 /root/vvdec/source/Lib/vvdec/vvdecimpl.h:228:14: error: cast from 'std::nullptr_t' to 'TRet' {aka 'int'} loses precision [-fpermissive] #17 89.26 make[2]: *** [source/Lib/vvdec/CMakeFiles/vvdec.dir/build.make:720: source/Lib/vvdec/CMakeFiles/vvdec.dir/vvdec.cpp.o] Error 1 #17 89.26 make[1]: *** [CMakeFiles/Makefile2:227: source/Lib/vvdec/CMakeFiles/vvdec.dir/all] Error 2 #17 89.26 make: *** [Makefile:146: all] Error 2 ------ executor failed running [/bin/sh -c cmake -S . -B build/release-shared -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DVVDEC_INSTALL_VVDECAPP=true -DBUILD_SHARED_LIBS=1 && cmake --build build/release-shared && cmake --build build/release-shared --target install]: exit code: 2
由于在将 std::nullptr_t转换为 TRet时精度丢失导致的。为了解决这个问题,可以尝试将 std::nullptr_t替换为 void*类型,或者使用其他适当的类型。
std::nullptr_t
TRet
void*
但是在容器内编译能通过 显然不是这个问题
不知道对你的问题有没有帮助,AI的回答。
在容器中确保能编译通过,再把相关命令写到dockerfile 调试,容器中能过,dockefile有问题可能就是环境变量的原因
Popular Events
问题描述
dockerfile 和容器中运行的是相同命令 以下RUN命令都是在基础镜像创建的容器中成功运行的 但是在dockerfile一次性构建镜像的时候 这四个程序编译到70%左右都会报错
如
预期
现在只能是下面第一段可以执行生成镜像 需要新建容器后编译安装 虽然可以在容器中完成安装再次生成镜像 但我希望可以一次性生成镜像文件
这是我的dockerfile
到这里构建一切正常
接下来编译安装就会出问题
vvdec/vvenc报错
由于在将
std::nullptr_t
转换为TRet
时精度丢失导致的。为了解决这个问题,可以尝试将std::nullptr_t
替换为void*
类型,或者使用其他适当的类型。但是在容器内编译能通过 显然不是这个问题