I believe this can be fixed by including xlocale.h in stream_libarchive.h. The build succeeded on my machine when both locale.h and xlocale.h were included. I do not know if this will affect other platforms.
MPV: after 1e70e82baa9193f6f027338b0fab0f5078971fbe (the one with the epic commit comment...)
Platform: Mac 10.13.1
Build
Succeed
Fail
[ 60/445] Compiling stream/stream_libarchive.c
In file included from ../stream/stream_libarchive.c:25:
../stream/stream_libarchive.h:7:5: error: unknown type name 'locale_t'
locale_t locale;
^
../stream/stream_libarchive.c:154:9: error: implicit declaration of function 'freelocale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
freelocale(mpa->locale);
^
../stream/stream_libarchive.c:154:9: note: did you mean 'setlocale'?
/usr/include/locale.h:53:8: note: 'setlocale' declared here
char *setlocale(int, const char *);
^
../stream/stream_libarchive.c:154:9: warning: this function declaration is not a prototype [-Wstrict-prototypes]
freelocale(mpa->locale);
^
../stream/stream_libarchive.c:234:5: error: use of undeclared identifier 'locale_t'
locale_t oldlocale = uselocale(mpa->locale);
^
../stream/stream_libarchive.c:236:5: error: implicit declaration of function 'uselocale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
uselocale(oldlocale);
^
../stream/stream_libarchive.c:236:5: note: did you mean 'setlocale'?
/usr/include/locale.h:53:8: note: 'setlocale' declared here
char *setlocale(int, const char *);
^
../stream/stream_libarchive.c:236:5: warning: this function declaration is not a prototype [-Wstrict-prototypes]
uselocale(oldlocale);
^
../stream/stream_libarchive.c:236:15: error: use of undeclared identifier 'oldlocale'
uselocale(oldlocale);
^
../stream/stream_libarchive.c:245:19: error: implicit declaration of function 'newlocale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
mpa->locale = newlocale(LC_ALL_MASK, "C.UTF-8", (locale_t)0);
^
../stream/stream_libarchive.c:245:19: note: did you mean 'setlocale'?
/usr/include/locale.h:53:8: note: 'setlocale' declared here
char *setlocale(int, const char *);
^
../stream/stream_libarchive.c:245:19: warning: this function declaration is not a prototype [-Wstrict-prototypes]
mpa->locale = newlocale(LC_ALL_MASK, "C.UTF-8", (locale_t)0);
^
../stream/stream_libarchive.c:245:54: error: use of undeclared identifier 'locale_t'
mpa->locale = newlocale(LC_ALL_MASK, "C.UTF-8", (locale_t)0);
^
../stream/stream_libarchive.c:245:29: error: use of undeclared identifier 'LC_ALL_MASK'
mpa->locale = newlocale(LC_ALL_MASK, "C.UTF-8", (locale_t)0);
^
../stream/stream_libarchive.c:267:5: error: use of undeclared identifier 'locale_t'
locale_t oldlocale = uselocale(mpa->locale);
^
../stream/stream_libarchive.c:290:15: error: use of undeclared identifier 'oldlocale'
uselocale(oldlocale);
^
../stream/stream_libarchive.c:312:5: error: use of undeclared identifier 'locale_t'
locale_t oldlocale = uselocale(mpa->locale);
^
../stream/stream_libarchive.c:343:15: error: use of undeclared identifier 'oldlocale'
uselocale(oldlocale);
^
../stream/stream_libarchive.c:367:13: error: use of undeclared identifier 'locale_t'
locale_t oldlocale = uselocale(mpa->locale);
^
../stream/stream_libarchive.c:371:23: error: use of undeclared identifier 'oldlocale'
uselocale(oldlocale);
^
../stream/stream_libarchive.c:387:5: error: use of undeclared identifier 'locale_t'
locale_t oldlocale = uselocale(p->mpa->locale);
^
../stream/stream_libarchive.c:396:15: error: use of undeclared identifier 'oldlocale'
uselocale(oldlocale);
^
../stream/stream_libarchive.c:405:5: error: use of undeclared identifier 'locale_t'
locale_t oldlocale = uselocale(p->mpa->locale);
^
../stream/stream_libarchive.c:407:15: error: use of undeclared identifier 'oldlocale'
uselocale(oldlocale);
^
../stream/stream_libarchive.c:433:13: error: use of undeclared identifier 'oldlocale'
oldlocale = uselocale(p->mpa->locale);
^
Use a real OS.
#ifdef __APPLE__
# include <string.h>
# include <xlocale.h>
#endif
hth
Use a real OS.
lmao like what
@haasn Thanks :)
For anyone else having trouble building mpv --HEAD (via homebrew), maybe I can help. The tasks being addressed here are:
I'm accomplishing this by patching the homebrew formulas for mpv and ffmpeg as follows:
diff --git a/Formula/ffmpeg.rb b/Formula/ffmpeg.rb
index 5ee917f0..13fad092 100644
--- a/Formula/ffmpeg.rb
+++ b/Formula/ffmpeg.rb
@@ -3,7 +3,7 @@ class Ffmpeg < Formula
homepage "https://ffmpeg.org/"
url "https://ffmpeg.org/releases/ffmpeg-3.4.tar.bz2"
sha256 "5d8911fe6017d00c98a359d7c8e7818e48f2c0cc2c9086a986ea8cb4d478c85e"
- head "https://github.com/FFmpeg/FFmpeg.git"
+ head "https://github.com/mpv-player/ffmpeg-mpv.git"
bottle do
sha256 "1807e00fdfc308feaa78924e0b6991b26e6f37ea379ac82b78dca038a0f67a7b" => :high_sierra
diff --git a/Formula/mpv.rb b/Formula/mpv.rb
index c557288a..af34525b 100644
--- a/Formula/mpv.rb
+++ b/Formula/mpv.rb
@@ -12,6 +12,14 @@ class Mpv < Formula
sha256 "ffbd72e37a328a5c6d5779746c9e6462b3f6d260f365bd922716a16ad3f3cd8a" => :el_capitan
end
+ head do
+ patch do
+ # patch for https://github.com/mpv-player/mpv/issues/5108
+ url "https://youbeill.in/scrap/note-VSiLBZQxn2.txt"
+ sha256 "972cd7301eb7783abb632a904168af5cf891dca5b42016cf96241b86a5231d92"
+ end
+ end
+
option "with-bundle", "Enable compilation of the .app bundle."
depends_on "pkg-config" => :build
To apply this patch:
cd $(brew --prefix)/Library/taps/homebrew/homebrew-core
curl -o mpv-ffmpeg.patch https://youbeill.in/scrap/note-PnAcVrJqbc.txt
patch -p1 < mpv-ffmpeg.patch
With these changes, you should be able to install ffmpeg --HEAD followed by mpv --HEAD. This 'works for me' for the revisions shown below.
h1ro% brew info ffmpeg | grep -B 1 'Built'
/opt/brew/Cellar/ffmpeg/HEAD-a1630b4 (284 files, 55.4MB) *
Built from source on 2017-11-24 at 21:50:39 with: --with-libvorbis --with-libssh --with-libcaca --with-libass --with-libvpx --with-openh264 --with-rtmpdump --with-rubberband --with-sdl2 --with-speex --with-tesseract --with-tools --with-x265 --with-zeromq --without-qtkit --without-securetransport --with-theora --with-opus --with-libsoxr --with-frei0r --with-chromaprint --with-fdk-aac --with-game-music-emu --with-openssl
h1ro%
h1ro% brew info mpv | grep -B 1 'Built'
/opt/brew/Cellar/mpv/HEAD-386e8cd_1 (26 files, 8.3MB) *
Built from source on 2017-11-24 at 22:12:43 with: --with-libaacs --with-libarchive --with-libcaca --with-rubberband --with-vapoursynth
Disclaimer: obviously this is a hacky workaround that comes with no warranty. The stream_libarchive.h patch seems pretty legit to me, but would likely need additional qualification, etc, before being upstreamed. The brew people are deciding what to do about the ffmpeg-mpv fork in this ticket: https://github.com/Homebrew/homebrew-core/issues/20104 (and it almost certainly won't be what I'm doing here, but I don't mind using the ffmpeg-mpv fork for all my ffmpeg use cases - a choice that is probably not supported by anybody.)
Most helpful comment
Use a real OS.