Opened 5 years ago

Closed 5 years ago

#4238 closed defect (fixed)

AVFoundation indev is allowed on OS X 10.7 but uses CoreGraphics framework which is 10.8 only

Reported by: nieder Owned by:
Priority: normal Component: build system
Version: git-master Keywords: regression osx
Cc: thilo.borgmann Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


On OS X 10.7, the AVFoundation is detected:

Enabled indevs:
avfoundation        libcdio            x11grab_xcb
lavfi            qtkit 

However, it then sets a linker flag for the CoreGraphics? framework that doesn't exist on 10.7 (it's 10.8 and above):

avfoundation_indev_extralibs='-Wl,-framework,CoreVideo -Wl,-framework,Foundation -Wl,-framework,AVFoundation -Wl,-framework,CoreMedia -Wl,-framework,CoreGraphics'

(The CoreGraphics? framework used to be a subcomponent of ApplicationServices? before 10.8, but the linker flag as provided doesn't help there).

The search for CoreGraphics? causes a failure when linking libavutil.54.dylib:

gcc -dynamiclib -Wl,-single_module -Wl,-install_name,/sw/lib/ffmpeg-2.4/lib/libavutil.54.dylib,-current_version,54.15.100,-compatibility_version,54 -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -L/sw/lib/libspeex1/lib -L/sw/lib/libopenjpeg -L/sw/lib -L/usr/X11R6/lib -lX11 -lXext -Wl,-dynamic,-search_paths_first -Qunused-arguments -o libavutil/libavutil.54.dylib libavutil/adler32.o libavutil/aes.o libavutil/atomic.o libavutil/audio_fifo.o libavutil/avstring.o libavutil/base64.o libavutil/blowfish.o libavutil/bprint.o libavutil/buffer.o libavutil/cast5.o libavutil/channel_layout.o libavutil/cpu.o libavutil/crc.o libavutil/des.o libavutil/dict.o libavutil/display.o libavutil/downmix_info.o libavutil/error.o libavutil/eval.o libavutil/fifo.o libavutil/file.o libavutil/file_open.o libavutil/fixed_dsp.o libavutil/float_dsp.o libavutil/frame.o libavutil/hash.o libavutil/hmac.o libavutil/imgutils.o libavutil/intmath.o libavutil/lfg.o libavutil/lls.o libavutil/log.o libavutil/log2_tab.o libavutil/lzo.o libavutil/mathematics.o libavutil/md5.o libavutil/mem.o libavutil/murmur3.o libavutil/opt.o libavutil/parseutils.o libavutil/pixdesc.o libavutil/pixelutils.o libavutil/random_seed.o libavutil/rational.o libavutil/rc4.o libavutil/ripemd.o libavutil/samplefmt.o libavutil/sha.o libavutil/sha512.o libavutil/stereo3d.o libavutil/threadmessage.o libavutil/time.o libavutil/timecode.o libavutil/tree.o libavutil/utils.o libavutil/x86/cpu.o libavutil/x86/cpuid.o libavutil/x86/emms.o libavutil/x86/float_dsp.o libavutil/x86/float_dsp_init.o libavutil/x86/lls.o libavutil/x86/lls_init.o libavutil/x86/pixelutils.o libavutil/x86/pixelutils_init.o libavutil/xga_font_data.o libavutil/xtea.o -lXv -lX11 -lXext -Wl,-framework,QTKit -Wl,-framework,Foundation -Wl,-framework,QuartzCore? -Wl,-framework,CoreVideo? -Wl,-framework,Foundation -Wl,-framework,AVFoundation -Wl,-framework,CoreMedia? -Wl,-framework,CoreGraphics? -Wl,-framework,CoreFoundation? -Wl,-framework,VideoDecodeAcceleration? -Wl,-framework,QuartzCore? -liconv -L/usr/X11/lib -lxcb -L/usr/X11/lib -lxcb-shm -lxcb -L/usr/X11/lib -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb -L/usr/X11/lib -lxcb-shape -lxcb -lX11 -lcdio_paranoia -lcdio_cdda -lcdio -L/sw/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lzvbi -L/sw/lib -lzmq -lxvidcore -L/sw/lib -lx265 -L/sw/lib -lx264 -lpthread -L/sw/lib -lwebp -lwavpack -lvpx -lvpx -lvpx -lvpx -lvorbisenc -lvorbis -logg -L/sw/lib -lvidstab -ltwolame -ltwolame -ltheoraenc -ltheoradec -logg -L/sw/lib/libspeex1/lib -lspeex -L/sw/lib -lschroedinger-1.0 -lpthread -loil-0.3 -L/sw/lib -lrtmp -lz -lssl -lcrypto -lz -lcrypto -lz -L/sw/lib -lquvi -L/sw/lib -lopus -lopenjpeg -DOPJ_STATIC -lopencore-amrwb -lopencore-amrnb -lmp3lame -L/sw/lib -lmodplug -lgsm -lgme -lstdc++ -L/sw/lib -lfribidi -L/sw/lib -lfreetype -L/sw/lib -lfontconfig -L/sw/lib -lcaca -lcelt0 -lcelt0 -L/sw/lib -lbs2b -L/sw/lib -lbluray -L/sw/lib -lass -lm -llzma -lbz2 -lz -pthread
ld: warning: directory not found for option '-Llibavresample'
ld: framework not found CoreGraphics?

Attachments (1)

0001-configure-Check-linking-against-CoreGraphics-or-Appl.patch (2.0 KB) - added by thilo.borgmann 5 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 in reply to: ↑ description Changed 5 years ago by thilo.borgmann

I don't have a 10.7 setup ready to test, however Apple says that CoreGraphics? is available for OSX >= 10.0, maybe as part of ApplicationServices? where the CG prefix also arises:

(The CoreGraphics? framework used to be a subcomponent of ApplicationServices? before 10.8, but the linker flag as provided doesn't help there).

So can you link avfoundation support successfully on <= 10.7 when linking against ApplicationServices? instead of CoreGraphics??

A patch would be welcome, I don't have <= 10.7 and almost no time to work on it these days.

comment:2 Changed 5 years ago by nieder

Sorry for the delay. The 10.7 machine where the issue was found is not mine and I had to wait for that person to get back to me with test results.

If the AVFoundation indev linkage is changed from CoreGraphics? to ApplicationServices? on both 10.7 and 10.9 (my box), then the build succeeds. However, I don't know the long term implications of using the older ApplicationServices? framework if Apple decides to deprecate and remove whatever symbols FFmpeg is using from it (and perhaps has moved to CoreGraphics??).

Off the top of my head, a possible fix might be to use "check_lib2 AVFoundation/AVFoundation.h <SOME FUNCTION> -Wl,-framework,CoreGraphics?", but I get the feeling that checking for header A and library B will not work (that snippet is untested).

By the way, I also tried to not link to either CoreGraphics? and ApplicationServices? and added "-undefined error" to error out if any symbols are undefined. The build completed (on 10.9) successfully. The question then becomes if CoreGraphics? is needed at all? I don't use the AVFoundation indev, so I don't know how to test this build.

comment:3 Changed 5 years ago by cehoyos

  • Cc thilo.borgmann added
  • Keywords regression added
  • Version changed from 2.5.2 to git-master

These are the new objects used by avfoundation.m since a6555f88aaf0730e64240136fb19d8effb3a0738
AVCaptureInput (AVFoundation framework)
AVCaptureScreenInput (AVFoundation framework)

The two CG* types are not from the Core Graphics framework afaict:

comment:4 Changed 5 years ago by cehoyos

On OS X 10.10 (Xcode 6.1.1) -framework CoreGraphics is required to resolve the symbol reference for CGGetActiveDisplayList.

comment:5 Changed 5 years ago by cehoyos

  • Keywords osx added

comment:6 Changed 5 years ago by thilo.borgmann

The patch just attached tries to figure out if linking against CoreGraphics? or ApplicationServices? is suitable.

Just switching to ApplicationServices? is not sufficient because the framework does not exist on iOS.

Nieder, please test this patch on a 10.7 machine.

comment:7 Changed 5 years ago by cehoyos

Shouldn't you test for CGGetActiveDisplayList?

comment:8 Changed 5 years ago by nieder

The person helping me test on 10.7 will be able to access their machine on Monday. I'll report back when I get his results.

comment:9 Changed 5 years ago by thilo.borgmann

CGActiveDisplayList is not available on IOS. To support OSX and IOS we should test against a function that is available on both sides.
CGImageGetTypeID is available for OSX >= 10.2 and IOS >= 2.0 and sounds like it will always be available in future versions.
Second, I don't want to test against something within conditional compilation blocks.

comment:10 Changed 5 years ago by cehoyos

But do you need a -framework at all for CGDirectDisplayID?
Not needing it should simplify your patch.

comment:11 Changed 5 years ago by thilo.borgmann

CGDirectDisplayID seems not to be available on IOS, too.
Why do you think it would not need a framework?
It has a CG-prefix, thus I think it does, see:

comment:12 Changed 5 years ago by cehoyos

I thought CGDirectDisplayID is only a typedef and has no effect at the linking stage.

comment:13 Changed 5 years ago by thilo.borgmann

Like you, I would like a test for something actually used in the code better than my patch. However, how would you test for CGDirectDisplayID in configure then? I don't see an obvious way so maybe you can post a patch and Nieder might have checked both on Monday.

comment:14 Changed 5 years ago by nieder

The 10.7 user who reported the CoreGraphics? linking failure to me says that the patch from comment 6 works there.

comment:15 Changed 5 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed

Should be fixed in 83808ee7e9e89b0c83d5ecd94b35952c44716b68 - thank you for the report!

Note: See TracTickets for help on using tickets.