Compile Lame Universal

Discussion in 'Mac Programming' started by GRMrGecko, Apr 20, 2009.

  1. macrumors member

    GRMrGecko

    Joined:
    Jun 7, 2008
    Location:
    Nowhere and everywhere
    #1
    Hello, I'm trying to compile Lame MP3 Library for ppc and intel so I can include it in a ppc/intel ffmpeg compile and I'll like it to work on 10.4 as well. I know I can possibly use lipo to join the ppc and intel compiled versions into a universal file. But I'm unsure if it'll work.

    Thanks for tips and recommendations,
    Mr. Gecko
     
  2. macrumors G4

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #2
    Why bother with LIPO? Add the other architecture to your build flags (i.e. specify both -arch i386 AND -arch ppc) and see if that works first. If it doesn't, the LIPO approach WILL work.
     
  3. thread starter macrumors member

    GRMrGecko

    Joined:
    Jun 7, 2008
    Location:
    Nowhere and everywhere
    #3
    I tried that at first. And when I compile for -arch ppc only, it has an error during the compile.

    edit
    I compile with export CFLAGS="-arch ppc"; ./configure --prefix=/ffmpeg/lame --build=ppc --disable-nasm
    and the error I get is
    /bin/sh ../libtool --tag=CC --mode=link gcc -Wall -arch ppc -fno-common -static -o lame main.o console.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o ../libmp3lame/libmp3lame.la -lncurses -lm
    mkdir .libs
    gcc -Wall -arch ppc -fno-common -o lame main.o console.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o ../libmp3lame/.libs/libmp3lame.a -lncurses -lm
    Undefined symbols:
    "_init_xrpow_core_sse", referenced from:
    _init_xrpow_core_sse$non_lazy_ptr in libmp3lame.a(quantize.o)
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make[2]: *** [lame] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
     
  4. thread starter macrumors member

    GRMrGecko

    Joined:
    Jun 7, 2008
    Location:
    Nowhere and everywhere
    #4
    Ok I was able to get this to compile finally.

    Code:
    echo "Uncompressing Lame"
    tar -xzf lame-398-2.tar.gz
    mv lame-398-2 lame-398-2-i386
    cp -R lame-398-2-i386 lame-398-2-ppc
    echo "Configuring Lame"
    cd lame-398-2-i386
    HOST_CC=gcc CC="gcc-4.0 -arch i386" CXX="g++-4.0 -arch i386" ./configure --prefix=/ffmpeg/lame-i386 --host=i386-apple-darwin8.11.1
    cd ../lame-398-2-ppc
    HOST_CC=gcc CC="gcc-4.0 -arch ppc" CXX="g++-4.0 -arch ppc" ./configure --prefix=/ffmpeg/lame-ppc --host=ppc-apple-darwin8.11.1
    echo "Compiling Lame"
    cd ../lame-398-2-i386
    make
    cd ../lame-398-2-ppc
    make
    echo "Installing Lame"
    cd ../lame-398-2-i386
    make install
    cd ../lame-398-2-ppc
    make install
    echo "Making Lame Universal"
    cd ../
    cp -R lame-i386 lame
    lipo -create ./lame-i386/bin/lame ./lame-ppc/bin/lame -output ./lame/bin/lame
    lipo -create ./lame-i386/lib/libmp3lame.0.0.0.dylib ./lame-ppc/lib/libmp3lame.0.0.0.dylib -output ./lame/lib/libmp3lame.0.0.0.dylib
    lipo -create ./lame-i386/lib/libmp3lame.a ./lame-ppc/lib/libmp3lame.a -output ./lame/lib/libmp3lame.a
     

Share This Page