Building SDL_mixer on OS X is hopeless

I tried a few weeks ago, and gave up. Today I gave it a go again. This
is my configure line (I’m trying to build a 32-bit static library):

./configure --disable-shared --prefix="$HOME/opt/intel"
–with-sdl-prefix="$HOME/opt/intel" CFLAGS="-arch i386" CXXFLAGS="-arch
i386" LDFLAGS="-arch i386"

It won’t build. I get the below error. If anyone knows what’s going
on, please help. I’m pulling my hair for a month now.

libtool: link: gcc -o build/playwave build/playwave.o
-I/Users/realnc/opt/intel/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE
-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,ApplicationServices
-Wl,-framework -Wl,Carbon -Wl,-framework -Wl,AudioToolbox -Wl,-framework
-Wl,AudioUnit -Wl,-framework -Wl,IOKit -L/Users/realnc/opt/intel/lib
/Users/realnc/opt/intel/lib/libSDLmain.a
/Users/realnc/opt/intel/lib/libSDL.a build/.libs/libSDL_mixer.a -lm
ld: warning: in build/playwave.o, file was built for i386 which is not
the architecture being linked (x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/libSDLmain.a, file was built
for unsupported file format which is not the architecture being linked
(x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/libSDL.a, file was built for
unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in build/.libs/libSDL_mixer.a, file was built for
unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found

add “-m32” to CFLAGS and LDFLAGS

PatrickOn Wed, Jun 29, 2011 at 10:23 AM, Nikos Chantziaras wrote:

I tried a few weeks ago, and gave up. Today I gave it a go again. This is
my configure line (I’m trying to build a 32-bit static library):

./configure --disable-shared --prefix="$HOME/opt/intel"
–with-sdl-prefix="$HOME/opt/**intel" CFLAGS="-arch i386" CXXFLAGS="-arch
i386" LDFLAGS="-arch i386"

It won’t build. I get the below error. If anyone knows what’s going on,
please help. I’m pulling my hair for a month now.

libtool: link: gcc -o build/playwave build/playwave.o
-I/Users/realnc/opt/intel/**include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE
-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,ApplicationServices
-Wl,-framework -Wl,Carbon -Wl,-framework -Wl,AudioToolbox -Wl,-framework
-Wl,AudioUnit -Wl,-framework -Wl,IOKit -L/Users/realnc/opt/intel/lib
/Users/realnc/opt/intel/lib/**libSDLmain.a /Users/realnc/opt/intel/lib/**libSDL.a
build/.libs/libSDL_mixer.a -lm
ld: warning: in build/playwave.o, file was built for i386 which is not the
architecture being linked (x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/**libSDLmain.a, file was built
for unsupported file format which is not the architecture being linked
(x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/**libSDL.a, file was built for
unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in build/.libs/libSDL_mixer.a, file was built for unsupported
file format which is not the architecture being linked (x86_64)
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found

_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Just a guess, but is -arch recognized by gcc? Try -march?

Jonny DOn Wed, Jun 29, 2011 at 11:23 AM, Nikos Chantziaras wrote:

I tried a few weeks ago, and gave up. Today I gave it a go again. This is
my configure line (I’m trying to build a 32-bit static library):

./configure --disable-shared --prefix="$HOME/opt/intel"
–with-sdl-prefix="$HOME/opt/**intel" CFLAGS="-arch i386" CXXFLAGS="-arch
i386" LDFLAGS="-arch i386"

It won’t build. I get the below error. If anyone knows what’s going on,
please help. I’m pulling my hair for a month now.

libtool: link: gcc -o build/playwave build/playwave.o
-I/Users/realnc/opt/intel/**include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE
-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,ApplicationServices
-Wl,-framework -Wl,Carbon -Wl,-framework -Wl,AudioToolbox -Wl,-framework
-Wl,AudioUnit -Wl,-framework -Wl,IOKit -L/Users/realnc/opt/intel/lib
/Users/realnc/opt/intel/lib/**libSDLmain.a /Users/realnc/opt/intel/lib/**libSDL.a
build/.libs/libSDL_mixer.a -lm
ld: warning: in build/playwave.o, file was built for i386 which is not the
architecture being linked (x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/**libSDLmain.a, file was built
for unsupported file format which is not the architecture being linked
(x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/**libSDL.a, file was built for
unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in build/.libs/libSDL_mixer.a, file was built for unsupported
file format which is not the architecture being linked (x86_64)
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found

_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Same result. I originally had -m32 in it anyway, but removed it since
on OS X you use -arch, not -m.On 06/29/2011 06:37 PM, Patrick Baggett wrote:

add “-m32” to CFLAGS and LDFLAGS

Patrick

On Wed, Jun 29, 2011 at 10:23 AM, Nikos Chantziaras <realnc at arcor.de <mailto:realnc at arcor.de>> wrote:

I tried a few weeks ago, and gave up.  Today I gave it a go again.
  This is my configure line (I'm trying to build a 32-bit static
library):

./configure --disable-shared --prefix="$HOME/opt/intel"
--with-sdl-prefix="$HOME/opt/ intel" CFLAGS="-arch i386"
CXXFLAGS="-arch i386" LDFLAGS="-arch i386"

It won't build.  I get the below error.  If anyone knows what's
going on, please help.  I'm pulling my hair for a month now.


libtool: link: gcc -o build/playwave build/playwave.o
-I/Users/realnc/opt/intel/ include/SDL -D_GNU_SOURCE=1
-D_THREAD_SAFE -Wl,-framework -Wl,Cocoa -Wl,-framework
-Wl,ApplicationServices -Wl,-framework -Wl,Carbon -Wl,-framework
-Wl,AudioToolbox -Wl,-framework -Wl,AudioUnit -Wl,-framework
-Wl,IOKit  -L/Users/realnc/opt/intel/lib
/Users/realnc/opt/intel/lib/ libSDLmain.a
/Users/realnc/opt/intel/lib/ libSDL.a build/.libs/libSDL_mixer.a -lm
ld: warning: in build/playwave.o, file was built for i386 which is
not the architecture being linked (x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/ libSDLmain.a, file was
built for unsupported file format which is not the architecture
being linked (x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/ libSDL.a, file was
built for unsupported file format which is not the architecture
being linked (x86_64)
ld: warning: in build/.libs/libSDL_mixer.a, file was built for
unsupported file format which is not the architecture being linked
(x86_64)
Undefined symbols:
"_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found

-arch is recognized by Apple’s version of GCC. -march does something
completely different compared to -arch.

-arch selects the architecture of the binaries, not the CPU model.On 06/29/2011 06:38 PM, Jonathan Dearborn wrote:

Just a guess, but is -arch recognized by gcc? Try -march?

Jonny D

On Wed, Jun 29, 2011 at 11:23 AM, Nikos Chantziaras <realnc at arcor.de <mailto:realnc at arcor.de>> wrote:

I tried a few weeks ago, and gave up.  Today I gave it a go again.
  This is my configure line (I'm trying to build a 32-bit static
library):

./configure --disable-shared --prefix="$HOME/opt/intel"
--with-sdl-prefix="$HOME/opt/ intel" CFLAGS="-arch i386"
CXXFLAGS="-arch i386" LDFLAGS="-arch i386"

It won't build.  I get the below error.  If anyone knows what's
going on, please help.  I'm pulling my hair for a month now.


libtool: link: gcc -o build/playwave build/playwave.o
-I/Users/realnc/opt/intel/ include/SDL -D_GNU_SOURCE=1
-D_THREAD_SAFE -Wl,-framework -Wl,Cocoa -Wl,-framework
-Wl,ApplicationServices -Wl,-framework -Wl,Carbon -Wl,-framework
-Wl,AudioToolbox -Wl,-framework -Wl,AudioUnit -Wl,-framework
-Wl,IOKit  -L/Users/realnc/opt/intel/lib
/Users/realnc/opt/intel/lib/ libSDLmain.a
/Users/realnc/opt/intel/lib/ libSDL.a build/.libs/libSDL_mixer.a -lm
ld: warning: in build/playwave.o, file was built for i386 which is
not the architecture being linked (x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/ libSDLmain.a, file was
built for unsupported file format which is not the architecture
being linked (x86_64)
ld: warning: in /Users/realnc/opt/intel/lib/ libSDL.a, file was
built for unsupported file format which is not the architecture
being linked (x86_64)
ld: warning: in build/.libs/libSDL_mixer.a, file was built for
unsupported file format which is not the architecture being linked
(x86_64)
Undefined symbols:
"_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found

This command line lost your “-arch i386” LDFLAGS…I don’t know why off
the top of my head, but it’s worth noting that if it is trying to link
playwave, it means it already successfully built SDL_mixer itself.

–ryan.On 06/29/2011 11:23 AM, Nikos Chantziaras wrote:

I tried a few weeks ago, and gave up. Today I gave it a go again. This
is my configure line (I’m trying to build a 32-bit static library):

./configure --disable-shared --prefix="$HOME/opt/intel"
–with-sdl-prefix="$HOME/opt/intel" CFLAGS="-arch i386" CXXFLAGS="-arch
i386" LDFLAGS="-arch i386"

It won’t build. I get the below error. If anyone knows what’s going
on, please help. I’m pulling my hair for a month now.

libtool: link: gcc -o build/playwave build/playwave.o
-I/Users/realnc/opt/intel/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE
-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,ApplicationServices
-Wl,-framework -Wl,Carbon -Wl,-framework -Wl,AudioToolbox -Wl,-framework
-Wl,AudioUnit -Wl,-framework -Wl,IOKit -L/Users/realnc/opt/intel/lib
/Users/realnc/opt/intel/lib/libSDLmain.a
/Users/realnc/opt/intel/lib/libSDL.a build/.libs/libSDL_mixer.a -lm

Indeed. I copied libSDL_mixer.a out of the manually. It can’t be used,
however; trying to link against it results in the same error message
(namely that libSDL_mixer.a is of a different arch than i386). I
unpacked it with “ar -x” to test its *.o files: all of them are reported
as i386 by the file tool.

I’m clueless. What on earth is happing here? And is anyone here able
to actually produce a 32bit SDL_mixer on 64-bit OS X (10.6.7/8) and
XCode 3.2.6.On 06/30/2011 01:57 AM, Ryan C. Gordon wrote:

On 06/29/2011 11:23 AM, Nikos Chantziaras wrote:

I tried a few weeks ago, and gave up. Today I gave it a go again. This
is my configure line (I’m trying to build a 32-bit static library):

./configure --disable-shared --prefix="$HOME/opt/intel"
–with-sdl-prefix="$HOME/opt/intel" CFLAGS="-arch i386" CXXFLAGS="-arch
i386" LDFLAGS="-arch i386"

It won’t build. I get the below error. If anyone knows what’s going
on, please help. I’m pulling my hair for a month now.

libtool: link: gcc -o build/playwave build/playwave.o
-I/Users/realnc/opt/intel/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE
-Wl,-framework -Wl,Cocoa -Wl,-framework -Wl,ApplicationServices
-Wl,-framework -Wl,Carbon -Wl,-framework -Wl,AudioToolbox -Wl,-framework
-Wl,AudioUnit -Wl,-framework -Wl,IOKit -L/Users/realnc/opt/intel/lib
/Users/realnc/opt/intel/lib/libSDLmain.a
/Users/realnc/opt/intel/lib/libSDL.a build/.libs/libSDL_mixer.a -lm

This command line lost your “-arch i386” LDFLAGS…I don’t know why off
the top of my head, but it’s worth noting that if it is trying to link
playwave, it means it already successfully built SDL_mixer itself.

It looks like although it is building SDL_mixer as 32-bit, other libraries
that you are linking into the code are 64-bit. Are all linked libraries
32-bit?

And is anyone here able to actually produce a 32bit SDL_mixer on 64-bit OS X

(10.6.7/8) and XCode 3.2.6.

You should be able to build a universal binary by changing the build
settings in XCode.

Something like:

Project->Edit Project Settings->Build
Select BaseSDK
Uncheck Build Active Architecture Only.

Hope that helps,

John

You should be able to build a universal binary by changing the build
settings in XCode.

He’s trying to build from the command line with the Unix configure script.

–ryan.

(Back to my monthly attempt to get rid of FMOD on OS X :-P)On 06/30/2011 03:56 PM, John Magnotti wrote:

It looks like although it is building SDL_mixer as 32-bit, other
libraries that you are linking into the code are 64-bit. Are all linked
libraries 32-bit?

And is anyone here able to actually produce a 32bit SDL_mixer on
64-bit OS X (10.6.7/8) and XCode 3.2.6.

No, everything is 32-bit. The core issue seems to be that the build
system ignores LDFLAGS when linking. None of them show up at the final
link steps.

Even if I modify the link command to manually say “-arch i386”, I then get:

ld: warning: in build/.libs/libSDL_mixer.a, file was built for
unsupported file format which is not the architecture being linked (i386)

Can anyone spot anything wrong in this static archive:

http://foss.aegean.gr/~realnc/libSDL_mixer.aOn 06/29/2011 06:23 PM, Nikos Chantziaras wrote:

I tried a few weeks ago, and gave up. Today I gave it a go again. This
is my configure line (I’m trying to build a 32-bit static library):

./configure --disable-shared --prefix="$HOME/opt/intel"
–with-sdl-prefix="$HOME/opt/intel" CFLAGS="-arch i386" CXXFLAGS="-arch
i386" LDFLAGS="-arch i386"

It won’t build. I get the below error. If anyone knows what’s going on,
please help. I’m pulling my hair for a month now.

ld: warning: in /Users/realnc/opt/intel/lib/libSDL.a, file was built for
unsupported file format which is not the architecture being linked (x86_64)