untrunc icon indicating copy to clipboard operation
untrunc copied to clipboard

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

Open krono-i2 opened this issue 6 years ago • 4 comments

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 avatar Feb 03 '19 06:02 krono-i2

Solved! I added the path for resample!

krono-i2 avatar Feb 03 '19 14:02 krono-i2

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

a-kriya avatar Feb 20 '19 09:02 a-kriya

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

a-kriya avatar Feb 20 '19 09:02 a-kriya

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

anthwlock avatar Feb 20 '19 20:02 anthwlock