Compiling wxWidgets for 10.4?

Kinniken

Registered
Hi, I have a project to do in C++ with the wxWidgets UI libraries. I downloaded the latest stable release (2.6) from the official website (http://www.wxwidgets.org/dl_mac2.htm).

configure runs fine, but when trying to compile it using make I get:

./bk-deps g++ -c -o coredll_webkit.o -I.pch/wxprec_coredll -D__WXMAC__ -I../src/tiff -I../src/jpeg -I../src/png -I../src/expat/lib -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -DWX_PRECOMP -DNO_GCC_PRAGMA -Ilib/wx/include/mac-ansi-release-2.6 -I../include -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -fpascal-strings -I../src/mac/carbon/morefilex -I/Developer/Headers/FlatCarbon -O2 -Wall -Wno-ctor-dtor-privacy -fno-common ../src/html/htmlctrl/webkit/webkit.mm
../src/html/htmlctrl/webkit/webkit.mm:69: error: 'wxStringWithNSString' declared as an 'inline' variable
../src/html/htmlctrl/webkit/webkit.mm:69: error: 'NSString' was not declared in this scope
../src/html/htmlctrl/webkit/webkit.mm:69: error: 'nsstring' was not declared in this scope
../src/html/htmlctrl/webkit/webkit.mm:70: error: expected %<,%> or %<;%> before '{' token
../src/html/htmlctrl/webkit/webkit.mm:78: error: expected initializer before '*' token
../src/html/htmlctrl/webkit/webkit.mm:87: error: cannot find interface declaration for `NSObject', superclass of `MyFrameLoadMonitor'
../src/html/htmlctrl/webkit/webkit.mm: In member function `bool wxWebKitCtrl::Create(wxWindow*, wxWindowID, const wxString&, const wxPoint&, const wxSize&, long int, const wxValidator&, const wxString&)':
../src/html/htmlctrl/webkit/webkit.mm:156: warning: no `-setHidden:' method found
../src/html/htmlctrl/webkit/webkit.mm:156: warning: (Messages without a matching method signature
../src/html/htmlctrl/webkit/webkit.mm:156: warning: will be assumed to return `id' and accept
../src/html/htmlctrl/webkit/webkit.mm:156: warning: `...' as arguments.)
../src/html/htmlctrl/webkit/webkit.mm:160: warning: `MyFrameLoadMonitor' may not respond to `+alloc'
../src/html/htmlctrl/webkit/webkit.mm:161: warning: no `-setFrameLoadDelegate:' method found
../src/html/htmlctrl/webkit/webkit.mm: In member function `void wxWebKitCtrl::LoadURL(const wxString&)':
../src/html/htmlctrl/webkit/webkit.mm:181: warning: no `-mainFrame' method found
../src/html/htmlctrl/webkit/webkit.mm:181: error: 'NSURLRequest' was not declared in this scope
../src/html/htmlctrl/webkit/webkit.mm:181: error: 'NSURL' was not declared in this scope
../src/html/htmlctrl/webkit/webkit.mm:181: error: 'wxNSStringWithWxString' was not declared in this scope
../src/html/htmlctrl/webkit/webkit.mm:181: warning: no `-loadRequest:' method found
../src/html/htmlctrl/webkit/webkit.mm: In member function `bool wxWebKitCtrl::CanGoBack()':
../src/html/htmlctrl/webkit/webkit.mm:190: warning: no `-canGoBack' method found
../src/html/htmlctrl/webkit/webkit.mm: In member function `bool wxWebKitCtrl::CanGoForward()':
../src/html/htmlctrl/webkit/webkit.mm:197: warning: no `-canGoForward' method found
../src/html/htmlctrl/webkit/webkit.mm: In member function `bool wxWebKitCtrl::GoBack()':
../src/html/htmlctrl/webkit/webkit.mm:204: warning: `WebView' may not respond to `-goBack'
../src/html/htmlctrl/webkit/webkit.mm: In member function `bool wxWebKitCtrl::GoForward()':
../src/html/htmlctrl/webkit/webkit.mm:212: warning: `WebView' may not respond to `-goForward'
../src/html/htmlctrl/webkit/webkit.mm: In member function `void wxWebKitCtrl::Reload()':
../src/html/htmlctrl/webkit/webkit.mm:220: warning: no `-mainFrame' method found
../src/html/htmlctrl/webkit/webkit.mm:220: warning: no `-reload' method found
../src/html/htmlctrl/webkit/webkit.mm: In member function `void wxWebKitCtrl::Stop()':
../src/html/htmlctrl/webkit/webkit.mm:227: warning: no `-mainFrame' method found
../src/html/htmlctrl/webkit/webkit.mm:227: warning: no `-stopLoading' method found
../src/html/htmlctrl/webkit/webkit.mm: In member function `bool wxWebKitCtrl::CanGetPageSource()':
../src/html/htmlctrl/webkit/webkit.mm:234: error: 'WebDataSource' was not declared in this scope
../src/html/htmlctrl/webkit/webkit.mm:234: error: 'dataSource' was not declared in this scope
../src/html/htmlctrl/webkit/webkit.mm:234: warning: no `-mainFrame' method found
../src/html/htmlctrl/webkit/webkit.mm:234: warning: no `-dataSource' method found
../src/html/htmlctrl/webkit/webkit.mm:235: confused by earlier errors, bailing out
make: *** [coredll_webkit.o] Error 1

Now, since it mentions webkit extensively, I'm assuming that it must be the result of incompatibilities between it and 10.4. Does anyone know a work around?

TIA,

Cédric
 
I got it to compile by adding the flags --disable-webkit.

If you're using wxCocoa and not the Carbon port, just configure with --with-cocoa and webkit seems to work fine.
 
After an interruption due to more urgent projects, I'm back at it... I tried the tutorial you linked to. Even though it was written for XCode 1.5, I found all the settings described. However, when building the project, while the compilation phase works the linking fails with the following error:

/usr/bin/g++-4.0 -o /Users/cedricdj/Desktop/wxMac-2.6.0/demos/bombs/Bombs/build/Bombs.app/Contents/MacOS/Bombs "-L/Users/cedricdj/Desktop/wxMac-2.6.0/demos/bombs/Bombs/build" "-F/Users/cedricdj/Desktop/wxMac-2.6.0/demos/bombs/Bombs/build" -filelist /Users/cedricdj/Desktop/wxMac-2.6.0/demos/bombs/Bombs/build/Bombs.build/Bombs.build/Objects-normal/LinkFileList "-arch" "ppc" "-prebind" "-Wl,-no_arch_warnings"
/usr/bin/ld: warning prebinding disabled because of undefined symbols
/usr/bin/ld: Undefined symbols:
wxMessageBox(wxString const&, wxString const&, long, wxWindow*, int, int)
wxGetStockLabel(int)
wxGetTopLevelParent(wxWindow*)
wxEntry(int&, char**)
wxAssert(int, wchar_t const*, int, wchar_t const*, wchar_t const*)
wxClientDC::wxClientDC(wxWindow*)
wxClientDC::~wxClientDC()
wxFontBase::~wxFontBase()
wxListBase::Init(wxKeyType)

(There basically the list of all the wx methods/classes used by the project, I cutted it short).

I assume that XCode cannot find the wx libraries, even though it can find the headers. Do you know where they are? I tried the "obvious" locations (/usr/lib, /usr/local...), but nothing works so far.

TIA,

Kinniken
 
Did you do a "sudo make install"? If you did, and it installed correctly assuming you used the default install location, it will be in /usr/local. Just copy and paste the wx-config --cflags --libs and you should be set.

You might also want to be sure that you disable ZeroLink. It works wonders when developing certain apps, but it doesn't work at all with wxWidgets.
 
I did all of that, and it still fails.

Concerning the install, I looked in /usr/local and I have in /usr/local/lib:

Many libs with names like libwx_base_carbon_net-2.6.0.0.0.dylib, libwx_base_carbon_xml-2.6.0.0.0.dylib, libwx_mac_xrc-2.6.0.0.0.dylib...

A "wx" folder containing two files in nested folders:

/usr/local/lib/wx/config/mac-ansi-release-2.6
/usr/local/lib/wx/include/mac-ansi-release-2.6/wx/setup.h

Is there anything missing?
 
I just spent an other fruitless hour trying different options, include paths and so on, nothing works...
Assuming you have it running under 10.4, any chance you could email me (cedric "at" kstudio '.' net) a bare-bone wxWidgets project that compiles with Xcode? Hopefully I can figure out what's wrong from it...

TIA,

Kinniken
 
I've just taken a look at my /usr/local/lib. I've got not .dylib files. All I have are .a files since I compiled everything as a static library. This maybe why I don't get any errors on mine.
 
I think he did. He's copied all the flags from wx-config that will tell you where and what libraries to link. So it's strange that he's getting the errors.
 
Viro said:
All I have are .a files since I compiled everything as a static library. This maybe why I don't get any errors on mine.

Probably, yes. How do I compile wxWidgets as a static library then? I used the exact command sequence below:

1) cd into the base dir
2) mkdir osx-build
3) cd osx-build
4) ../configure --disable-webkit
5) make
6) sudo make install
7) type <YOUR OWN PASSWORD>

They are straight from the www.wxwidgets.org mac install read me, except the --disable-webkit flag which you indicated.
 
wadesworld said:
Did you add the needed wx libs to your project? If you didn't, it won't link with them.

I did not drag-and-drop any libraries to my project's files, just added the compiler flags from wx-config. I exactly followed the tutorial given in Viro's second post, no more, no less (though when it failed I did try different things which did not work, like specifying other include paths).
 
Thanks, I'll try that.

Before I install the static libraires though, how do I uninstall my previous install? I tried sudo make uninstall, but the "uninstall" target is blank... Should I do it manually?
 
Just noticed something interesting... If I cannot manage to make the "bombs" demo compile with Xcode, the very same demo compiles without problems with a simple "make" command in the terminal.

I'm going to try peering though its makefile and try and configure my Xcode project to use the same settings.
 
Paste the entire command you're trying to compile with - then we can see if the right libraries are being linked and the proper paths specified.
 
How do I do that with Xcode?
If it helps, here are the results of the two wx-config commands:

cedricdj$ wx-config --cxxflags
-I/usr/local/lib/wx/include/mac-ansi-release-static-2.6 -I/usr/local/include/wx-2.6 -D__WXMAC__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DNO_GCC_PRAGMA
cedricdj$ wx-config --libs
-L/usr/local/lib -framework QuickTime -framework IOKit -framework Carbon -framework Cocoa -framework System /usr/local/lib/libwx_mac_xrc-2.6.a /usr/local/lib/libwx_mac_qa-2.6.a /usr/local/lib/libwx_mac_html-2.6.a /usr/local/lib/libwx_mac_adv-2.6.a /usr/local/lib/libwx_mac_core-2.6.a /usr/local/lib/libwx_base_carbon_xml-2.6.a /usr/local/lib/libwx_base_carbon_net-2.6.a /usr/local/lib/libwx_base_carbon-2.6.a -lwxexpat-2.6 -lwxtiff-2.6 -lwxjpeg-2.6 -lwxpng-2.6 -lz -lpthread -liconv

All the paths listed in those commands look correct.
 
OK, all running wx-config does is to setup wxWidgets.

If you want to actually use wxWindows in an xCode project, you need to add the appropriate wxWidgets libraries to your Xcode project. You can either drag-and-drop them or use "Add to project".

If you try that and it still doesn't work, pull up the detailed build results window and paste the command-line output here (the command-line output is in the bottom pane of the window).

Wade
 
According to the tutorial linked to by Viro in his second post, wx-config outputs the compilation and linking flags to be used by Xcode. I copy-pasted them in the corresponding target setting fields in Xcode.
I tried adding the libraries to the project as you proposed (including the target, of course), and it failed just as before.

Here is the result of the entire build process output:

/Developer/Private/jam -d1 -j1 JAMBASE=/Developer/Makefiles/pbx_jamfiles/ProjectBuilderJambase JAMFILE=- build ACTION=build _DEFAULT_GCC_VERSION=4.0 BUILD_STYLE=Development CPP_HEADERMAP_FILE=/Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.build/Bombs.build/Bombs.hmap SRCROOT=/Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs OBJROOT=/Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build SYMROOT=/Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build DSTROOT=/tmp/Bombs.dst

PBXCp /Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.app/Contents/PkgInfo
/System/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp -exclude .DS_Store -exclude CVS -exclude .svn -resolve-src-symlinks /Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.build/Bombs.build/PkgInfo /Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.app/Contents

BuildPhase <CopyResources>Bombs.app

BuildPhase <DeriveAndCompileSources>Bombs.app

StandaloneExecutable /Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.app/Contents/MacOS/Bombs

StandaloneExecutable.LinkUsingFileList /Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.app/Contents/MacOS/Bombs
/usr/bin/g++-4.0 -o /Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.app/Contents/MacOS/Bombs "-L/Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build" "-F/Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build" -filelist /Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.build/Bombs.build/Objects-normal/LinkFileList "-arch" "ppc" "-prebind" "-Wl,-no_arch_warnings" "-L/usr/local/lib" "-framework" "QuickTime" "-framework" "IOKit" "-framework" "Carbon" "-framework" "Cocoa" "-framework" "System" "/usr/local/lib/libwx_mac_xrc-2.6.a" "/usr/local/lib/libwx_mac_qa-2.6.a" "/usr/local/lib/libwx_mac_html-2.6.a" "/usr/local/lib/libwx_mac_adv-2.6.a" "/usr/local/lib/libwx_mac_core-2.6.a" "/usr/local/lib/libwx_base_carbon_xml-2.6.a" "/usr/local/lib/libwx_base_carbon_net-2.6.a" "/usr/local/lib/libwx_base_carbon-2.6.a" "-lwxexpat-2.6" "-lwxtiff-2.6" "-lwxjpeg-2.6" "-lwxpng-2.6" "-lz" "-lpthread" "-liconv" "-lwxpng-2.6" "-lwx_base_carbon_xml-2.6" "-lwx_base_carbon-2.6" "-lwx_mac_core-2.6" "-lwxjpeg-2.6" "-lwx_base_carbon_net-2.6" "-lwx_mac_xrc-2.6" "-lwxexpat-2.6" "-lwx_mac_qa-2.6" "-lwxtiff-2.6" "-lwx_mac_media-2.6" "-lwx_mac_html-2.6" "-lwx_mac_adv-2.6"
/usr/bin/ld: warning prebinding disabled because of undefined symbols
/usr/bin/ld: Undefined symbols:
wxWindowBase::RegisterHotKey(int, int, int)
wxWindowBase::UnregisterHotKey(int)
collect2: ld returned 1 exit status
...failed StandaloneExecutable.LinkUsingFileList /Users/cedricdj/Huygens/Travail/LO11/bombs/Bombs/build/Bombs.app/Contents/MacOS/Bombs ...
 
Back
Top