Created attachment 185838 [details]
mpv build log
mpv fails to build with ZSH option enabled. This seems to be the culprit (full log attached): I've looked at zsh.pl, and there's a die() in there at line 30 if `--list-options` returns empty, but I didn't look beyond that.
> [449/449] Compiling TOOLS/zsh.pl
> 22:46:08 runner ' "/usr/local/bin/perl" "/wrkdirs/usr/ports/multimedia/mpv/work/mpv-0.26.0/TOOLS/zsh.pl" "/wrkdirs/usr/ports/multimedia/mpv/work/mpv-0.26.0/build/mpv" > "etc/_mpv" '
> Couldn't find any options at /wrkdirs/usr/ports/multimedia/mpv/work/mpv-0.26.0/TOOLS/zsh.pl line 30.
Building with MAKE_JOBS_UNSAFE=yes yields the same result.
Yes, the following commit introduced the issue:
I guess that commit exposed a deeper issue. I'm not familiar with ZSH completion to be able to dig into this.
What do you recommend be done? Patch that out, or mark the port broken when ZSH=on for now?
(In reply to Vladimir Krstulja from comment #2)
I recommend to disable ZSH option while the issue is fixed.
FYI this bug has been reported upstream.
Created attachment 185940 [details]
gdb backtrace of dumped mpv.core
Upon further inspection, `mpv --list-options` is failing with
> Illegal instruction (core dumped)
when I run it in the Poudriere builder jail provided with `poudriere testport -i`, when built without ZSH=on.
I've attached gdb output run on dumped core.
I don't know what could be causing this. The build server is a sandybridge Xeon, and I've tried removing the CPUTYPE completely (see build log), dropped ccache, and rebuilt the entire repository over again, still fails.
I suppose it doesn't like something about that build environment. Maybe it requires full X + OpenGL + ... suite be available and running?
Is this a cross compile (i.e. you're not planning to run it on the machine thats compiling it)? Generating zsh completion doesn't generally work in that case since it requires running the compiled program. This isn't optimal anyway and I've got an idea of fixing it, but in the mean time you can run TOOLS/zsh.pl on the target machine and write its output to /usr/share/zsh/site-functions/_mpv or /usr/local/share/zsh/site-functions/_mpv, depending on where you have zsh installed.
If, on the other hand, you get the illegal instruction message even on the target machine, then this problem isn't related to the zsh completion at all. It looks like the crashing code isn't actually mpv's. You said you recompiled mpv for generic CPU, but did you rebuild all its dependencies the same way? That would be necessary if compiler flags were the problem. (But again, if you're compiling for another machine, it isn't worth that trouble; just use the workaround of manually generating the completion on the target machine for now. There's a decent chance the next release of mpv won't need to run the compiled executable on the build machine for zsh completion.)
(In reply to Philip Sequeira from comment #5)
The build server (sandybridge) is not the same machine, but they're all amd64. On the target machine (haswell) mpv runs fine.
I've rebuilt the entire poudriere repo anew after removing CPUTYPE and dropping ccache.
I actually don't plan to use ZSH. I missed to disable it the first time and then found this problem. Even so, regardless of stopgap solutions, this must build in poudriere.
(In reply to Vladimir Krstulja from comment #6)
Okay, I'm not sure what part of your build process is still targeting Haswell, but that's not really an mpv issue, and in general you want your build to target Haswell anyway, right?
The way we currently generate ZSH completion is known to be incompatible with cross-compilation, which is actually why it's disabled by default upstream, IIRC. I hope to change that soon, at which point it should build in poudriere as well as it does now without that feature. If you aren't even using ZSH, just disable the feature for the time being.
A commit references this bug:
Date: Wed Sep 13 13:35:58 UTC 2017
New revision: 449784
multimedia/mpv: update to 0.27.0
- Remove patch (added upstream)
- Disable ZSH completion option for the time being. The way we currently generate
ZSH completion is known to be incompatible with cross-compilation, which is
actually why it's disabled by default upstream 
PR: 221876 
Reported by: Vladimir Krstulja <firstname.lastname@example.org>
Thanks for your help, Philip!
I do feel inclined to point out that this particular case that hit me is not cross compilation, like I've mentioned several times. As far as that poudriere box is concerned, it builds for local use on that machine.
This patch completely disables ZSH (instead of marking it broken conditionally), even though it builds fine on a newer (amd64) CPU. At least have an UPDATING entry so you don't silently pull the rug from under systems where it builds and runs fine.