untrunc
untrunc copied to clipboard
Docker build fails
Tried this on both an Intel and M1 Mac, running latest Docker Desktop (3.5.2).
Tried docker build, docker buildx build, and docker buildx build --platform linux/amd64.
Tried the suggestions in https://github.com/ponchio/untrunc/issues/211.
This is the output no matter what platform/command/dockerfile variation is used:
[+] Building 141.2s (14/16)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.49kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:bionic 2.7s
=> [internal] load build context 3.1s
=> => transferring context: 67.40MB 3.0s
=> [build 1/10] FROM docker.io/library/ubuntu:bionic@sha256:9619fbe1e770e478fbe24f80e6cb9fb70623e7c869c8f276a03de6c0f4af7972 3.8s
=> => resolve docker.io/library/ubuntu:bionic@sha256:9619fbe1e770e478fbe24f80e6cb9fb70623e7c869c8f276a03de6c0f4af7972 0.0s
=> => sha256:9619fbe1e770e478fbe24f80e6cb9fb70623e7c869c8f276a03de6c0f4af7972 1.41kB / 1.41kB 0.0s
=> => sha256:d12f1bfe5338cf7812b3e2241b7a2f6d2bcd9df9a054a16707e75355c5be3fda 529B / 529B 0.0s
=> => sha256:3c9033440523d58b7f09ef05522b56486bbcd930191dd2abb4d2aa338175fdbe 1.48kB / 1.48kB 0.0s
=> => sha256:b9bb7af7248f30dd1b1f9807608f5f532133384e4db55caa6dbc69b9cf15ddcc 23.73MB / 23.73MB 2.7s
=> => extracting sha256:b9bb7af7248f30dd1b1f9807608f5f532133384e4db55caa6dbc69b9cf15ddcc 0.9s
=> [build 2/10] RUN apt-get update && apt-get -y install libavformat-dev libavcodec-dev libavutil-dev unzip g++ wget make nasm zlib 31.9s
=> [build 3/10] WORKDIR /untrunc 0.0s
=> [build 4/10] RUN wget https://github.com/libav/libav/archive/v12.3.zip && unzip v12.3.zip && rm v12.3.zip 3.8s
=> [build 5/10] WORKDIR /untrunc/libav-12.3/ 0.0s
=> [build 6/10] RUN ./configure 4.8s
=> [build 7/10] RUN make -j8 83.8s
=> [build 8/10] WORKDIR /untrunc 0.0s
=> [build 9/10] ADD . . 4.3s
=> ERROR [build 10/10] RUN /usr/bin/g++ -o untrunc main.cpp atom.cpp mp4.cpp file.cpp track.cpp log.cpp codec.cpp codec_rtp.cpp codec_av 5.8s
------
> [build 10/10] RUN /usr/bin/g++ -o untrunc main.cpp atom.cpp mp4.cpp file.cpp track.cpp log.cpp codec.cpp codec_rtp.cpp codec_avc1.cpp codec_hev1.cpp codec_mp4a.cpp codec_mp4v.cpp codec_pcm.cpp codec_mbex.cpp codec_alac.cpp codecstats.cpp codec_unknown.cpp codec_text.cpp codec_tmcd.cpp codec_gpmd.cpp codec_fdsc.cpp codec_apch.cpp codec_mijd.cpp -I./libav-12.3 -L./libav-12.3/libavformat -lavformat -L./libav-12.3/libavcodec -lavcodec -L./libav-12.3/libavresample -lavresample -L./libav-12.3/libavutil -lavutil -lpthread -lz:
#14 1.413 mp4.cpp: In member function 'bool Mp4::parseTracks()':
#14 1.413 mp4.cpp:812:46: warning: 'AVStream::codec' is deprecated [-Wdeprecated-declarations]
#14 1.413 track.codec.context = context->streams[i]->codec;
#14 1.413 ^~~~~
#14 1.413 In file included from mp4.cpp:47:0:
#14 1.413 ./libav-12.3/libavformat/avformat.h:712:21: note: declared here
#14 1.413 AVCodecContext *codec;
#14 1.413 ^~~~~
#14 1.413 mp4.cpp:812:46: warning: 'AVStream::codec' is deprecated [-Wdeprecated-declarations]
#14 1.413 track.codec.context = context->streams[i]->codec;
#14 1.413 ^~~~~
#14 1.413 In file included from mp4.cpp:47:0:
#14 1.413 ./libav-12.3/libavformat/avformat.h:712:21: note: declared here
#14 1.413 AVCodecContext *codec;
#14 1.413 ^~~~~
#14 1.413 mp4.cpp:812:46: warning: 'AVStream::codec' is deprecated [-Wdeprecated-declarations]
#14 1.413 track.codec.context = context->streams[i]->codec;
#14 1.413 ^~~~~
#14 1.413 In file included from mp4.cpp:47:0:
#14 1.413 ./libav-12.3/libavformat/avformat.h:712:21: note: declared here
#14 1.413 AVCodecContext *codec;
#14 1.413 ^~~~~
#14 3.475 codec_mp4a.cpp: In member function 'Match Codec::mp4aMatch(const unsigned char*, int)':
#14 3.475 codec_mp4a.cpp:41:68: warning: 'int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, AVPacket*)' is deprecated [-Wdeprecated-declarations]
#14 3.475 consumed = avcodec_decode_audio4(context, frame, &got_frame, &avp);
#14 3.475 ^
#14 3.475 In file included from avlog.h:26:0,
#14 3.475 from codec_mp4a.cpp:3:
#14 3.475 ./libav-12.3/libavcodec/avcodec.h:4151:5: note: declared here
#14 3.475 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
#14 3.475 ^~~~~~~~~~~~~~~~~~~~~
#14 3.475 codec_mp4a.cpp:52:75: warning: 'int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, AVPacket*)' is deprecated [-Wdeprecated-declarations]
#14 3.475 int consumed2 = avcodec_decode_audio4(context, frame, &got_frame, &avp);
#14 3.475 ^
#14 3.475 In file included from avlog.h:26:0,
#14 3.475 from codec_mp4a.cpp:3:
#14 3.475 ./libav-12.3/libavcodec/avcodec.h:4151:5: note: declared here
#14 3.475 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
#14 3.475 ^~~~~~~~~~~~~~~~~~~~~
#14 3.668 codec_mp4v.cpp: In member function 'Match Codec::mp4vMatch(const unsigned char*, int)':
#14 3.668 codec_mp4v.cpp:47:70: warning: 'int avcodec_decode_video2(AVCodecContext*, AVFrame*, int*, AVPacket*)' is deprecated [-Wdeprecated-declarations]
#14 3.668 consumed = avcodec_decode_video2(context, frame, &got_frame, packet);
#14 3.668 ^
#14 3.668 In file included from avlog.h:26:0,
#14 3.668 from codec_mp4v.cpp:3:
#14 3.668 ./libav-12.3/libavcodec/avcodec.h:4200:5: note: declared here
#14 3.668 int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
#14 3.668 ^~~~~~~~~~~~~~~~~~~~~
#14 4.177 codec_alac.cpp: In member function 'Match Codec::alacMatch(const unsigned char*, int)':
#14 4.177 codec_alac.cpp:75:56: warning: 'int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, AVPacket*)' is deprecated [-Wdeprecated-declarations]
#14 4.177 avcodec_decode_audio4(context, frame, &got_frame, &avp);
#14 4.177 ^
#14 4.177 In file included from avlog.h:26:0,
#14 4.177 from codec_alac.cpp:4:
#14 4.177 ./libav-12.3/libavcodec/avcodec.h:4151:5: note: declared here
#14 4.177 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
#14 4.177 ^~~~~~~~~~~~~~~~~~~~~
#14 5.804 /tmp/ccpl3Inl.o: In function `(anonymous namespace)::AvLog::AvLog(int, int)':
#14 5.804 mp4.cpp:(.text+0x90): undefined reference to `av_log_get_level'
#14 5.804 mp4.cpp:(.text+0xb8): undefined reference to `av_log_set_level'
#14 5.804 mp4.cpp:(.text+0xc0): undefined reference to `av_log_set_flags'
#14 5.804 /tmp/ccpl3Inl.o: In function `(anonymous namespace)::AvLog::~AvLog()':
#14 5.804 mp4.cpp:(.text+0x11c): undefined reference to `av_log_set_level'
#14 5.804 /tmp/ccpl3Inl.o: In function `Mp4::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
#14 5.804 mp4.cpp:(.text+0x600): undefined reference to `av_register_all'
#14 5.804 mp4.cpp:(.text+0x624): undefined reference to `avformat_open_input'
#14 5.804 mp4.cpp:(.text+0x684): undefined reference to `avformat_find_stream_info'
#14 5.804 /tmp/ccpl3Inl.o: In function `Mp4::close()':
#14 5.804 mp4.cpp:(.text+0xa28): undefined reference to `avformat_close_input'
#14 5.804 /tmp/ccpl3Inl.o: In function `Mp4::printMediaInfo()':
#14 5.804 mp4.cpp:(.text+0xb38): undefined reference to `av_find_default_stream_index'
#14 5.804 mp4.cpp:(.text+0xbbc): undefined reference to `av_dump_format'
#14 5.804 /tmp/ccRNfyQz.o: In function `Track::parse(Atom*)':
#14 5.804 track.cpp:(.text+0xa44): undefined reference to `avcodec_find_decoder'
#14 5.805 track.cpp:(.text+0xacc): undefined reference to `avcodec_open2'
#14 5.805 /tmp/ccjoTYcQ.o: In function `Codec::mp4aMatch(unsigned char const*, int)':
#14 5.805 codec_mp4a.cpp:(.text+0x318): undefined reference to `av_log_set_level'
#14 5.805 codec_mp4a.cpp:(.text+0x31c): undefined reference to `av_frame_alloc'
#14 5.805 codec_mp4a.cpp:(.text+0x38c): undefined reference to `av_init_packet'
#14 5.805 codec_mp4a.cpp:(.text+0x3b8): undefined reference to `avcodec_decode_audio4'
#14 5.805 codec_mp4a.cpp:(.text+0x408): undefined reference to `av_packet_unref'
#14 5.805 codec_mp4a.cpp:(.text+0x410): undefined reference to `av_frame_unref'
#14 5.805 codec_mp4a.cpp:(.text+0x428): undefined reference to `avcodec_decode_audio4'
#14 5.805 codec_mp4a.cpp:(.text+0x47c): undefined reference to `av_packet_unref'
#14 5.805 codec_mp4a.cpp:(.text+0x484): undefined reference to `av_frame_free'
#14 5.805 /tmp/ccU81f8T.o: In function `Codec::mp4vMatch(unsigned char const*, int)':
#14 5.805 codec_mp4v.cpp:(.text+0x384): undefined reference to `av_log_set_level'
#14 5.805 codec_mp4v.cpp:(.text+0x3d4): undefined reference to `av_packet_alloc'
#14 5.805 codec_mp4v.cpp:(.text+0x440): undefined reference to `av_frame_alloc'
#14 5.805 codec_mp4v.cpp:(.text+0x4bc): undefined reference to `avcodec_decode_video2'
#14 5.805 /tmp/ccOffa4M.o: In function `Codec::alacMatch(unsigned char const*, int)':
#14 5.805 codec_alac.cpp:(.text+0x2d4): undefined reference to `av_log_set_level'
#14 5.805 codec_alac.cpp:(.text+0x2d8): undefined reference to `av_frame_alloc'
#14 5.805 codec_alac.cpp:(.text+0x348): undefined reference to `av_init_packet'
#14 5.806 codec_alac.cpp:(.text+0x374): undefined reference to `avcodec_decode_audio4'
#14 5.809 codec_alac.cpp:(.text+0x410): undefined reference to `av_packet_unref'
#14 5.809 codec_alac.cpp:(.text+0x418): undefined reference to `av_frame_free'
#14 5.817 collect2: error: ld returned 1 exit status
------
executor failed running [/bin/sh -c /usr/bin/g++ -o untrunc main.cpp atom.cpp mp4.cpp file.cpp track.cpp log.cpp codec.cpp codec_rtp.cpp codec_avc1.cpp codec_hev1.cpp codec_mp4a.cpp codec_mp4v.cpp codec_pcm.cpp codec_mbex.cpp codec_alac.cpp codecstats.cpp codec_unknown.cpp codec_text.cpp codec_tmcd.cpp codec_gpmd.cpp codec_fdsc.cpp codec_apch.cpp codec_mijd.cpp -I./libav-12.3 -L./libav-12.3/libavformat -lavformat -L./libav-12.3/libavcodec -lavcodec -L./libav-12.3/libavresample -lavresample -L./libav-12.3/libavutil -lavutil -lpthread -lz]: exit code: 1
I do not have a mac accessible... it might be possible that the libavcodec, format etc. are generated in a different location or with a different name? It should be ./libav-12.3/libavformat/libaviformat.a
The Mac part should not matter as this is a Docker build - the error doesn't seem to be to do with not finding files, rather it is those undefined reference errors.
Is it possible some other dependency of either untrunc or libav has updated and is causing this? Can you pin the versions in the dockerfile?
I did just successfully complete a build on this on a windows machine. So I do not think it is any dependency issues of the packages.
E:\Untrunc\untrunc>docker build -t untrunc . [+] Building 319.9s (17/17) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.43kB 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/ubuntu:bionic 2.1s => [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s => [internal] load build context 0.1s => => transferring context: 588.70kB 0.0s => [build 1/9] FROM docker.io/library/ubuntu:bionic@sha256:3b8692dc4474d4f6043fae285676699361792ce1828e22b1b5736 2.3s => => resolve docker.io/library/ubuntu:bionic@sha256:3b8692dc4474d4f6043fae285676699361792ce1828e22b1b57367b5c05 0.0s => => sha256:3b8692dc4474d4f6043fae285676699361792ce1828e22b1b57367b5c05457e3 1.41kB / 1.41kB 0.0s => => sha256:c404618e908391e50953e1ead94fe05dbbddbf532bd5c89b935ef34a9ca130d3 529B / 529B 0.0s => => sha256:fbf60236a8e3dd08a08966064a8ac9f3943ecbffa6ae2ad9bc455974b956412c 1.46kB / 1.46kB 0.0s => => sha256:e7ae86ffe2df0787131a4c49ace1b018fd38d62929b007d86bdd1f825e56a852 26.71MB / 26.71MB 1.1s => => extracting sha256:e7ae86ffe2df0787131a4c49ace1b018fd38d62929b007d86bdd1f825e56a852 1.0s => [build 2/9] RUN apt-get update && apt-get -y install libavformat-dev libavcodec-dev libavut 248.1s => [build 3/9] WORKDIR /untrunc 0.1s => [build 4/9] RUN wget https://github.com/libav/libav/archive/v12.3.zip && unzip v12.3.zip && rm v12.3. 3.3s => [build 5/9] WORKDIR /untrunc/libav-12.3/ 0.1s => [build 6/9] RUN ./configure && make -j8 54.8s => [build 7/9] WORKDIR /untrunc 0.1s => [build 8/9] ADD . . 0.1s => [build 9/9] RUN /usr/bin/g++ -o untrunc main.cpp atom.cpp mp4.cpp file.cpp track.cpp 8.0s => [stage-1 2/3] COPY --from=build /untrunc/untrunc /untrunc 0.2s => [stage-1 3/3] RUN useradd untrunc 0.4s => exporting to image 0.3s => => exporting layers 0.3s => => writing image sha256:db720db0379454f212dd33ca1dd6c1a15a80dd07792efa7b8a61f01aee451050 0.0s => => naming to docker.io/library/untrunc 0.0s