Opened 9 years ago

Closed 9 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: Hanspeter Niederstrasser 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

Description

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=yes
avfoundation_indev_extralibs='-Wl,-framework,CoreVideo -Wl,-framework,Foundation -Wl,-framework,AVFoundation -Wl,-framework,CoreMedia -Wl,-framework,CoreGraphics'
avfoundation_indev_select=avfoundation

(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 9 years ago.

Download all attachments as: .zip

Change History (16)

in reply to:  description comment:1 by Thilo Borgmann, 9 years ago

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:
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemFrameworks/SystemFrameworks.html

(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 by Hanspeter Niederstrasser, 9 years ago

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 by Carl Eugen Hoyos, 9 years ago

Cc: Thilo Borgmann added
Keywords: regression added
Version: 2.5.2git-master

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

The two CG* types are not from the Core Graphics framework afaict:
https://developer.apple.com/library/ios/documentation/CoreGraphics/Reference/CoreGraphics_Framework/_index.html

comment:4 by Carl Eugen Hoyos, 9 years ago

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

comment:5 by Carl Eugen Hoyos, 9 years ago

Keywords: osx added

comment:6 by Thilo Borgmann, 9 years ago

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 by Carl Eugen Hoyos, 9 years ago

Shouldn't you test for CGGetActiveDisplayList?

comment:8 by Hanspeter Niederstrasser, 9 years ago

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 by Thilo Borgmann, 9 years ago

@cehoyos:
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 by Carl Eugen Hoyos, 9 years ago

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

comment:11 by Thilo Borgmann, 9 years ago

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:
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemFrameworks/SystemFrameworks.html

comment:12 by Carl Eugen Hoyos, 9 years ago

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

comment:13 by Thilo Borgmann, 9 years ago

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 by Hanspeter Niederstrasser, 9 years ago

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

comment:15 by Carl Eugen Hoyos, 9 years ago

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.