Question

I am still having trouble building the Portaudio library on my system, which is OSX 10.7.5 with Xcode 4.3.2, having Command Line Tools installed and having SDK10.6 and SDK10.7 under

    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

I describe shortly (also for others that run into the same problem) what I have done so far (following different solutions I have found on the web).

1) I downloaded "Portaudio" / pa_stable_v19_20111121.tgz (last stable release) from:

www.portaudio.com/download.html

2) I read the instructions on building Portaudio here:

www.portaudio.com/docs/v19-doxydocs/compile_mac_coreaudio.html

and tried to compile from a Terminal window with the suggested command:

./configure && make

This resulted (not so surprisingly) in a lot of errors ending with:

llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory lipo: can't open input file: /var/folders/1_/xkp08ky561jg02zjjrpsxg940000gn/T//ccPxCTrJ.out (No such file or directory) make: * [src/hostapi/coreaudio/pa_mac_core.lo] Error 1

This happens because "ppc" is not supported anymore since OSX 10.5. Moreover the "Developer" folder doesn't exist on OSX 10.7 and everything that was in the Developer folder has moved to

   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

3) I downloaded a patch (mac_configure_patch.txt) to fix "configure" from:

https://www.assembla.com/spaces/portaudio/tickets/216#/activity/ticket:

and copied it to the portaudio directory and applied it by typing in Terminal:

$ patch < mac_configure_patch.txt

A confirmation message said:

patching file configure.in

So everything seems fine. But still Portaudio is trying to build for "ppc".

4) Now I set the ARCHFLAGS, CFLAGS, LDFLAGS to only build for architecture i386 as follows (disabling universal build):

$ MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sd -arch i386 -mmacosx-version-min=10.7" ./configure --disable-mac-universal

5) Further I found that:

A): "#include AudioToolbox.h" in ".include/pa_mac_core.h" should be UNCOMMENTED

B): that "-wError" from "Makefile" (not Makefile.in) should be removed.

accoding to: http://www.fluxforge.com/blog/building-portaudio-under-os-x-107-lion

6) Now I try to build (using: "sudo make"), compilation starts but but fails with:

ld: framework not found CoreAudio

collect2: ld returned 1 exit status

make: * [lib/libportaudio.la] Error 1

7) So I try to point to the framework using "-F/System/Library/Frameworks -framework CoreAudio"

leading to the following Terminal command:

$ MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sd -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" ./configure --disable-mac-universal

which seems to fix the CoreAudio framework issue but results in another error saying:

ld: library not found for -lSystem

collect2: ld returned 1 exit status

make: * [lib/libportaudio.la] Error 1

I am now stuck at this point. Did anyone experience the same problems when trying to build Portaudio on OSX 10.7 using SDK10.6 or SDK10.7. Did anyone find a solution to how to build Portaudio from Terminal? I am very thankful for any hints!!! Thanks in advance!

Was it helpful?

Solution 2

OK, finally I solved the issue. Hope the solution will help others as well. I just forgot to also add the path to the CoreAudio framework to the CFLAGS. Here is the final configure/build command for building portaudio on OSX 10.7.5 using SDK10.7 for architecture i386 & x86_64:

Open a Terminal window in the portaudio directory and type:

MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" ./configure --disable-mac-universal

If this has finished, you need to edit Makefile and change the mention of -Werror to -Wall.

Then:

make

Voila. There you have your "libportaudio.la" in the portaudio/lib directory. You can now type

sudo make install

(you'll be asked to confirm using your password)

to put the library in the system directory.

Finally you can mess around with Portaudio! Have fun!

OTHER TIPS

Try the latest svn. If that doesn't work right off the bat, you might need to muck with some of the flags.

eg, in configure.in:

  • change -Werror to -Wall
  • add -Wno-deprecated (you shouldn't need this, but just in case)

then run

./configure --disable-mac-universal

and make as usual.

Tried your instructions on Mac OSX Mountain Lion (10.8), and it was progressing a lot in compilation but then was failing with:

In file included from ./test/patest_sine_channelmaps.c:53:
./include/pa_mac_core.h:100:1: error: unknown type name 'AudioDeviceID'
AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s );
^
./include/pa_mac_core.h:109:1: error: unknown type name 'AudioDeviceID'
AudioDeviceID PaMacCore_GetStreamOutputDevice( PaStream* s );
^
2 errors generated.
make: *** [bin/patest_sine_channelmaps] Error 1

However, I figured out you can simply use Homebrew (apt-like packet manager for OSX) and it will do the dirty job like a charm. Find binaries and headers in the specified install directory :)

$ brew install portaudio
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Downloading http://www.portaudio.com/archives/pa_stable_v19_20111121.tgz
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file include/pa_mac_core.h
==> ./configure --prefix=/usr/local/Cellar/portaudio/19.20111121 --enable-mac-un
==> make install
/usr/local/Cellar/portaudio/19.20111121: 8 files, 316K, built in 20 seconds
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top