Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build on Mac because the build can't find libavformat/avformat.h #12672

Closed
bzbarsky opened this issue Jul 31, 2016 · 18 comments
Closed

Unable to build on Mac because the build can't find libavformat/avformat.h #12672

bzbarsky opened this issue Jul 31, 2016 · 18 comments

Comments

@bzbarsky
Copy link
Contributor

@bzbarsky bzbarsky commented Jul 31, 2016

I tried following the directions at https://github.com/servo/servo/blob/master/README.md to compile Servo on mac. The build dies, like so:

 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name vmrs.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.9 -v -gdwarf-2 -dwarf-column-info -ffunction-sections -fdata-sections -coverage-file /Users/bzbarsky/mozilla/servo/target/debug/build/video-metadata-68095025ad9189db/out/ffi/vmrs.o -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2 -O0 -fdebug-compilation-dir /Users/bzbarsky/mozilla/servo/.cargo/git/checkouts/video-metadata-rs-58c16900f00fb0a1/master -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -o /Users/bzbarsky/mozilla/servo/target/debug/build/video-metadata-68095025ad9189db/out/ffi/vmrs.o -x c ffi/vmrs.c
clang -cc1 version 7.0.2 based upon LLVM 3.7.0svn default target x86_64-apple-darwin14.5.0
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
In file included from ffi/vmrs.c:1:
ffi/vmrs.h:4:10: fatal error: 'libavformat/avformat.h' file not found
#include <libavformat/avformat.h>
         ^

I tried port install ffmpeg and port install ffmpeg-devel, both of which install the relevant header, but both put it in /opt/local/include/libavformat/avformat.h and the above header search path does not contain /opt/local/include. Note the ignoring nonexistent directory "/usr/local/include" bit, in case it matters.

@clstl
Copy link
Contributor

@clstl clstl commented Aug 1, 2016

I had the same exact issue today. I have a "shady" workaround (works for now) , but not the solution
brew install ffmpeg --build-from-source && ln -s /usr/local /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/local

@GuillaumeGomez
Copy link
Contributor

@GuillaumeGomez GuillaumeGomez commented Aug 1, 2016

Look here.

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Aug 1, 2016

Yes, when I've seen this (on our OSX builders), we fixed it by doing:
xcode-select --install

Which I got from: http://stackoverflow.com/a/26404710

@bzbarsky
Copy link
Contributor Author

@bzbarsky bzbarsky commented Aug 1, 2016

xcode-select --install does not work, of course, because that doesn't change anything about /opt/local/include. When I run it, it (unsurprisingly) says:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

because I've run it before already, obviously (can't really build Firefox otherwise!).

@m1c0l
Copy link

@m1c0l m1c0l commented Aug 1, 2016

I'm getting a similar error on Linux when I run the nightly download:

./servo: error while loading shared libraries: libavformat.so.54: cannot open shared object file: No such file or directory
@birkoffe
Copy link
Contributor

@birkoffe birkoffe commented Aug 1, 2016

In windows nighly builds same error with missing avformat-57.dll and avutil-55.dll on servo start.

@clstl
Copy link
Contributor

@clstl clstl commented Aug 1, 2016

@larsbergstrom what version of OSX do you have there? I bet it is only El Capitan that does this. I had quite a few issues with paths over the past year.

@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented Aug 1, 2016

Should we turn ffmpeg off again?

@bzbarsky
Copy link
Contributor Author

@bzbarsky bzbarsky commented Aug 1, 2016

@clstl I have Yosemite.

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Aug 1, 2016

That's really weird, because on my mac (10.11) and our builders (10.10), the files are in /usr/local/include/libavformat. The error that seems to generate this condition is that /usr/local gets set to no longer have read permission for the user (literally, goofball d-wx--x--x) permissions.

@wardboumans wardboumans mentioned this issue Aug 1, 2016
11 of 11 tasks complete
@cbrewster
Copy link
Member

@cbrewster cbrewster commented Aug 1, 2016

I had this issue earlier, xcode-select --install fixed it for me.

@bzbarsky
Copy link
Contributor Author

@bzbarsky bzbarsky commented Aug 1, 2016

@larsbergstrom Presumably both your mac and your builders are using homebrew. I'm using macports. The headers end up in a different place there: /opt/local/include/libavformat.

@larsbergstrom
Copy link
Contributor

@larsbergstrom larsbergstrom commented Aug 1, 2016

@bzbarsky Thanks for the clarification and I apologize for my assumption! Due, in part, to most CI systems that support OSX having moved over to HomeBrew, I'd forgotten that macports was still being supported and used :-)

We may have to consider adding a macOS builder that only has macports stuff installed and no homebrew if we want to continue supporting this developer configuration. Added an issue to our infra repo for discussion: servo/saltfs#452

@jbriggs-zvelo
Copy link

@jbriggs-zvelo jbriggs-zvelo commented Aug 1, 2016

I have a very similar problem on Fedora. My libavformat header files are installed in /usr/include/ffmpeg and so they aren't found by a simple include. They need -I/usr/include/ffmpeg set. The Rust build files should be using pkg-config to locate these.

@GuillaumeGomez
Copy link
Contributor

@GuillaumeGomez GuillaumeGomez commented Aug 1, 2016

@bzbarsky
Copy link
Contributor Author

@bzbarsky bzbarsky commented Aug 1, 2016

Per irc discussion, using pkg-config would also work for macports, because then the right include path would get set.

@metajack
Copy link
Contributor

@metajack metajack commented Aug 2, 2016

@bzbarsky This should be fixed by #12683. I'll close once you confirm it's now working for you.

@bzbarsky
Copy link
Contributor Author

@bzbarsky bzbarsky commented Aug 2, 2016

Yep, confirmed that things build correctly now. Thanks!

@bzbarsky bzbarsky closed this Aug 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants
You can’t perform that action at this time.