Issue 1106 in webm: iOS VPX Framework puts header files in the wrong directory

190 views
Skip to first unread message

jonathan.lennox42@gmail.com via Monorail

unread,
Dec 3, 2015, 6:24:18 PM12/3/15
to webm-d...@webmproject.org
Status: Untriaged
Owner: ----
Labels: Type-Bug Pri-2 Component-libvpx

New issue 1106 by jonathan...@gmail.com: iOS VPX Framework puts header
files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106

What is the expected behavior? What do you see instead?

The VPX.framework built by libvpx's iosbuild.sh puts its header files in
the wrong place for them to be found by clang's -F option (i.e. Xcode's
FRAMEWORK_SEARCH_PATHS setting.)

The way framework header searches work is that <foo/bar.h> is found in
foo.framework/Headers/bar.h. Thus, <vpx/vp8cx.h> would be expected to be
in vpx.framework/Headers/vp8cx.h.

iosbuild.sh instead puts it in VPX.framework/Headers/vpx/vp8cx.h -- note
the extra vpx/ directory. (Also the capitalization, but since Macs use
case-insensitive filesystems by default this is less of a problem.)

$ ls libvpx-build/
VPX.framework
$ xcrun -sdk iphoneos clang -arch armv7 -c -F libvpx-build -x c -include
vpx/vp8cx.h -o /dev/null /dev/null
In file included from <built-in>:332:
<command line>:1:10: fatal error: 'vpx/vp8cx.h' file not found
#include "vpx/vp8cx.h"
^
1 error generated.
$ xcrun -sdk iphoneos clang -arch armv7 -c -F libvpx-build -x c -include
vpx/vpx/vp8cx.h -o /dev/null /dev/null
[compiles successfully]

I would expect the results of the two build commands to be reversed.


What version are you using? On what operating system?

libvpx-1.5.0, on OSX Yosemite 10.10.5, using Xcode 7.1.1.


Can you reproduce using the vpxdec or vpxenc tools? What command line are
you using?

N/A.


Please provide any additional information below.

As suggested on http://wiki.webmproject.org/xcode-working-with-libvpx it's
possible to add VPX.framework/Headers to your header search path, but the
whole point of using frameworks with Xcode is that this shouldn't be
necessary.

--
You received this message because:
1. The project was configured to send all issue notifications to this
address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

johannkoenig@google.com via Monorail

unread,
Dec 3, 2015, 6:59:18 PM12/3/15
to webm-d...@webmproject.org
Updates:
Cc: tomfine...@google.com

Comment #1 on issue 1106 by johannko...@google.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c1

It wants to flatten the structure? That seems strange to me. What if there
are two includes: vp8/file.h and vp9/file.h?

jonathan.lennox42@gmail.com via Monorail

unread,
Dec 4, 2015, 11:07:54 AM12/4/15
to webm-d...@webmproject.org

Comment #2 on issue 1106 by jonathan...@gmail.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c2

I don't think you can have a header included as vp8/file.h in a framework
named VPX.framework -- it'd need to be in a framework named VP8.framework.

Generally speaking, if a Framework has a header file at
Framework.framework/Headers/[path/]file.h, it's included as
<Framework/[path/]file.h>.

tomfinegan@google.com via Monorail

unread,
Dec 4, 2015, 11:59:39 AM12/4/15
to webm-d...@webmproject.org
Updates:
Status: Unconfirmed
Owner: tomfine...@google.com
Cc: johannko...@google.com
Cc: -tomfine...@google.com

Comment #3 on issue 1106 by tomfine...@google.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c3

> As suggested on http://wiki.webmproject.org/xcode-working-with-libvpx
> it's possible to add VPX.framework/Headers to your header search path,
> but the whole point of using frameworks with Xcode is that this shouldn't
> be necessary.

This is exactly what must be done. The point of frameworks in general, and
the reason for VPX.framework's existence aren't necessarily the same.
VPX.framework exists because building libvpx for all the necessary targets
required by iOS/MacOS developers can be tedious, and there are places where
mistakes can be made quite easily. Better to provide a configurable script
that produces the framework than to force developers to handle doing manual
builds for all necessary targets.

Another reason for this layout is that VPX.framework is intended to be able
to be used as a drop in with existing applications that target multiple
platforms (including non-iOS/non-MacOS targets). For example, this
structure allows vpx{dec,enc} to use VPX.framework by adding only an
include path and linker arg. Restructuring the framework the way you'd (and
Apple, but I don't know of docs about this, so I'm guessing) prefer would
mean either include shims or ifdefs in simple apps like vpx{dec,enc}.

> I don't think you can have a header included as vp8/file.h in a framework
> named VPX.framework -- it'd need to be in a framework named VP8.framework.

-- Quote from [3], linked below --
For most frameworks, you can include header files other than the master
header file. You can include any specific header file you want as long as
it is available in the framework’s Headers directory.
--

Are there Apple docs stating otherwise somewhere? I'm not aware of any
imposing any structuring restrictions ([1], [2], [3] don't seem to mention
any). Specifically in reference to [3], an argument could be made that
VPX.framework should provide a VPX.h that includes the individual includes
and would hopefully allow users to avoid the framework search paths update.
That could possibly be added, but that's not what this issue is reporting.
Should this issue be titled "VPX.framework does not provide a VPX.h"?

One last note: VPX.framework will always support all the VPx codecs by
default (you are free to disable codecs directly using command line flags;
see iosbuild.sh --help output and the output from libvpx configure.sh
--help).

[1]
https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html
[2]
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html
[3]
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/IncludingFrameworks.html#//apple_ref/doc/uid/20002257-BAJJBBHJ

tomfinegan@google.com via Monorail

unread,
Dec 4, 2015, 12:02:15 PM12/4/15
to webm-d...@webmproject.org

Comment #4 on issue 1106 by tomfine...@google.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c4

Sigh... wish you could edit these sometimes. :)

Next to last paragraph in #3, second sentence should read: "I'm not aware
of Apple imposing..."

jonathan.lennox42@gmail.com via Monorail

unread,
Dec 4, 2015, 12:09:27 PM12/4/15
to webm-d...@webmproject.org

Comment #5 on issue 1106 by jonathan...@gmail.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c5

Restructuring the Framework the way I want wouldn't require any changes to
code that includes VPX header files -- the include path in the C code would
still be <vpx/vp8cx.h>, etc.

It's just that you tell the compiler where to find the framework (if it's
in a non-standard location) using the -F option, or FRAMEWORK_SEARCH_PATHS,
rather than the -I option, or HEADER_SEARCH_PATHS.

The compiler will search for <vpx/vp8cx.h> in
[FRAMEWORK_SEARCH_PATH]/vpx.framework/Headers/vp8cx.h.

Witness:

$ xcrun -sdk iphoneos clang -arch armv7 -c -F libvpx-build -x c -include
vpx/vp8cx.h -o /dev/null /dev/null
In file included from <built-in>:332:
<command line>:1:10: fatal error: 'vpx/vp8cx.h' file not found
#include "vpx/vp8cx.h"
^
1 error generated.
$ mv libvpx-build/VPX.framework/Headers/vpx/*.h
libvpx-build/VPX.framework/Headers/
$ xcrun -sdk iphoneos clang -arch armv7 -c -F libvpx-build -x c -include
vpx/vp8cx.h -o /dev/null /dev/null
$ echo $?
0
$ xcrun -sdk iphoneos clang -arch armv7 -E -F libvpx-build -x c -include
vpx/vp8cx.h /dev/null | grep vpx | head
# 1 "libvpx-build/vpx.framework/Headers/vp8cx.h" 1
# 18 "libvpx-build/vpx.framework/Headers/vp8cx.h"
# 1 "libvpx-build/vpx.framework/Headers/./vp8.h" 1
# 33 "libvpx-build/vpx.framework/Headers/./vp8.h"
# 1 "libvpx-build/vpx.framework/Headers/./vpx_codec.h" 1
# 46 "libvpx-build/vpx.framework/Headers/./vpx_codec.h"
# 1 "libvpx-build/vpx.framework/Headers/./vpx_integer.h" 1
# 16 "libvpx-build/vpx.framework/Headers/./vpx_integer.h"
# 17 "libvpx-build/vpx.framework/Headers/./vpx_integer.h" 2
# 63 "libvpx-build/vpx.framework/Headers/./vpx_integer.h"

tomfinegan@google.com via Monorail

unread,
Dec 4, 2015, 12:11:54 PM12/4/15
to webm-d...@webmproject.org

Comment #6 on issue 1106 by tomfine...@google.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c6

This would be true if the build system used -F on darwin/iphonesimulator
targets: It doesn't.

tomfinegan@google.com via Monorail

unread,
Dec 4, 2015, 12:25:01 PM12/4/15
to webm-d...@webmproject.org

Comment #7 on issue 1106 by tomfine...@google.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c7

Sorry, that was overly terse:

libvpx/configure and libvpx's internal build system know nothing about
frameworks. It doesn't know about -F, and configure cannot produce the
framework (configure produces makefiles for a single target and doesn't
know how to configure for multiple targets, and it cannot build them
directly).

Basically, configure/make will, at least for the foreseeable future, be the
main tools used to build libvpx. Configure and make only know about single
targets (universal support has been removed; and that was PPC/i386
universal, anyway).

Why is this important? Apple's clang build isn't the only clang build
libvpx must support on MacOS. Does the LLVM.org clang even know what -F is?
Is it implemented the same way (specifically regarding vpx vs VPX as I
mention below)?

> $ xcrun -sdk iphoneos clang -arch armv7 -c -F libvpx-build -x c -include
> vpx/vp8cx.h -o /dev/null /dev/null

This is incredibly ambiguous. Where's vpx in this case? Is it installed on
the system, or is it VPX.framework via MacOS case-insensitivity magic?

I understand what's going on, but this example seems like you're abusing
the way things work on MacOS. vpx/vp8cx.h is not a real path. Using -F is
just adding -IVPX.framework/Headers, and then via the internal workings of
Apple's clang fork, it's allowing VPX.framework/Headers/vp8cx.h it to be
represented by vpx/vp8cx.h.

Is adding the additional framework search path that onerous?

jonathan.lennox42@gmail.com via Monorail

unread,
Dec 4, 2015, 12:30:35 PM12/4/15
to webm-d...@webmproject.org

Comment #8 on issue 1106 by jonathan...@gmail.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c8

Ah, I see, so you want to keep things working for build systems that use
-I. That makes sense, for portability.

And clearly the configure/make will be the primary way that libvpx is built
for Mac/iOS; what I'm suggesting would be something that iosbuild.sh would
do as part of its process of assembling the framework.

Adding the header search path (not the framework search path) isn't all
that onerous, no. However, I still think it's useful to have things also
work for build systems that use -F. Notably, this would mean that
VPX.framework could be installed in /Library/Frameworks or
~/Library/Frameworks and it wouldn't need any Xcode paths to be set at all.

So I'd suggest having iosbuild.sh add a symbolic link, which would satisfy
both types of build systems:

$ mv libvpx-build/VPX.framework/Headers/vpx/*
libvpx-build/VPX.framework/Headers/
$ rmdir libvpx-build/VPX.framework/Headers/vpx
$ cd libvpx-build/VPX.framework/Headers/
$ ln -s . vpx
$ cd -

$ xcrun -sdk iphoneos clang -arch armv7 -c -F libvpx-build -x c -include
vpx/vp8cx.h /dev/null -o /dev/null; echo $?
$ xcrun -sdk iphoneos clang -arch armv7 -c -I
libvpx-build/VPX.framework/Headers -x c -include vpx/vp8cx.h /dev/null -o
/dev/null; echo $?

tomfinegan@google.com via Monorail

unread,
Dec 4, 2015, 12:41:25 PM12/4/15
to webm-d...@webmproject.org
Updates:
Status: Assigned

Comment #9 on issue 1106 by tomfine...@google.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c9

I'm kind of swamped at the moment, but your last suggestion looks good--
taking this bug, and I'll try to get to this some time next week.

Thanks for the discussion and the report!

tomfinegan@google.com via Monorail

unread,
Dec 9, 2015, 4:45:03 PM12/9/15
to webm-d...@webmproject.org
Updates:
Status: Started

Comment #10 on issue 1106 by tomfine...@google.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c10

Odd. Even with the symlink Xcode cannot find includes in
VPX.framework/Headers without explicit addition of the
path/to/VPX.framework/Headers in the Header search paths of a project. Also
fun is that adding a framework to a project doesn't mean it can be found at
link time (in other words I need path/to/parent/dir/of/VPX.framework in
framework search paths, but maybe that's normal behavior for Xcode)..

More disturbing is that iosbuild.sh needed some updates to make it possible
for Xcode 7 building MacOSX code to link in the framework-- the iphonesim
targets set -miphoneos-version-min, which causes the linker to refuse to
link the framework when your target platform is MacOSX.

Anyway, I'll look into this some more sometime in the future, but the
solution is going to be to continue to follow the existing instructions re
path settings in Xcode projects.

jonathan.lennox42@gmail.com via Monorail

unread,
Dec 14, 2015, 6:23:20 PM12/14/15
to webm-d...@webmproject.org

Comment #11 on issue 1106 by jonathan...@gmail.com: iOS VPX Framework puts
header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c11

iPhoneOS and Mac OS X are different operating systems, albeit very similar
ones, so I don't think it's a good idea to advise people to use the
iPhoneSimulator code on Mac OS X. Probably an osxbuild.sh script (or a
generic parameterized darwinbuild.sh script, or something) would be
necessary if you want to support both platforms.

tomfinegan@google.com via Monorail

unread,
Apr 1, 2016, 12:11:58 PM4/1/16
to webm-d...@webmproject.org
Updates:
Components: libvpx

Comment #12 on issue 1106 by tomfi...@google.com: iOS VPX Framework puts header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c12

(No comment was entered for this change.)

tomfinegan@google.com via Monorail

unread,
May 5, 2016, 1:22:08 PM5/5/16
to webm-d...@webmproject.org
Updates:
Status: WontFix

Comment #13 on issue 1106 by tomfi...@google.com: iOS VPX Framework puts header files in the wrong directory
https://bugs.chromium.org/p/webm/issues/detail?id=1106#c13

Framework layout won't be changing, so marking WontFix.
Reply all
Reply to author
Forward
0 new messages