Opened 22 months ago
Closed 19 months ago
#70519 closed defect (fixed)
ffmpeg7 @7.0.1 does not build on macOS 10.12 with Xcode 9.2 due to "AVMediaType" type conflict
| Reported by: | andlabs (Pietro Gagliardi) | Owned by: | mascguy (Christopher Nielsen) |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | |
| Keywords: | Cc: | mrkapqa, tehcog (tehcog), Randrianasulu (Andrew Randrianasulu), barracuda156 | |
| Port: | ffmpeg7 |
Description
Thanks for adding ffmpeg 7! On macOS 10.12 with Xcode 9.2, it fails to build with a bunch of confusing errors related to AVMediaType:
:info:build libavdevice/avfoundation.m:765:41: error: must use 'enum' tag to refer to type 'AVMediaType'
:info:build static NSArray* getDevicesWithMediaType(AVMediaType mediaType) {
:info:build ^
:info:build enum
:info:build libavdevice/avfoundation.m:816:50: warning: incompatible integer to pointer conversion sending 'enum AVMediaType' to parameter of type 'NSString *' [-Wint-conversion]
:info:build return [AVCaptureDevice devicesWithMediaType:mediaType];
:info:build ^~~~~~~~~
:info:build /System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDevice.h:110:47: note: passing argument to parameter 'mediaType' here
:info:build + (NSArray *)devicesWithMediaType:(NSString *)mediaType;
:info:build ^
:info:build libavdevice/avfoundation.m:829:54: warning: incompatible pointer to integer conversion passing 'NSString *const' to parameter of type 'enum AVMediaType' [-Wint-conversion]
(snip; see attached log)
I am guessing that the AVFoundation.framework AVMediaType was introduced in a later version of Xcode's macOS SDK and its lack of presence on my headers means ffmpeg defined its own enum with that name? When I tried building ffmpeg 7 a few months ago I just manually changed the function parameters to all be NSString * instead; I don't know if that's the correct fix or not though, so I'm opening this bug.
Attachments (1)
Change History (8)
Changed 22 months ago by andlabs (Pietro Gagliardi)
comment:1 Changed 22 months ago by andlabs (Pietro Gagliardi)
| Summary: | ffmpeg7: does not build on macOS 10.12 with Xcode 9.2 due to "AVMediaType" type conflict → ffmpeg7 @7.0.1 does not build on macOS 10.12 with Xcode 9.2 due to "AVMediaType" type conflict |
|---|
comment:2 Changed 22 months ago by erikbs
I think your analysis is correct. Unaware of this ticket I arrived at the same conclusion. In fact, in the 10.13 SDK, AVMediaType is typedef-ed to NSString* (with some extra specifier that does not seem to matter). The constants themselves (AVMediaTypeVideo etc.) were introduced in 10.7, where they were declared as NSString*. When the AVMediaType alias was introduced, the constant definitions were updated to use the new type alias. Ffmpeg7 fails because AVMediaType is not defined. Rather than patching the function to take an NSString* as parameter I created a patch that defines AVMediaType as an alias for NSString* (without the extra specifier) when targeting the OS X 10.12 SDK and older.
I have submitted the patch to FFmpeg and also opened a PR to have it included in MacPorts until the issue is fixed upstream: https://github.com/macports/macports-ports/pull/25416
comment:3 Changed 21 months ago by ryandesign (Ryan Carsten Schmidt)
| Cc: | mrkapqa added |
|---|
Has duplicate #70921.
comment:4 Changed 20 months ago by tehcog (tehcog)
| Cc: | tehcog added |
|---|
comment:6 Changed 20 months ago by ryandesign (Ryan Carsten Schmidt)
| Cc: | Randrianasulu barracuda156 added |
|---|
Has duplicate #71218.
comment:7 Changed 19 months ago by erikbs
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |

build log