Mednafen Members Members   Search Search   Help Help   Register Register   Login Login   Home Home
Home » Mednafen » Development » 1.22.0-UNSTABLE doesn't build on Mac OS X
Show: Today's Messages  :: Show Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
1.22.0-UNSTABLE doesn't build on Mac OS X [message #5746] Sat, 05 January 2019 18:35 Go to next message
mistydemeo  [PM]
I've noticed a few issues with the threading code which currently prevents 1.22.0-UNSTABLE from building on Mac OS X. I've tested on 10.13.6 using clang as shipped with Xcode 9.1.

* Configure checks for pthread_setaffinity_np, which isn't available. That function is currently not actually used.

* MThreading_POSIX.cpp calls pthread_setname_np. This is documentd in the glibc manpages as being a nonstandard extension ("np" is for "non-POSIX", IIRC): http://man7.org/linux/man-pages/man3/pthread_setname_np.3.html Mac OS X provides a similar function by the same name that only supports one argument, and only sets the name for the current thread.

* MThreading_POSIX.cpp calls pthread_condattr_setclock, which isn't implemented in Mac OS X.

* MThreading_POSIX.cpp calls sem_timedwait, which isn't implemented on Mac OS X. Some advice I've seen mentions implementing it using sem_wait instead, e.g. https://github.com/attie/libxbee3/blob/master/xsys_darwin/sem_timedwait.c

[Updated on: Sat, 05 January 2019 20:51]

Re: 1.22.0-UNSTABLE doesn't build on Mac OS X [message #5747 is a reply to message #5746 ] Sat, 05 January 2019 19:14 Go to previous messageGo to next message
Administrator  [PM]
Does Apple provide free downloads of Mac OS X that will run on regular PC hardware for developers, so I can add and test OS X support properly?
Re: 1.22.0-UNSTABLE doesn't build on Mac OS X [message #5749 is a reply to message #5747 ] Sat, 05 January 2019 20:48 Go to previous messageGo to next message
mistydemeo  [PM]
There isn't, though I believe VirtualBox can virtualize it.

The Darwin man pages, which cover these kinds of functions, are online: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/pthread.3.html The Apple libc source is publicly available, and can be a useful reference for the headers and what functions are available: https://opensource.apple.com/source/Libc/Libc-1272.200.26/ https://opensource.apple.com/release/macos-10141.html
Re: 1.22.0-UNSTABLE doesn't build on Mac OS X [message #5751 is a reply to message #5749 ] Sun, 06 January 2019 02:27 Go to previous messageGo to next message
mistydemeo  [PM]
I've attached a patch which fixes the build for me on OS X. This restores the SDL threading class, but only uses it on OS X; it adjusts the configure script to also add a new `APPLE` if statement that can be used in the makefiles. This is a pretty minimal patch, but I think it does the job. A couple other alternatives I can think of are:


  • Make the POSIX class run on OS X. I'm not familiar enough with the POSIX pthread/semaphore functions to do it myself, and the lack of unnamed semaphore support might make that more difficult/messy.
  • Add a libdispatch or NSThread-based class. My understanding is that NSThread is Apple's preferred approach but I'm guessing that mixing ObjC calls into a C++ class could get pretty gnarly.

Re: 1.22.0-UNSTABLE doesn't build on Mac OS X [message #5772 is a reply to message #5751 ] Mon, 28 January 2019 11:24 Go to previous messageGo to next message
Administrator  [PM]
Does 1.22.1 compile now at least? There are still a couple of issues(waiting too long if there's spurious wakeups, and returning with error if interrupted by a signal) with the new alternative WaitSemTimeout() that I probably ought to fix, though they shouldn't cause any major problems considering the current limited uses of WaitSemTimeout() in the codebase.
Re: 1.22.0-UNSTABLE doesn't build on Mac OS X [message #5776 is a reply to message #5772 ] Wed, 30 January 2019 10:58 Go to previous message
mistydemeo  [PM]
Can confirm it builds and runs! Thank you!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic:OpenBSD audio driver
Next Topic:mednafen server for windows
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ ]

Current Time: Sat May 4 21:38:56 CDT 2024
.:: Contact :: Home ::.

Powered by FUDforum.
Copyright © FUDforum Bulletin Board Software