Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 566186

Summary: net-misc/unison-2.48.3 failed to build on musl
Product: Gentoo Linux Reporter: Justin Keogh <bugs.gentoo.org>
Component: Current packagesAssignee: Gentoo musl team <musl>
Status: RESOLVED TEST-REQUEST    
Severity: normal CC: gentoo, maintainer-needed, ml, sam
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=578224
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: net-misc/unison-2.48.3 build.log
musl fix for unison-2.48.3.ebuild
musl fix for unison-2.48.3.ebuild
c stub used by Makefile.OCaml to test for <sys/inotify.h>
add <sys/inotify.h> test to Makefile.OCaml
generalize check for <sys/inotify.h> in fsmonitor/linux/inotify_stubs.c

Description Justin Keogh 2015-11-19 09:18:56 UTC
Created attachment 417332 [details]
net-misc/unison-2.48.3 build.log

$ emerge unison -pv
[ebuild  N    ~] net-misc/unison-2.48.3  USE="ocamlopt threads -debug -doc -gtk -static {-test}" 

$ emerge unison
...
/var/tmp/portage/net-misc/unison-2.48.3/work/unison-2.48.3/fsmonitor/linux/inotify_stubs.c:41:28: fatal error: inotify_compat.h: No such file or directory
 #include "inotify_compat.h"
                            ^
compilation terminated.
Makefile.OCaml:438: recipe for target 'fsmonitor/linux/inotify_stubs.o' failed
make: *** [fsmonitor/linux/inotify_stubs.o] Error 2
 * ERROR: net-misc/unison-2.48.3::gentoo failed (compile phase):
 *   emake failed


Bug originally noted here: http://lists.seas.upenn.edu/pipermail/unison-hackers/2013-October/001676.html

inotify-nosys.h is in sys-fs/inotify-tools, so I patched:

--- a/unison-2.48.3/work/unison-2.48.3/fsmonitor/linux/inotify_stubs.c  2015-11-19 04:47:22.981619219 +0000
+++ b/unison-2.48.3/work/unison-2.48.3/fsmonitor/linux/inotify_stubs.c  2015-11-19 04:47:36.966618842 +0000
@@ -38,7 +38,7 @@
 #if GLIBC_SUPPORT_INOTIFY
 #include <sys/inotify.h>
 #else
-#include "inotify_compat.h"
+#include <inotifytools/inotify_nosys.h>
 #endif

and:
--- a/unison-2.48.3/Makefile.OCaml      2015-11-19 05:02:40.105594518 +0000
+++ b/unison-2.48.3/Makefile.OCaml      2015-11-19 05:03:21.845593394 +0000
@@ -315,7 +315,7 @@
 -include fsmonitor/windows/Makefile src/fsmonitor/windows/Makefile
 endif
 
-INCLFLAGS+=-I fsmonitor -I fsmonitor/linux -I fsmonitor/windows
+INCLFLAGS+=-I fsmonitor -I fsmonitor/linux -I fsmonitor/windows -I inotifytools
 
 ####################################################################
 ### Static build setup

but that's wrong because the error:
/var/tmp/portage/net-misc/unison-2.48.3/work/unison-2.48.3/fsmonitor/linux/inotify_stubs.c:41:40: fatal error: inotifytools/inotify_nosys.h: No such file or directory

still happens.
Comment 1 Felix Janda 2015-11-19 13:02:07 UTC
musl has <sys/inotify.h>. Can't that be used?
Comment 2 Justin Keogh 2015-11-20 08:08:02 UTC
Created attachment 417432 [details]
musl fix for unison-2.48.3.ebuild
Comment 3 Justin Keogh 2015-11-20 08:11:21 UTC
Created attachment 417434 [details, diff]
musl fix for unison-2.48.3.ebuild
Comment 4 Justin Keogh 2015-11-20 08:12:42 UTC
Created attachment 417436 [details]
c stub used by Makefile.OCaml to test for <sys/inotify.h>
Comment 5 Justin Keogh 2015-11-20 08:16:29 UTC
Created attachment 417438 [details, diff]
add <sys/inotify.h> test to Makefile.OCaml

(ht to skarnet)
Comment 6 Justin Keogh 2015-11-20 08:19:28 UTC
Created attachment 417440 [details, diff]
generalize check for <sys/inotify.h> in fsmonitor/linux/inotify_stubs.c
Comment 7 Justin Keogh 2015-11-20 08:24:35 UTC
Right, musl's <sys/inotify.h> works. I tried to make the fix as general and correct as possible, feedback appreciated. I prob don't need to set a var to run the shell commands in Makefile.OCaml, and I'm not sure if src_prepare() is proper, but it works.

I also noticed it fails with >-j10 (every time), I'll file another bug for that.
Comment 8 PetaMem R&D 2016-01-29 20:24:59 UTC
(In reply to Justin Keogh from comment #7)
> I also noticed it fails with >-j10 (every time), I'll file another bug for
> that.

Please do. I was lucky to read this comment as I had -j20 and unison never built.
MAKEOPTS="-j4" emerge unison and it works.