[uae] Re: How is the Mac OS X binary built?

  • From: Richard Drummond <evilrich@xxxxxxxxxxxxxx>
  • To: uae@xxxxxxxxxxxxx
  • Date: Mon, 10 May 2004 14:43:12 -0500

Hi Byron

On Sunday 09 May 2004 11:20 pm, Byron Q. Desnoyers Winmill wrote:
> After adding the filesystem option to my .uaerc file, the binaries
> I build generate a bus error.  This problem is not evident in the
> official binary (I'm using uae-0.8.25-20040302-osx-sdl.zip).  It
> would be nice to build my own functional binaries for two reasons:
> X is faster than SDL under Mac OS X, and I like avoiding too many
> dependencies (ie. gtk+ and libsdl).

The problem is with pthreads under OS X. Semaphores don't work when UAE is 
built for OS X using pthreads. I never had the time to track down what 
exactly is causing the problem - either semaphores in the OS X implementation 
of pthreads are broken, or are subtly different in some way from POSIX 
semaphores.

> The problem appears to be in the filesys_thread().
> The bus error is generated when the following line is called:
>   put_long (get_long (morelocks), get_long (ui->self->locklist));
> I have established that morelocks = 0, immediately after the call:
>   morelocks = (uae_u32)read_comm_pipe_int_blocking (ui->unit_pipe);
> This is what it would return if td-none/thread.h was included,
> though there may be other circumstances when this would happen
> (because I really don't understand what is going on here :).

The pipe stuff in UAE is for IPC. It implements a primitive kind of 
message-passing between threads. Of course, this requires semaphores for 
mutual exclusion. 

> I've tried building with a plain "./configure" and a ever so slightly
> less plain "./configure --disable-threads".  The same chunk of code
> is being called in both cases (it doesn't look like it should be,
> if I believe the #ifdef).  Of course, gtk+ and sdl aren't detected
> because they don't exist (well, the libraries for the latter are
> there -- but not the headers).

Threads are currently needed for the hard-drive emulation. In theory, they 
shouldn't be. The virtual filesystem can be built not to use threads. 
However, the hard file stuff does require threads - and it's currently not 
possible to have the former without the latter. I've been meaning to sort 
that out, primarily for this very reason - so that you can build in 
hard-drive emulation without using threads.

In summary, the easy answer to your problem is either to build against SDL on 
OS X or don't build hard-drive emulation. For a proper solution, we need to 
find out what's going wrong with pthreads in OS X and/or to allow the 
building of virtual filesystem emulation without hard file emulation (or 
re-work the hardfile emulation so that it'll also work without threads).

Cheers,
Rich

Other related posts: