On macOS 10.12 it doesn't build:

Undefined symbols for architecture x86_64:
  "___vprocmgr_move_subset_to_user", referenced from:
      _daemon$1050 in daemon.o

>From macOS 10.10 that symbol isn't defined anymore, reference code on how
to do it on 10.10 and later
https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/move_to_user_namespace.c#L42
Oh and I think #elifdef isn't supported by clang.

-- 
Enrico Ghirardi

On 6 June 2017 at 00:19:10, Nicholas Marriott ([email protected])
wrote:

Someone on OS X 10.5 or above able to build tmux from Git with this and
tell me if:

a) it compiles without any new warnings;

b) tmux still runs;

c) it allows them to get rid of reattach-to-user-namespace.


diff --git a/compat/daemon.c b/compat/daemon.c
index 678d78ef..ddeff02f 100644
--- a/compat/daemon.c
+++ b/compat/daemon.c
@@ -28,8 +28,15 @@
* SUCH DAMAGE.
*/

+#include <sys/types.h>
+
+#ifdef __APPLE__
+#include <Availability.h>
+#endif
+
#include <fcntl.h>
#include <unistd.h>
+#include <stdint.h>
#include <stdlib.h>

#include "compat.h"
@@ -61,5 +68,13 @@ daemon(int nochdir, int noclose)
if (fd > 2)
(void)close (fd);
}
+
+#ifdef __MAC_10_6 /* and above */
+ extern void *_vprocmgr_move_subset_to_user(uid_t, const char *,
uint64_t);
+ __vprocmgr_move_subset_to_user(getuid(), "Background", 0);
+#elifdef __MAC_10_5
+ extern void *_vprocmgr_move_subset_to_user(uid_t, const char *);
+ __vprocmgr_move_subset_to_user(getuid(), "Background");
+#endif
return (0);
}
diff --git a/configure.ac b/configure.ac
index dcf62ab9..45701b95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -569,8 +569,14 @@ case "$host_os" in
;;
*darwin*)
AC_MSG_RESULT(darwin)
- AC_DEFINE(BROKEN_CMSG_FIRSTHDR)
PLATFORM=darwin
+ #
+ # OS X CMSG_FIRSTHDR is broken, so redefine it with a working
+ # one. daemon works but has some stupid side effects, so use
+ # our internal version which has a workaround.
+ #
+ AC_DEFINE(BROKEN_CMSG_FIRSTHDR)
+ AC_LIBOBJ(daemon)
;;
*dragonfly*)
AC_MSG_RESULT(dragonfly)

-- 
You received this message because you are subscribed to the Google Groups
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to