Problems building on Mac

OS 10.5.6

wxWidgets 2.8.9, local install, compiled using --enable-unicode --disable-shared, had to copy lib/wx/config/mac-unicode-release-static-2.8 to /usr/local/lib/wx/config in order for wx-config to find it.

If I try building the Active Target Configure in Xcode, I get:

*** missing separator. Stop
*** missing separator. Stop

If I do, I get:
xcodebuild -target Audacity -configuration “Release Static”

** BUILD FAILED **

The following build commands failed:
Configure:
PhaseScriptExecution “/Users/grav/repositories/audacity/mac/build/Audacity.build/Release Static/Configure.build/Script-17072E8C0988BD85008541CC.sh”
libsndfile:
CompileC “build/Audacity.build/Release Static/libsndfile.build/Objects-normal/ppc/sndfile.o” /Users/grav/repositories/audacity/mac/…/lib-src/libsndfile/src/sndfile.c normal ppc c com.apple.compilers.gcc.4_0
Audacity:
Preprocessing “/Users/grav/repositories/audacity/mac/build/Audacity.build/Release Static/Audacity.build/Preprocessed-Info.plist” Info.plist
ProcessPCH++ /var/folders/cM/cMyd95CnFh8Z0+nKIvSIr++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/AudacityHeaders-ezlkvjbsqepcprafmdlhwhypewaq/AudacityHeaders.h.gch …/src/AudacityHeaders.h normal i386 c++ com.apple.compilers.gcc.4_0
ProcessPCH++ /var/folders/cM/cMyd95CnFh8Z0+nKIvSIr++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/AudacityHeaders-guntcpppmypexggfrxkvcpznassr/AudacityHeaders.h.gch …/src/AudacityHeaders.h normal ppc c++ com.apple.compilers.gcc.4_0
(5 failures)


Any ideas?

Hi Grav,

I don’t have enough experience building apps on OS X to figure out what’s going wrong from the error’s you’re getting, however, I downloaded and compiled audacity for the first time 2 days ago and got it up and running tonight. From my experience, I have a strong feeling that you’ve configured wxWindows incorrectly. Especially since you’re having to move various items around in your system. That’s never a good thing.

Here’s what I did to get it to work:

MySetup:
OS X: 10.5.6
XCode 3.1.2
I’m not building universal binaries…
Downloaded wxMac 2.8.10
Downloaded audacity 1.3.8 from cvs

wxWindows was configured with the following switches
./configure --disable-shared --enable-static --enable-unicode --disable-dependency-tracking --disable-monolithic --prefix=/Users/bcox/Development/audacity/wx/

Note that I’ve changed the default location for wxWindows. I think it’s best not to install it into /usr/local/.

make
sudo make install

OK, wxWindows should be installed and OK.

Next I fired up the audacity XCode file

  1. Change WX_PREFIX (in the User Defined section) to the location of your wx install. For me that’s /Users/bcox/Development/audacity/wx

  2. I don’t have a libwx_expat.a but I do have a libexpat.a in /usr/local/lib/ so I modified WX_LDFLAGS to point to that instead

I also had to comment out line 1365 of ProcessDialog.cpp because of a problem with wxSound(…). I need to look into it but you could also change it to read:
s.Create((wxChar)beep, sizeof(beep)); That might work. Or it might crash things when your process dialog sends out a beep.

wxWindows was configured with the following switches
./configure --disable-shared --enable-static --enable-unicode --disable-dependency-tracking --disable-monolithic --prefix=/Users/bcox/Development/audacity/wx/

Yep, this took care of a lot of problems - now wx-config seems to look for the config files the right place.

Next I fired up the audacity XCode file

  1. Change WX_PREFIX (in the User Defined section) to the location of your wx install. For me that’s /Users/bcox/Development/audacity/wx

  2. I don’t have a libwx_expat.a but I do have a libexpat.a in /usr/local/lib/ so I modified WX_LDFLAGS to point to that instead

I also had to comment out line 1365 of ProcessDialog.cpp because of a problem with wxSound(…). I need to look into it but you could also change it to read:
s.Create((wxChar)beep, sizeof(beep)); That might work. Or it might crash things when your process dialog sends out a beep.

This expat-thing gave me problems as well. I don’t have a libexpat.a in /usr/local/lib/ either, but I did find one in another project.

However, I still get 89 errors of this sort:

Undefined symbols:
  "_mktime$UNIX2003", referenced from:
      wxDateTime::SetFromDOS(unsigned long)in libwx_base_carbonu-2.8.a(baselib_datetime.o)
      wxDateTime::Set(tm const&) in libwx_base_carbonu-2.8.a(baselib_datetime.o)
      wxDateTime::Set(unsigned short, unsigned short, unsigned short, unsigned short)in libwx_base_carbonu-2.8.a(baselib_datetime.o)
      wxDateTime::GetWeekDayName(wxDateTime::WeekDay, wxDateTime::NameFlags)in libwx_base_carbonu-2.8.a(baselib_datetime.o)
      wxGetLocalTime()     in libwx_base_carbonu-2.8.a(baselib_stopwatch.o)
  "_XML_GetErrorCode", referenced from:
      XMLFileReader::Parse(XMLTagHandler*, wxString const&) in XMLFileReader.o
  "_write$UNIX2003", referenced from:
      wxFile::Write(void const*, unsigned long)in libwx_base_carbonu-2.8.a(baselib_file.o)
      wxSingleInstanceCheckerImpl::CreateLockFile()       in libwx_base_carbonu-2.8.a(baselib_unix_snglinst.o)
      __tiffWriteProc in libwxtiff-2.8.a(wxtiff_tif_unix.o)
  "_select$UNIX2003", referenced from:
      wxPipeInputStream::CanRead() const in libwx_base_carbonu-2.8.a(baselib_utilsunx.o)
      GSocket::Output_Timeout()      in libwx_base_carbonu_net-2.8.a(netlib_unix_gsocket.o)
      GSocket::Input_Timeout()      in libwx_base_carbonu_net-2.8.a(netlib_unix_gsocket.o)
      GSocket::Select(int)  in libwx_base_carbonu_net-2.8.a(netlib_unix_gsocket.o)

Any advice?

Hmm, could it be that I’ve built wxWidgets for 10.5 but I am trying to build Audacity for 10.4? I’ve tried compiling Audacity for 10.5 instead, but this gives other errors. So if the problem is indeed that wxWidgets needs to be compiled for 10.4, how do I do that on a 10.5 machine?

Edit: and by the way, thanks for your first assistance, bcox :slight_smile:

Edit: also tried using compiler flag -mmacosx-version-min=10.4 (while compiling for 10.4) without any luck.

I got similar linker errors the first time around as well. Under the build settings I changed the “Base SDK” and “Deployment Target” settings to be “Mac OS X 10.5” and the errors went away. I just tested it again with 10.4 as the Base SDK and I get the same errors (although there are only 20 errors).

The change should help with most of those linker errors. If all the standard c linker errors go away (write, mktime, etc.) and you’re still getting XML linker errors, you’ll need to build a copy of the expat library. libwxexpat.a should be able to be built by looking in wxMac-2.8.10/src/expat/. You can build it without building the rest of wxWindows. I think that’s where I got the copy that’s in my /usr/local/lib/ folder from.

I think you’re really close to a successful build. Let me know if you get it working.

Well, I got rid of the $UNIX2003 - I think it had something to do with building wx for 10.5. Anyways, now I build wxWidgets using this:

…/configure --disable-compat26 --with-expat=builtin --with-zlib=builtin --with-regex=builtin --enable-universal_binary=yes --enable-static=yes --enable-shared=no --enable-unicode=yes --enable-debug=no --prefix=/Users/grav/audacity/wx/
make clean
make -j 7
make -j 7 install

This is inspired by Leland of the Audacity Team, but I still get the XML-parser related errors below when compiling Audacity via Xcode.

I am currently in contact with Leland via the developer list also, but if you can assist with anything, I’d be grateful :slight_smile:


Edit: oh, I just noticed what you wrote regarding XML errors. I’ll try building expat and report back!

    cd /Users/grav/repositories/audacity/mac
    /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk "-L/Users/grav/repositories/audacity/mac/build/Release Static" "-L/Users/grav/repositories/audacity/mac/build/Debug Static" "-F/Users/grav/repositories/audacity/mac/build/Release Static" -filelist "/Users/grav/repositories/audacity/mac/build/Audacity.build/Release Static/Audacity.build/Objects-normal/i386/Audacity.LinkFileList" -mmacosx-version-min=10.4 -keep_private_externs -L/Users/grav/audacity/wx/lib /Users/grav/audacity/wx/lib/libwx_macu_xrc-2.8.a /Users/grav/audacity/wx/lib/libwx_macu_qa-2.8.a /Users/grav/audacity/wx/lib/libwx_macu_html-2.8.a /Users/grav/audacity/wx/lib/libwx_macu_adv-2.8.a /Users/grav/audacity/wx/lib/libwx_macu_core-2.8.a /Users/grav/audacity/wx/lib/libwx_base_carbonu_xml-2.8.a /Users/grav/audacity/wx/lib/libwx_base_carbonu_net-2.8.a /Users/grav/audacity/wx/lib/libwx_base_carbonu-2.8.a /Users/grav/audacity/wx/lib/libwxregexu-2.8.a /Users/grav/audacity/wx/lib/libwxtiff-2.8.a /Users/grav/audacity/wx/lib/libwxjpeg-2.8.a /Users/grav/audacity/wx/lib/libwxpng-2.8.a -framework OpenGL -framework QuickTime -framework IOKit -framework Carbon -framework Cocoa -framework System -framework WebKit -framework CoreAudio -framework AudioUnit -framework AudioToolbox -lz -lpthread -liconv -lFLAC++ -lFLAC -lvorbis -lportsmf -lid3tag -lmad -lnyquist -logg -lportmixer -lresample -lsndfile -lsoundtouch -lFLAC++ -lFLAC -lportaudio -ltwolame -lvamp -lscorealign -llibsbsms -ltaglib -prebind -o "/Users/grav/repositories/audacity/mac/build/Release Static/Audacity.app/Contents/MacOS/Audacity"
Undefined symbols:
  "_XML_GetCurrentLineNumber", referenced from:
      XMLFileReader::Parse(XMLTagHandler*, wxString const&) in XMLFileReader.o
  "_XML_ErrorString", referenced from:
      XMLFileReader::Parse(XMLTagHandler*, wxString const&) in XMLFileReader.o
  "_XML_ParserCreate", referenced from:
      XMLFileReader::XMLFileReader()in XMLFileReader.o
  "_XML_ParserFree", referenced from:
      XMLFileReader::~XMLFileReader()in XMLFileReader.o
      XMLFileReader::~XMLFileReader()in XMLFileReader.o
      XMLFileReader::~XMLFileReader()in XMLFileReader.o
  "_XML_GetErrorCode", referenced from:
      XMLFileReader::Parse(XMLTagHandler*, wxString const&) in XMLFileReader.o
  "_XML_SetElementHandler", referenced from:
      XMLFileReader::XMLFileReader()in XMLFileReader.o
  "_XML_SetUserData", referenced from:
      XMLFileReader::XMLFileReader()in XMLFileReader.o
  "_XML_Parse", referenced from:
      XMLFileReader::Parse(XMLTagHandler*, wxString const&) in XMLFileReader.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Ok, I finally managed to get it to build by:

Applying the patch in the mac-dir on wxWidgets 2.8.9

cd /path/to/wxMac-2.8.9

# I think this takes care of some wx sound probs
patch -p1 < /path/to/audacityrepos/mac/wxMac-2.8.9.patch

./configure --disable-compat26 --with-expat=builtin --with-zlib=builtin --with-regex=builtin --enable-universal_binary=yes --enable-static=yes --enable-shared=no --enable-unicode=yes --enable-debug=no --prefix=/where/to/install/wxwidgets
make clean
make -j 7
make -j 7 install

Only other thing to do is to change Xcode WX_PREFIX variable to /where/to/install/wxwidgets

Thanx to bcox and Leland!