Author Topic: Trying to build minimal project under OSX : Undefined symbols related to OSX  (Read 5868 times)

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Trying to build a first minimal wxWidgets-based test under OSX using Code::Blocks, I succeeded to compil, then statically link with wxWidgets, but it sounds like underlying OSX libraries are not found. Here the error :

Code: [Select]
-------------- Build: Release in wx29_test2 (compiler: GNU GCC Compiler)---------------

Linking executable: bin/Release/wx29_test2
Undefined symbols for architecture i386:
  "_CFStringCreateWithCStringNoCopy", referenced from:
      GetEncTable(wxFontEncoding)       in libwx_baseu-2.9.a(baselib_encconv.o)
  "_CFStringGetCharacters", referenced from:
      GetEncTable(wxFontEncoding)       in libwx_baseu-2.9.a(baselib_encconv.o)
      wxMBConv_cf::ToWChar(wchar_t*, unsigned long, char const*, unsigned long) constin libwx_baseu-2.9.a(baselib_strconv_cf.o)
  "_kCFAllocatorNull", referenced from:
      GetEncTable(wxFontEncoding)       in libwx_baseu-2.9.a(baselib_encconv.o)
      wxBitmapDataObject::SetData(unsigned long, void const*)in libwx_osx_cocoau_core-2.9.a(corelib_carbon_dataobj.o)
      GetEncTable(wxFontEncoding)       in libwx_baseu-2.9.a(baselib_encconv.o)
      wxBitmapDataObject::SetData(unsigned long, void const*)in libwx_osx_cocoau_core-2.9.a(corelib_carbon_dataobj.o)
  "_CFStringCreateWithCharacters", referenced from:
      wxMacHFSUniStrToString(HFSUniStr255 const*) in libwx_baseu-2.9.a(baselib_filefn.o)
  "_CFURLCreateWithFileSystemPath", referenced from:
      wxMacPathToFSRef(wxString const&, FSRef*)in libwx_baseu-2.9.a(baselib_filefn.o)
      wxLaunchDefaultApplication(wxString const&, int)in libwx_osx_cocoau_core-2.9.a(corelib_utils_osx.o)
      wxMacLaunch(char**) in libwx_baseu-2.9.a(baselib_utilsexc_base.o)
      wxDataObject::AddToPasteboard(void*, int)in libwx_osx_cocoau_core-2.9.a(corelib_carbon_dataobj.o)
      -[wxOpenPanelDelegate panel:shouldShowFilename:] in libwx_osx_cocoau_core-2.9.a(corelib_osx_cocoa_filedlg.o)
  "_CFURLGetFSRef", referenced from:
      wxMacPathToFSRef(wxString const&, FSRef*)in libwx_baseu-2.9.a(baselib_filefn.o)
      wxIcon::LoadIconFromBundleResource(wxString const&, int, int)in libwx_osx_cocoau_core-2.9.a(corelib_carbon_icon.o)
      -[wxOpenPanelDelegate panel:shouldShowFilename:] in libwx_osx_cocoau_core-2.9.a(corelib_osx_cocoa_filedlg.o)
  "_FSGetCatalogInfo", referenced from:
      wxMacFilename2FSSpec(wxString const&, FSSpec*)in libwx_baseu-2.9.a(baselib_filefn.o)
  "_CFURLCreateFromFSRef", referenced from:
      wxMacFSRefToPath(FSRef const*, __CFString const*)in libwx_baseu-2.9.a(baselib_filefn.o)
      -[wxOpenPanelDelegate panel:shouldShowFilename:] in libwx_osx_cocoau_core-2.9.a(corelib_osx_cocoa_filedlg.o)
  "_CFURLCreateCopyAppendingPathComponent", referenced from:
      wxMacFSRefToPath(FSRef const*, __CFString const*)in libwx_baseu-2.9.a(baselib_filefn.o)
  "_FSpMakeFSRef", referenced from:
      wxMacFSSpec2MacFilename(FSSpec const*)in libwx_baseu-2.9.a(baselib_filefn.o)
  "_CFLocaleCreate", referenced from:
      wxLocale::GetInfo(wxLocaleInfo, wxLocaleCategory)      in libwx_baseu-2.9.a(baselib_intl.o)
  "_CFDateFormatterCreate", referenced from:
      wxLocale::GetInfo(wxLocaleInfo, wxLocaleCategory)      in libwx_baseu-2.9.a(baselib_intl.o)
  "_CFDateFormatterGetFormat", referenced from:
      wxLocale::GetInfo(wxLocaleInfo, wxLocaleCategory)      in libwx_baseu-2.9.a(baselib_intl.o)
Aborting process 0 ...

So, what sould I do ? Should I add a list of libraries (like under Windows) in C::B project's linker options ? Or some search directories ? Or... Well, I don't know...
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Using `wx-config --libs` in the extra linker flags section normally works fine.

Offline eranon

  • Almost regular
  • **
  • Posts: 180
It's what I did, afb. But, it sounds like it's more a matter of "framework" (I've learned the word this morning - lol) in the OSX terminology. So, Auria helped me at http://forums.wxwidgets.org/viewtopic.php?f=19&t=36458&p=148739 and I added some frameworks in linker options. Previous errors are gone, but it remains some. So, now, I've to figure-out what's the right list of frameworks to provide and, maybe, in what manner it's binded with the SDK I indicated in compiler options (my wxWidgets static lib and my project, both, have been compiled with -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5).

--
EDIT : solved ! I've had to add the "wx-config --libs" output manually in the linker options, rather than using a `wx-config --libs` call. In compiler options, it seems to work, but apparently not in linker ones (or partially).
« Last Edit: December 05, 2012, 08:11:32 pm by eanon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]