ponchio / untrunc

Restore a damaged (truncated) mp4, m4v, mov, 3gp video. Provided you have a similar not broken video.
GNU General Public License v2.0
1.62k stars 230 forks source link

(OSX 10.11.6) clang: error: linker command failed with exit code 1 #154

Open krono-i2 opened 5 years ago

krono-i2 commented 5 years ago

Hi all! I tried to compile untrunc on OSX 10.11.6 with libav-12.3, using the instructions in README.md, but when I launch

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I./libav-12.3 -L./libav-12.3/libavformat -lavformat -L./libav-12.3/libavcodec -lavcodec -L./libav-12.3/libavutil -lavutil -lpthread -lz -framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration -lbz2 -DOSX

I obtain the error below.

Undefined symbols for architecture x86_64:
  "_avresample_alloc_context", referenced from:
      _opus_decode_init in libavcodec.a(opusdec.o)
  "_avresample_close", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
      _opus_decode_flush in libavcodec.a(opusdec.o)
  "_avresample_convert", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
  "_avresample_free", referenced from:
      _opus_decode_close in libavcodec.a(opusdec.o)
  "_avresample_is_open", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
  "_avresample_open", referenced from:
      _opus_decode_packet in libavcodec.a(opusdec.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How can I solve? Thank you.

Ivan

krono-i2 commented 5 years ago

Solved! I added the path for resample!

a-kriya commented 5 years ago

Getting the same error on 10.11.6. Can you please describe what you mean by "adding the path for resample"?

a-kriya commented 5 years ago

Figured. Append -L./libav-12.3/libavresample -lavresample to the g++ command, making it:

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I./libav-12.3 -L./libav-12.3/libavformat -lavformat -L./libav-12.3/libavcodec -lavcodec -L./libav-12.3/libavutil -lavutil -L./libav-12.3/libavresample -lavresample -lpthread -lz -framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration -lbz2 -DOSX
anthwlock commented 5 years ago

I simply use make on this fork. I somehow really like that fork!