Building Portaudio on OSX 10.7.5 using SDK10.6 or 10.7 fails - build

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!

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.

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!

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

Related

Installing Moses Translation Software. Error message: "ld: library not found for -lboost_thread"

I am installing the Moses Translation Software on my Mac OS X 10.9.5 with Xcode 6.1. The instructions say that I need g++ and Boost installed. Once I do that, I git clone, "cd" into the directory, and then type ./bjam -j8. First, I verified I have the prerequisites. First, g++ (I just clicked the TAB to see what was available):
$ g++
g++ g++-4.9
Then boost:
$ brew install boost
Warning: boost-1.56.0 already installed
Then I tried installing:
$ ./bjam -j8
Tip: install tcmalloc for faster threading. See BUILD-INSTRUCTIONS.txt for more information.
mkdir: bin: File exists
...patience...
...patience...
...found 4469 targets...
...updating 155 targets...
darwin.link lm/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/query
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
// Additional error messages...
...failed darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/util_test...
...skipped <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>util_test.passed for lack of <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>util_test...
darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"g++" -o "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test" "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/VocabularyTest.o" "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/libmert_lib.a" -lboost_unit_test_framework -llzma -lbz2 -ldl -lboost_system -lz -lboost_thread -lm -liconv -g -Wl,-dead_strip -no_dead_strip_inits_and_terms
...failed darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test...
...skipped <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>vocabulary_test.passed for lack of <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>vocabulary_test...
...failed updating 72 targets...
...skipped 83 targets...
The build failed. If you need support, run:
./jam-files/bjam -j8 --debug-configuration -d2 |gzip >build.log.gz
then attach build.log.gz to your e-mail.
You MUST do 3 things before sending to the mailing list:
1. Subscribe to the mailing list at http://mailman.mit.edu/mailman/listinfo/moses-support
2. Attach build.log.gz to your e-mail
3. Say what is the EXACT command you executed when you got the error
ERROR
There's a ton of error messages not shown (condensed into "// Additional error messages"), and they are all of the form "ld: library not found for -lboost_thread". So it's clear that something can't find a boost-related library, but I don't know how to fix this. Does anyone have suggestions? I literally just copied a couple of lines from the installation instructions, and Moses is popular enough such that an obvious error in the installation instructions would have been caught long ago.
Additional comment: On the installation instructions page, they list a command where they can force an installer to find the boost library:
./bjam --with-boost=~/workspace/temp/boost_1_55_0 -j8
My boost is in
/usr/local/Cellar/boost/1.56.0/
I tried substituting the --with-boost= argument with the above file path, but that did not work either (I got the same errors).
I'm going to post this on the Moses mailing list but I'd also want to ask here because I have gotten this same error ("library not found ... clang: error: linker command failed with exit code 1") with other software and it would be helpful for me to learn a general strategy for making sure that clang can find my libraries.
This package expects a non-standard layout of boost (or maybe that's the standard liayout for installed boost on many systems, but it certainly isn't the default layout for boost in my working directories):
bjam --help says:
--with-boost=/path/to/boost
If Boost is in a non-standard location, specify it here. This directory is
expected to contain include and lib or lib64.
When my Boost build tree is in
/home/sehe/custom/boost/boost // headeers
/home/sehe/custom/boost/stage
/home/sehe/custom/boost/stage/lib // libraries
I have created a "forwarding" directory - so I'm not required to install boost:
mkdir /tmp/boost-moses
cd /tmp/boost-moses/
ln -sfv /home/sehe/custom/boost/stage/lib lib
ln -sfv /home/sehe/custom/boost include
Now I could trigger a build in the mosesdecoder directory with
./bjam --with-boost=/tmp/boost-moses
It's not said here which Moses version ComputerScientist compiled, but his last comment hit the nail. When I was about to compile version 2.1.1, I needed to rewrite Jamroot file and jam-files/boost-build/tools/mpi.jam and change all the boost_mpi mentions to boost_mpi-mt. It seems to me that boost-1.55 used different library style then boost-1.56 and Moses was in that version adapted to 1.55.
However I am not able to compile Moses 3.0 with either boost-1.55 or boost-1.56 now because of undefined reference to boost::filesystem::path::stem().
Unfortunatelly I can not post this as a comment to previous answer...

Xcode 4 SFML 2 error

I used the SFML 2 installer, it can be found here. http://www.sfml-dev.org/download.php
Ld /Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Products/Debug/gangnam_style.app/Contents/MacOS/gangnam_style normal x86_64
cd /Users/pjquinn/Programming/C++/gangnam_style
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
-L/Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Products/Debug
-F/Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Products/Debug
-filelist /Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Intermediates/gangnam_style.build/Debug/gangnam_style.build/Objects-normal/x86_64/gangnam_style.LinkFileList
-mmacosx-version-min=10.7 -lsfml-system-d -lsfml-window-d -lsfml-graphics-d -lsfml-audio-d -lsfml-network-d -stdlib=libc++ -fobjc-link-runtime -framework Foundation -o /Users/pjquinn/Library/Developer/Xcode/DerivedData/gangnam_style-ayfrlelgnycrzpdbmwbkqgtkkryv/Build/Products/Debug/gangnam_style.app/Contents/MacOS/gangnam_style
ld: library not found for -lsfml-system-d clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I'm creating a project should I select the Use Frameworks box?
Debug binaries are not shipped with the installer.
You should also have a look at the other issues
I used their template and checked the "Use Frameworks" box, but still had problems. What I ended up doing was adding the SFML frameworks files (which their installer script put in ~/Libraries/Frameworks) in the project myself (simple drag'n'drop). I double checked and made sure the added frameworks were then included in the Build Phases (which they were), and everything worked fine.

Xcode 4.4 10.6 sdk library not found for -lstdc++

I am trying to build a dylib using Xcode 4.4, which previously built fine. I have run into 2 issues:
If I build against the 10.7 sdk, it builds fine. However when testing on 10.6.8 I get the following error:
Dyld Error Message: Symbol not found: _wcsdup Referenced from:
/lib/Release/libwx_baseu-2.9.dylib Expected in:
/usr/lib/libSystem.B.dylib
If I build against the 10.6 sdk (extracted from a download of Xcode 4.3.3), I get the following link error:
Ld build/Debug/libCodec.dylib normal i386
cd /Developer/Projects/Common/osx
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-g++-4.2 -arch i386 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
-L/Developer/Projects/Common/osx/build/Debug -L/Developer/Packages/libsndfile/osx/lib -L/Developer/Packages/wxWidgets/build-debug/lib -F/Developer/Projects/Common/osx/build/Debug -filelist /Developer/Projects/Common/osx/build/Common.build/Debug/Codec.build/Objects-normal/i386/Codec.LinkFileList
-install_name "#rpath/libCodec.dylib" -mmacosx-version-min=10.6 -lSampleFormat -lSoundFile -lsndfile.1 -lwx_baseu-2.9 -single_module -compatibility_version 1 -current_version 1 -o /Developer/Projects/Common/osx/build/Debug/libCodec.dylib
ld: library not found for -lstdc++ collect2: ld returned 1 exit status
Command
/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-g++-4.2 failed
with exit code 1
I would prefer to build against the 10.6 sdk, since i need to support 10.6.8. In all cases I set my min deployment target to 10.6, however that hasn't helped.
Update (08/05/2012):
I resolved the error I was receiving when building against the 10.6 SDK by changing to apple's devualt llvm 4.0 compiler (instead of the llvm gcc compiler which I was using).
Just because you manually copied the 10.6 from an older version of Xcode doesn't mean your new Xcode is going to know what to do with it.
But do not fret, simply set the Deployment Target (as you already have done) to 10.6 and link against whatever the current SDK that is shipping with Xcode 4.4.
You'll run on 10.6 just fine.
The same concept applies for iOS, and here's a related question that adds some extra detail (in terms of iOS, but the same philosophy applies for MacOS).

Cannot find lffi - Error linking with llvm libraries

I am trying to use LLVM as backend for my compiler, and while linking with the llvm libraries, I get this error
g++ obj/*.o `llvm-config --ldflags core jit native` `llvm-config --libs core jit native` -lfl -o Icarus
/usr/bin/ld: cannot find -lffi
collect2: ld returned 1 exit status
I have installed llvm on my system and my cpp files compile fine. Its during linking that the library its searching can't be found.
If on a deb system try installing the dev libs, they solved the problem for me:
sudo apt-get install libffi-dev
Hmm. Did you install libffi too?
ftp://sourceware.org/pub/libffi/libffi-3.0.10.tar.gz
I know that installing libffi into /usr prefix helped me, when ld complained about being unable to find -ffi

Problem building Festival (Text to Speech) on Ubuntu

I set up a Ubuntu VM today just to build Festival on Ubuntu (I never ran it before) Then I did the following setups
On the Terminal window I wrote following to install GNU C++ Compiler
sudo apt-get install build-essential
To test the g++ I wrote a sample hello world and compiled it using g++ and run it and it worked as expected.
I downloaded all the files from listed on festival download page
Unpacked all to the home directory(~) using
tar -zxvf *.tar.gz
Then wrote following 3 commands to configure and make speech_tools
cd speech_tools
./configure
make
But make returns with following errors
/lib -leststring -lcurses -ldl -lncurses -lm -lstdc++ -lgcc
/usr/bin/ld: cannot find -lcurses
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make[1]: *** [ch_lab] Error 1
make: *** [main] Error 2
What am I missing? being a newbie to Ubuntu or any other Unix platform I may missed some important configuration, before that I have successfully built festival on my windows machine using Cygwin.
You probably need to install the development packages for libncurses. Try
sudo apt-get install libncurses5-dev