What files are used in Macos 9.x for mutex,sem

If the mac platform (os9) uses the generic/mutex and generic/sem code,
then the mutex used by both the event and audio routines seem to be no-ops
and therefore not sufficient to protect agains corruption (at least of the
internal event Q for events, and in programs using SDL_[Un]LockAudio for
protecting application data structures).

My going theory is that nothing prevents corruption (in SDL_PeepEvent for
example) if, for example, SDL_PushEvent is called from timer or audio
callback, and it happens to be ‘concurrent’ to SDL_PeepEvent or whatever
from the ‘main’ thread.

Is this correct?

David–
David Mansfield (718) 963-2020
@david_at_ultramaster
Ultramaster Group, LLC www.ultramaster.com

If the mac platform (os9) uses the generic/mutex and generic/sem code,
then the mutex used by both the event and audio routines seem to be no-ops
and therefore not sufficient to protect agains corruption (at least of the
internal event Q for events, and in programs using SDL_[Un]LockAudio for
protecting application data structures).

My going theory is that nothing prevents corruption (in SDL_PeepEvent for
example) if, for example, SDL_PushEvent is called from timer or audio
callback, and it happens to be ‘concurrent’ to SDL_PeepEvent or whatever
from the ‘main’ thread.

it looks that way yes - we should either add a warning that it is not safe to
call PushEvent from an audio/timer callback or introduce the necessary
blocking. Same goes with unix async signals — PushEvent is thread-safe
but not async-signal-safe; this is easy to fix but I want to see a clear
need before adding two syscalls to every event queue operator

I am trying to build my program with cygwin.
The program uses SDL and SDL_image. I have
not managed to build SDL_image library,
because it complains about:

gcc -Wl,–base-file,.libs/SDL_image.dll-base -Wl,–dll -nostartfiles
-Wl,-e,_DllMain at 12 -o .libs/SDL_image.dll .libs/SD
L_image.dll-ltdll.o IMG.o IMG_bmp.o IMG_gif.o IMG_jpg.o IMG_pcx.o
IMG_png.o IMG_pnm.o IMG_tga.o IMG_tif.o IMG_xcf.o IMG
_xpm.o -L/usr/local/lib -lSDLmain -lSDL -lz -lSDLmain -lSDL
IMG_jpg.o: In function jpeg_SDL_RW_src': /home/tksuoran/SDL_image-1.2.0/IMG_jpg.c:167: undefined reference to_imp__jpeg_resync_to_restart’
IMG_jpg.o: In function IMG_LoadJPG_RW': /home/tksuoran/SDL_image-1.2.0/IMG_jpg.c:183: undefined reference to_imp__jpeg_std_error’
/home/tksuoran/SDL_image-1.2.0/IMG_jpg.c:184: undefined reference to
`_imp__jpeg_CreateDecompress’

etc…

Before that, I get:

(cd . && ln -s IMG_xpm.o IMG_xpm.lo)
/bin/sh ./libtool --mode=link gcc -g -O2 -I/usr/local/include
-I/usr/local/include/SDL -Dmain=SDL_main -I/usr/include/m
ingw -DWIN32 -Uunix -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_PCX -DLOAD_PNG
-DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -o libSDL_i
mage.la -rpath /usr/local/lib -release 1.2 -version-info
0:0:0 IMG.lo IMG_bmp.lo IMG_gif.lo IMG_jpg.lo IMG_
pcx.lo IMG_png.lo IMG_pnm.lo IMG_tga.lo IMG_tif.lo IMG_xcf.lo IMG_xpm.lo
-L/usr/local/lib -lmingw32 -lSDLmain -lSDL -mwi
ndows -mno-cygwin -ljpeg -lpng -lz -L/usr/local/lib -lmingw32 -lSDLmain
-lSDL -mwindows -mno-cygwin
rm -fr .libs/libSDL_image.la .libs/libSDL_image.* .libs/libSDL_image-1.2.*

*** Warning: This library needs some functionality provided by -lmingw32.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: This library needs some functionality provided by -ljpeg.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: This library needs some functionality provided by -lpng.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

I have built libjpeg, libpgn and zlib from their latest original sources.
Any suggestions what is wrong?

– Timo Suoranta – @Timo_K_Suoranta

It sounds like when you built the jpeg and png libraries you only built
static libs and not shared ones. Shared libraries end in .so (at least under
linux). Check to make sure that dynamic libraries were built.> ----- Original Message -----

From: tksuoran@cc.helsinki.fi (Timo K Suoranta)
To:
Sent: Friday, July 06, 2001 6:18 AM
Subject: [SDL] SDL_image with cygwin

I am trying to build my program with cygwin.
The program uses SDL and SDL_image. I have
not managed to build SDL_image library,
because it complains about:

gcc -Wl,–base-file,.libs/SDL_image.dll-base -Wl,–dll -nostartfiles
-Wl,-e,_DllMain at 12 -o .libs/SDL_image.dll .libs/SD
L_image.dll-ltdll.o IMG.o IMG_bmp.o IMG_gif.o IMG_jpg.o IMG_pcx.o
IMG_png.o IMG_pnm.o IMG_tga.o IMG_tif.o IMG_xcf.o IMG
_xpm.o -L/usr/local/lib -lSDLmain -lSDL -lz -lSDLmain -lSDL
IMG_jpg.o: In function jpeg_SDL_RW_src': /home/tksuoran/SDL_image-1.2.0/IMG_jpg.c:167: undefined reference to_imp__jpeg_resync_to_restart’
IMG_jpg.o: In function IMG_LoadJPG_RW': /home/tksuoran/SDL_image-1.2.0/IMG_jpg.c:183: undefined reference to_imp__jpeg_std_error’
/home/tksuoran/SDL_image-1.2.0/IMG_jpg.c:184: undefined reference to
`_imp__jpeg_CreateDecompress’

etc…

Before that, I get:

(cd . && ln -s IMG_xpm.o IMG_xpm.lo)
/bin/sh ./libtool --mode=link gcc -g -O2 -I/usr/local/include
-I/usr/local/include/SDL -Dmain=SDL_main -I/usr/include/m
ingw -DWIN32 -Uunix -DLOAD_BMP -DLOAD_GIF -DLOAD_JPG -DLOAD_PCX -DLOAD_PNG
-DLOAD_PNM -DLOAD_TGA -DLOAD_XPM -o libSDL_i
mage.la -rpath /usr/local/lib -release 1.2 -version-info
0:0:0 IMG.lo IMG_bmp.lo IMG_gif.lo IMG_jpg.lo IMG_
pcx.lo IMG_png.lo IMG_pnm.lo IMG_tga.lo IMG_tif.lo IMG_xcf.lo IMG_xpm.lo
-L/usr/local/lib -lmingw32 -lSDLmain -lSDL -mwi
ndows -mno-cygwin -ljpeg -lpng -lz -L/usr/local/lib -lmingw32 -lSDLmain
-lSDL -mwindows -mno-cygwin
rm -fr .libs/libSDL_image.la .libs/libSDL_image.* .libs/libSDL_image-1.2.*

*** Warning: This library needs some functionality provided by -lmingw32.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: This library needs some functionality provided by -ljpeg.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

*** Warning: This library needs some functionality provided by -lpng.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.

I have built libjpeg, libpgn and zlib from their latest original sources.
Any suggestions what is wrong?

– Timo Suoranta – tksuoran at cc.helsinki.fi

It sounds like when you built the jpeg and png libraries you only built
static libs and not shared ones. Shared libraries end in .so (at least under
linux). Check to make sure that dynamic libraries were built.

How do I do that? This is what happens when I make zlib for example.
And I certainly can’t find anything about shared libraries, it all
looks like static link libraries… :

tksuoran at HYLKYKARI ~
$ cd zlib

tksuoran at HYLKYKARI ~/zlib
$ make clean
rm -f *.o ~ example minigzip libz.a libz.so foo.gz so_locations
_match.s maketree

tksuoran at HYLKYKARI ~/zlib
$ ./configure
Checking for gcc…
Building static library libz.a version 1.1.3 with gcc.
Checking for unistd.h… Yes.
Checking for errno.h… Yes.
Checking for mmap support… Yes.

tksuoran at HYLKYKARI ~/zlib
$ make
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o example.o example.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o adler32.o adler32.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o compress.o compress.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o crc32.o crc32.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o gzio.o gzio.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o uncompr.o uncompr.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o deflate.o deflate.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o trees.o trees.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o zutil.o zutil.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o inflate.o inflate.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o infblock.o infblock.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o inftrees.o inftrees.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o infcodes.o infcodes.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o infutil.o infutil.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o inffast.o inffast.c
ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o
trees.o zutil.o inflate.o infblock.o inftrees.o inf
codes.o infutil.o inffast.o
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -o example example.o -L. -lz
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o minigzip.o minigzip.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -o minigzip minigzip.o -L. -lz

tksuoran at HYLKYKARI ~/zlib
$ make install
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
cp libz.a /usr/local/lib
cd /usr/local/lib; chmod 755 libz.a
cd /usr/local/lib; if test -f libz.so.1.1.3; then
rm -f libz.so libz.so.1;
ln -s libz.so.1.1.3 libz.so;
ln -s libz.so.1.1.3 libz.so.1;
(ldconfig || true) >/dev/null 2>&1;
fi

tksuoran at HYLKYKARI ~/zlib
$

It simply looks like zlib doesnt know how to make shared library with
Cygwin. I sneaked into the Makefile, and after getting a hint, I tried:

tksuoran at HYLKYKARI ~/zlib
$ make libz.so.1.1.3
gcc -o libz.so.1.1.3 adler32.o compress.o crc32.o gzio.o uncompr.o
deflate.o trees.o zutil.o inflate.o infblock.o inftre
es.o infcodes.o infutil.o inffast.o
/usr/lib/libcygwin.a(libcmain.o)(.text+0x6a):libcmain.c: undefined
reference to `WinMain at 16’
collect2: ld returned 1 exit status
make: *** [libz.so.1.1.3] Error 1

tksuoran at HYLKYKARI ~/zlib
$

– Timo Suoranta – @Timo_K_Suoranta

Well, under linux (and again I assume this is similar under windows…)
there is usually a configure script that you run first to setup the build.
try typing ./configure --help in the root source directory of the
library. If there is no configure script there should be a way to enable
shared libraries by editing the Makefile. Check the README/INSTALL text
files in the source.On Sat, 7 Jul 2001, Timo K Suoranta wrote:

It sounds like when you built the jpeg and png libraries you only built
static libs and not shared ones. Shared libraries end in .so (at least under
linux). Check to make sure that dynamic libraries were built.

How do I do that? This is what happens when I make zlib for example.
And I certainly can’t find anything about shared libraries, it all
looks like static link libraries… :

tksuoran at HYLKYKARI ~
$ cd zlib

tksuoran at HYLKYKARI ~/zlib
$ make clean
rm -f *.o ~ example minigzip libz.a libz.so foo.gz so_locations
_match.s maketree

tksuoran at HYLKYKARI ~/zlib
$ ./configure
Checking for gcc…
Building static library libz.a version 1.1.3 with gcc.
Checking for unistd.h… Yes.
Checking for errno.h… Yes.
Checking for mmap support… Yes.

tksuoran at HYLKYKARI ~/zlib
$ make
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o example.o example.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o adler32.o adler32.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o compress.o compress.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o crc32.o crc32.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o gzio.o gzio.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o uncompr.o uncompr.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o deflate.o deflate.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o trees.o trees.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o zutil.o zutil.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o inflate.o inflate.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o infblock.o infblock.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o inftrees.o inftrees.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o infcodes.o infcodes.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o infutil.o infutil.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o inffast.o inffast.c
ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o
trees.o zutil.o inflate.o infblock.o inftrees.o inf
codes.o infutil.o inffast.o
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -o example example.o -L. -lz
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -c -o minigzip.o minigzip.c
gcc -O3 -DHAVE_UNISTD_H -DUSE_MMAP -o minigzip minigzip.o -L. -lz

tksuoran at HYLKYKARI ~/zlib
$ make install
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
cp libz.a /usr/local/lib
cd /usr/local/lib; chmod 755 libz.a
cd /usr/local/lib; if test -f libz.so.1.1.3; then
rm -f libz.so libz.so.1;
ln -s libz.so.1.1.3 libz.so;
ln -s libz.so.1.1.3 libz.so.1;
(ldconfig || true) >/dev/null 2>&1;
fi

tksuoran at HYLKYKARI ~/zlib
$

It simply looks like zlib doesnt know how to make shared library with
Cygwin. I sneaked into the Makefile, and after getting a hint, I tried:

tksuoran at HYLKYKARI ~/zlib
$ make libz.so.1.1.3
gcc -o libz.so.1.1.3 adler32.o compress.o crc32.o gzio.o uncompr.o
deflate.o trees.o zutil.o inflate.o infblock.o inftre
es.o infcodes.o infutil.o inffast.o
/usr/lib/libcygwin.a(libcmain.o)(.text+0x6a):libcmain.c: undefined
reference to `WinMain at 16’
collect2: ld returned 1 exit status
make: *** [libz.so.1.1.3] Error 1

tksuoran at HYLKYKARI ~/zlib
$

– Timo Suoranta – tksuoran at cc.helsinki.fi

Well, under linux (and again I assume this is similar under windows…)
there is usually a configure script that you run first to setup the build.

Yes, I know about configure scripts, as I use aclocal and autoconf myself.
Problem is that zlib for example does not. It has custom script, called
configure, but it is not made by autoconf, and it does not know anything
about cygwin or how to make shared libraries with it.

Anyone familiar with making shared libraries with cygwin?

I really would like someone to fix zlib such that it woulc have real
autoconf support, and it would know how to make shared libraries in
cygwin, too.

It appears to be that zlib can make shared libraries through
configure -s, but it doesn’t know how to do that on cygwin :confused:

– Timo Suoranta – @Timo_K_Suoranta