Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.76k stars 12.45k forks source link

[ffmpeg.rb] dyld: lazy symbol binding failed: Symbol not found: _clock_gettime #4902

Closed muammar closed 8 years ago

muammar commented 8 years ago

If Homebrew was updated on Aug 10-11th 2016 and brew update always says Already up-to-date. you need to run: cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update.

Please follow the general troubleshooting steps first:

I have installed ffmpeg with the following options:

brew -v install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265

Since I updated to the latest xcode version:

Xcode 8.0
Build version 8A218a

ffmpeg complains with these messages:


dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /usr/local/Cellar/ffmpeg/3.1.3/lib/libavutil.55.dylib
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _clock_gettime
  Referenced from: /usr/local/Cellar/ffmpeg/3.1.3/lib/libavutil.55.dylib
  Expected in: /usr/lib/libSystem.B.dylib
zmwangx commented 8 years ago

Can you try to brew update first, then uninstall FFmpeg followed by your original install command? The problem should have been resolved by our Xcode 8 fixes. (We tracked down the cause and had a fix two days ago. Similar problems were reported to be fixed more than 24 hours ago.)

muammar commented 8 years ago

@zmwangx let me check that. I will uninstall ffmpeg + its dependencies and try back.

zmwangx commented 8 years ago

Actually FFmpeg doesn't use autotools so it probably isn't fixed (which is why I didn't ask you to try this 17 hours ago when I tagged it). I just got up and my brain hasn't started working... Anyway, doesn't hurt to try.

ilovezfs commented 8 years ago

it's fine now. I think it's the vendored POS that was causing it since that does use autotools.

ilovezfs commented 8 years ago

hm no it doesn't ... but does seem to be perfectly fine

muammar commented 8 years ago

When doing brew -v update I realised some important changes were introduced (lots of rm and ln commands going on linking). But no,it still does not work.

ilovezfs commented 8 years ago

ah I see failure is at runtime not buildtime. cool. thanks for reporting ... shouldn't take too long to fix

zmwangx commented 8 years ago

I realised some important changes were introduced

It's just everything being relinked.

Could you please post a brew gist-logs ffmpeg? At least it gives us an idea of your setup.

ilovezfs commented 8 years ago

@zmwangx it's easily reproduced. failure is at run time.

zmwangx commented 8 years ago

failure is at runtime not buildtime

Of course, quintessential Xcode 8 breakage.

muammar commented 8 years ago

@zmwangx Here you are:

  % brew gist-logs ffmpeg                                                                                                                            !10103
https://gist.github.com/8212707624b0b575287d124b9e8e82b1
ilovezfs commented 8 years ago

This one is fixed by adding ENV.no_weak_imports:

diff --git a/Formula/ffmpeg.rb b/Formula/ffmpeg.rb
index 1b60d4b..9446587 100644
--- a/Formula/ffmpeg.rb
+++ b/Formula/ffmpeg.rb
@@ -91,6 +91,8 @@ class Ffmpeg < Formula
   end

   def install
+    ENV.no_weak_imports
+
     args = %W[
       --prefix=#{prefix}
       --enable-shared
ilovezfs commented 8 years ago

@muammar https://github.com/Homebrew/homebrew-core/pull/4924

muammar commented 8 years ago

@ilovezfs thanks for the fix. Once it is merged, I will test it.

busla commented 8 years ago

@ilovezfs just updated but still get the same error as OP.

dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /usr/local/Cellar/ffmpeg/3.1.3/lib/libavutil.55.dylib
  Expected in: /usr/lib/libSystem.B.dylib
zmwangx commented 8 years ago

@busla Could you please try this patch: https://patch-diff.githubusercontent.com/raw/Homebrew/homebrew-core/pull/4924.diff

busla commented 8 years ago

@zmwangx didn´t work. Here is the log:

ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libx265 --disable-lzma --enable-nonfree --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /usr/local/Cellar/ffmpeg/3.1.3/lib/libavutil.55.dylib
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _clock_gettime
  Referenced from: /usr/local/Cellar/ffmpeg/3.1.3/lib/libavutil.55.dylib
  Expected in: /usr/lib/libSystem.B.dylib

Trace/BPT trap: 5
ilovezfs commented 8 years ago

It does indeed work. And you can now just brew update and use the bottle.

==> Downloading https://homebrew.bintray.com/bottles/ffmpeg-3.1.3.el_capitan.bot
######################################################################## 100.0%
==> Pouring ffmpeg-3.1.3.el_capitan.bottle.1.tar.gz
==> Caveats
The native FFmpeg AAC encoder has been stable since FFmpeg 3.0. If you
were using libvo-aacenc or libaacplus, both of which have been dropped in
FFmpeg 3.0, please consider switching to the native encoder (-c:a aac),
fdk-aac (-c:a libfdk_aac, ffmpeg needs to be installed with the
--with-fdk-aac option), or faac (-c:a libfaac, ffmpeg needs to be
installed with the --with-faac option).

See the announcement
https://ffmpeg.org/index.html#removing_external_aac_encoders for details,
and https://trac.ffmpeg.org/wiki/Encode/AAC on best practices of encoding
AAC with FFmpeg.
==> Summary
🍺  /usr/local/Cellar/ffmpeg/3.1.3: 236 files, 49.8M
iMac-TMP:homebrew-core joe$ brew test -v ffmpeg
Testing ffmpeg
==> Using the sandbox
/usr/bin/sandbox-exec -f /tmp/homebrew20160920-44601-3071c9.sb /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -W0 -I /usr/local/Homebrew/Library/Homebrew -- /usr/local/Homebrew/Library/Homebrew/test.rb /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/ffmpeg.rb -v
==> /usr/local/Cellar/ffmpeg/3.1.3/bin/ffmpeg -y -filter_complex testsrc=rate=1:duration=1 /tmp/ffmpeg-test-20160920-44602-1gwgptl/video.mp4
ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --disable-lzma --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x7fb29d002c00] using SAR=1/1
[libx264 @ 0x7fb29d002c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fb29d002c00] profile High 4:4:4 Predictive, level 1.2, 4:4:4 8-bit
[libx264 @ 0x7fb29d002c00] 264 - core 148 r2699 a5e06b9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=7 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x7fb29d001a00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to '/tmp/ffmpeg-test-20160920-44602-1gwgptl/video.mp4':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 320x240 [SAR 1:1 DAR 4:3], q=-1--1, 1 fps, 16384 tbn, 1 tbc (default)
    Metadata:
      encoder         : Lavc57.48.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  testsrc -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=17.0 Lsize=       5kB time=00:00:00.00 bitrate=617704.9kbits/s speed=0.0166x    
video:4kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 20.460358%
[libx264 @ 0x7fb29d002c00] frame I:1     Avg QP:15.46  size:  3223
[libx264 @ 0x7fb29d002c00] mb I  I16..4: 46.3% 26.7% 27.0%
[libx264 @ 0x7fb29d002c00] 8x8 transform intra:26.7%
[libx264 @ 0x7fb29d002c00] coded y,u,v intra: 15.2% 11.5% 11.3%
[libx264 @ 0x7fb29d002c00] i16 v,h,dc,p: 81%  6%  6%  7%
[libx264 @ 0x7fb29d002c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 11% 52%  1%  0%  0%  0%  0%  0%
[libx264 @ 0x7fb29d002c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 53% 21% 18%  2%  2%  2%  0%  2%  0%
[libx264 @ 0x7fb29d002c00] kb/s:25.78
ilovezfs commented 8 years ago

@busla my guess is you don't have HOMEBREW_DEVELOPER set and so it stashed your changes before installing :)

busla commented 8 years ago

should I revert the patch suggested by @zmwangx then?

zmwangx commented 8 years ago

Patch has been merged. Just kill whatever change you have made and use the master branch.

busla commented 8 years ago

Yes!

Pizza!

ilovezfs commented 8 years ago

@busla cool! :pizza:

muammar commented 8 years ago

Thanks for the fix. Now it works.

nidegen commented 7 years ago

@ilovezfs hi there, i happen to have the same issue with freeglut. is it possible that it still exists there? should i open an issue? thanks

ilovezfs commented 7 years ago

@nidegen this will fix freeglut for you:

iMac-TMP:homebrew-x11 joe$ git diff -- freeglut.rb 
diff --git a/freeglut.rb b/freeglut.rb
index 9e23ffa..57ded66 100644
--- a/freeglut.rb
+++ b/freeglut.rb
@@ -16,6 +16,7 @@ class Freeglut < Formula
   patch :DATA

   def install
+    inreplace "src/x11/fg_main_x11.c", "CLOCK_MONOTONIC", "UNDEFINED_GIBBERISH"

     system "cmake", "-D", "FREEGLUT_BUILD_DEMOS:BOOL=OFF", "-D", "CMAKE_INSTALL_PREFIX:PATH=#{prefix}", "."
     system "make", "all"
nidegen commented 7 years ago

hmm it didnt. i inserted manually by using brew edit freeglut, i hope this is not wrong..

ilovezfs commented 7 years ago

you have to then do

brew install --build-from-source freeglut
nidegen commented 7 years ago

i didnt know the build-from-source flag was needed. you are awesome!

ilovezfs commented 7 years ago

@nidegen Glad you got it to work. Do you mind opening an issue in the X11 tap so we don't forget about it?

nidegen commented 7 years ago

sure

On 24.11.2016, at 13:55, ilovezfs notifications@github.com wrote:

@nidegen https://github.com/nidegen Glad you got it to work. Do you mind opening an issue in the X11 tap so we don't forget about it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Homebrew/homebrew-core/issues/4902#issuecomment-262770199, or mute the thread https://github.com/notifications/unsubscribe-auth/AIX2n3QDqLDxuw99unCAv4fS2iDeilGqks5rBYlLgaJpZM4J_NEk.

bcalik commented 7 years ago

I added export HOMEBREW_DEVELOPER=1 to my bash profile and reinstalled with -v flag. But I still get the following error:

dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /usr/local/Cellar/ffmpeg/3.1.2/lib/libavutil.55.dylib
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _clock_gettime
  Referenced from: /usr/local/Cellar/ffmpeg/3.1.2/lib/libavutil.55.dylib
  Expected in: /usr/lib/libSystem.B.dylib
ilovezfs commented 7 years ago

You're not up to date.

$ brew info ffmpeg
ffmpeg: stable 3.2.1, HEAD
bcalik commented 7 years ago

This is weird, my brew is up to date but it still installs version 3.1.2. I will try to install with --HEAD option.

ilovezfs commented 7 years ago

you're probably suffering from https://twitter.com/MacHomebrew/status/763686348041641984

bcalik commented 7 years ago

@ilovezfs Wow.. It is fixed now, thank you.

ilovezfs commented 7 years ago

you're welcome