[openal] Compiling examples on Mac OS X (SDL2 error)

Chris Robinson chris.kcat at gmail.com
Mon Dec 22 23:22:32 EST 2014

On 12/21/2014 05:41 PM, Adriano Melo wrote:
> Hello guys,
> I found a problem when compiling openal to Mac OS X. I was searching for
> the examples and decided to compile openal from the source to get them. I
> got a problem to compile some examples that were using SDL2.
> /usr/bin/cc  -std=c99  -O2 -g -D_DEBUG -Wl,-search_paths_first
> -Wl,-headerpad_max_install_names
> CMakeFiles/allatency.dir/examples/allatency.c.o  -o allatency
> libex-common.a /opt/local/lib/libSDL_sound.dylib */opt/local/lib/libSDL2main.a
> /opt/local/lib/libSDL2.dylib* -framework Cocoa libopenal.1.16.0.dylib
> libcommon.a -framework AudioToolbox -framework ApplicationServices
> -framework AudioUnit -framework CoreAudio -lpthread -ldl -lm -pthread
> clang: warning: argument unused during compilation: '-pthread'
> Undefined symbols for architecture x86_64:
>    "_main", referenced from:
>       implicit entry/start for main executable
>       (maybe you meant: _SDL_main)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)

Hmm, it looks like SDL2main has a problem providing main().

I'm actually wondering what to do with the examples because, at least on 
my distro, SDL_sound is not playing nice with SDL2. SDL_sound won't 
recognize supported file formats. I presume it's because SDL_sound is 
hard-linked against SDL(1), but having SDL2 linked in the same process 
is causing a conflict. SDL2, however, is needed for the alffplay 
example, and it seems weird to have some examples use SDL1 and others 
use SDL2.

More information about the openal mailing list