Author Topic: Compiling on Mac OS X  (Read 50662 times)

TheWizzard

  • Guest
Compiling on Mac OS X
« on: August 30, 2005, 06:05:24 pm »
Hi,

I got pretty far with compiling Code::Blocks on Mac OS X, using gcc 3.3 and the bundled wxWidgets 2.5.x by making some changes to the source and makefile, but now I'm stuck. I know that Mac OS X isn't officially supported, but maybe you can help me anyway.

Here's what I get:
Quote

Linking shared library devel/libcodeblocks.so...
ld: Undefined symbols:
__ZTI8wxThread
__ZTI19wxTopLevelWindowMac
__ZTI8wxDialog
__ZN11wxScintilla10BraceMatchEi
__ZN11wxScintilla10GetEOLModeEv
__ZN11wxScintilla10GetStyleAtEi
__ZN11wxScintilla10GetUseTabsEv
__ZN11wxScintilla10InsertTextEiRK8wxString
__ZN11wxScintilla10MarkerNextEii
__ZN11wxScintilla10SetEOLModeEi
__ZN11wxScintilla10SetUseTabsEb
__ZN11wxScintilla10SetViewEOLEb
__ZN11wxScintilla10ToggleFoldEi
__ZN11wxScintilla11ConvertEOLsEi
__ZN11wxScintilla11DelLineLeftEv
__ZN11wxScintilla11GetTabWidthEv
__ZN11wxScintilla11SetEdgeModeEi
__ZN11wxScintilla11SetPropertyERK8wxStringS2_
__ZN11wxScintilla11SetReadOnlyEb
__ZN11wxScintilla11SetTabWidthEi
__ZN11wxScintilla11SetWrapModeEi
__ZN11wxScintilla12DelLineRightEv
__ZN11wxScintilla12GetFoldLevelEi
__ZN11wxScintilla12GetLastChildEii
__ZN11wxScintilla12GetLineCountEv
__ZN11wxScintilla12GetTextRangeEii
__ZN11wxScintilla12MarkerDefineEii
__ZN11wxScintilla12MarkerDeleteEii
__ZN11wxScintilla12ScrollToLineEi
__ZN11wxScintilla12SetFoldFlagsEi
__ZN11wxScintilla12SetSavePointEv
__ZN11wxScintilla12SetSelectionEii
__ZN11wxScintilla12SetTargetEndEi
__ZN11wxScintilla12StyleSetFontEiR6wxFont
__ZN11wxScintilla12ms_classInfoE
__ZN11wxScintilla13BraceBadLightEi
__ZN11wxScintilla13CallTipActiveEv
__ZN11wxScintilla13CallTipCancelEv
__ZN11wxScintilla13EndUndoActionEv
__ZN11wxScintilla13GetCurrentPosEv
__ZN11wxScintilla13ReplaceTargetERK8wxString
__ZN11wxScintilla13SetCurrentPosEi
__ZN11wxScintilla13SetEdgeColourERK8wxColour
__ZN11wxScintilla13SetEdgeColumnEi
__ZN11wxScintilla13SetMarginMaskEii
__ZN11wxScintilla13SetMarginTypeEii
__ZN11wxScintilla13SetTabIndentsEb
__ZN11wxScintilla13StyleClearAllEv
__ZN11wxScintilla13sm_eventTableE
__ZN11wxScintilla14BraceHighlightEii
__ZN11wxScintilla14GetCurrentLineEv
__ZN11wxScintilla14MarkerPreviousEii
__ZN11wxScintilla14ScrollToColumnEi
__ZN11wxScintilla14SetMarginWidthEii
__ZN11wxScintilla14SetTargetStartEi
__ZN11wxScintilla15BeginUndoActionEv
__ZN11wxScintilla15EmptyUndoBufferEv
__ZN11wxScintilla15GetFoldExpandedEi
__ZN11wxScintilla15GetSelectionEndEv
__ZN11wxScintilla15MarkerDeleteAllEi
__ZN11wxScintilla15SetFoldExpandedEib
__ZN11wxScintilla16LineFromPositionEi
__ZN11wxScintilla16PositionFromLineEi
__ZN11wxScintilla16ReplaceSelectionERK8wxString
__ZN11wxScintilla17GetSelectionStartEv
__ZN11wxScintilla17PositionFromPointE7wxPoint
__ZN11wxScintilla17SetMouseDwellTimeEi
__ZN11wxScintilla17SetViewWhiteSpaceEi
__ZN11wxScintilla17WordStartPositionEib
__ZN11wxScintilla18GetLineEndPositionEi
__ZN11wxScintilla18SetMarginSensitiveEib
__ZN11wxScintilla18SetPrintColourModeEi
__ZN11wxScintilla18StyleSetBackgroundEiRK8wxColour
__ZN11wxScintilla19GetFirstVisibleLineEv
__ZN11wxScintilla19MarkerSetBackgroundEiRK8wxColour
__ZN11wxScintilla19MarkerSetForegroundEiRK8wxColour
__ZN11wxScintilla19SetCaretLineVisibleEb
__ZN11wxScintilla20SetIndentationGuidesEb
__ZN11wxScintilla21SetBackSpaceUnIndentsEb
__ZN11wxScintilla22SetCaretLineBackgroundERK8wxColour
__ZN11wxScintilla3CutEv
__ZN11wxScintilla4CopyEv
__ZN11wxScintilla4RedoEv
__ZN11wxScintilla4UndoEv
__ZN11wxScintilla5PasteEv
__ZN11wxScintilla7CanRedoEv
__ZN11wxScintilla7CanUndoEv
__ZN11wxScintilla7GetLineEi
__ZN11wxScintilla7GetTextEv
__ZN11wxScintilla7GotoPosEi
__ZN11wxScintilla7SendMsgEill
__ZN11wxScintilla8CanPasteEv
__ZN11wxScintilla8ClearAllEv
__ZN11wxScintilla8GotoLineEi
__ZN11wxScintilla8UsePopUpEb
__ZN11wxScintilla9ColouriseEii
__ZN11wxScintilla9GetCharAtEi
__ZN11wxScintilla9GetModifyEv
__ZN11wxScintilla9HideLinesEii
__ZN11wxScintilla9MarkerAddEii
__ZN11wxScintilla9MarkerGetEi
__ZN11wxScintilla9SelectAllEv
__ZN11wxScintilla9ShowLinesEii
__ZN11wxScintillaC2EP8wxWindowiRK7wxPointRK6wxSizelRK8wxString
__ZN11wxScintillaD2Ev
__ZNK11wxScintilla13DoGetBestSizeEv
__ZTI10wxListBase
__ZTI11wxScintilla
__ZTI8wxObject
_wxEVT_SCI_CHANGE
_wxEVT_SCI_CHARADDED
_wxEVT_SCI_DWELLEND
_wxEVT_SCI_DWELLSTART
_wxEVT_SCI_MARGINCLICK
_wxEVT_SCI_UPDATEUI
_wxEVT_SCI_USERLISTSELECTION
_wxSCINameStr
__ZN11wxScintilla11FormatRangeEbiiP4wxDCS1_6wxRectS2_
__ZN11wxScintilla15GetSelectedTextEv
__ZN11wxScintilla9GetLengthEv
__ZTI10wxPrintout
__ZTI12wxEvtHandler
__ZN11wxScintilla10TextHeightEi
__ZN11wxScintilla17PointFromPositionEi
__ZTI7wxPanel
__ZN11wxScintilla11SetKeyWordsEiRK8wxString
__ZN11wxScintilla12StyleSetBoldEib
__ZN11wxScintilla14StyleSetItalicEib
__ZN11wxScintilla16SetSelBackgroundEbRK8wxColour
__ZN11wxScintilla17StyleSetUnderlineEib
__ZN11wxScintilla18SetCaretForegroundERK8wxColour
__ZN11wxScintilla18StyleSetForegroundEiRK8wxColour
__ZN11wxScintilla8SetLexerEi
__ZN11wxScintilla13SetCaretWidthEi
__ZN11wxScintilla7SetTextERK8wxString
__ZN11wxScintilla8LoadFileERK8wxString
__ZN11wxScintilla11GetReadOnlyEv
__ZN11wxScintilla13EnsureVisibleEi
__ZN11wxScintilla15ReplaceTargetREERK8wxString
__ZN11wxScintilla15WordEndPositionEib
__ZN11wxScintilla8FindTextEiiRK8wxStringi
__ZTI10wxNodeBase
__ZTI17wxGenericTreeCtrl
__ZTI18wxGenericImageList
__ZTI23wxGenericScrolledWindow
__ZTI10wxNotebook
__ZN17MSVCWorkspaceBase13addDependencyERK8wxStringS2_
__ZN17MSVCWorkspaceBase14updateProjectsEv
__ZN17MSVCWorkspaceBase15registerProjectERK8wxStringP9cbProject
__ZN17MSVCWorkspaceBase24addConfigurationMatchingERK8wxStringS2_S2_
__ZN17MSVCWorkspaceBase25addWorkspaceConfigurationERK8wxString
__ZN17MSVCWorkspaceBaseC2Ev
__ZN17MSVCWorkspaceBaseD2Ev
__ZTI17MSVCWorkspaceBase
__ZTI9wxProcess
__ZTI17wxGenericListCtrl
/usr/bin/libtool: internal link edit command failed
make: *** [devel/libcodeblocks.so] Error 1

zieQ

  • Guest
Re: Compiling on Mac OS X
« Reply #1 on: August 30, 2005, 06:14:35 pm »
Did you use the makefiles provided with C::B? Which version? CVS? Makefiles are outdated I think, that why you have these link errors. Hope someone could regenerate those makefiles in CVS, I'm do not have access to my home machine right now! There are some odds things with wx classes too, don't know why! Did you link wx library properly?
« Last Edit: August 30, 2005, 06:16:59 pm by zieQ »

TheWizzard

  • Guest
Re: Compiling on Mac OS X
« Reply #2 on: August 30, 2005, 06:25:06 pm »
Actually I just used the Makefile.unix. The only thing I changed is -shared to -dynamiclib, as Mac OS X needs that.

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Compiling on Mac OS X
« Reply #3 on: August 30, 2005, 06:39:59 pm »
Yeah, makefiles tend to get outdated, especially Makefile.unix. That's what you get when the usual way to build Code::Blocks is to use the C::B project file ;).
Looks like it hasn't been updated to include the wxScintilla sources yet, so it can't find a lot of stuff in there.

TheWizzard

  • Guest
Re: Compiling on Mac OS X
« Reply #4 on: August 30, 2005, 06:41:21 pm »
So I guess there's nothing I can do except wait?
Or can I somehow modify the Makefile?
I never needed to really get into Makefiles, although I have plenty of Linux experience.

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Compiling on Mac OS X
« Reply #5 on: August 30, 2005, 08:32:41 pm »
Well, it seems CodeBlocks-unix.cbp at least includes wxScintilla, so I exported a makefile for it and attached it. Zipped to meet both the size and file type restrictions of this board. You'll have to remodify it to work on OS X, I didn't do anything but export it.
Hope this helps.

EDIT: You mentioned you use wx 2.5.x, I'm not sure which project you need for that. Attached file is from CodeBlocks-unix.cbp, so for wx 2.4.

[attachment deleted by admin]
« Last Edit: August 30, 2005, 08:35:13 pm by Urxae »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Compiling on Mac OS X
« Reply #6 on: August 30, 2005, 09:09:29 pm »
Makefiles may be outdated for a while. They 're not constantly outdated :P
Judging by the error log, you probably used an older makefile. Newer CVS contains wxScintilla, which is what you 're missing.
So, update from CVS and everything should be fine again :)

Quote
I got pretty far with compiling Code::Blocks on Mac OS X, using gcc 3.3 and the bundled wxWidgets 2.5.x by making some changes to the source and makefile, but now I'm stuck. I know that Mac OS X isn't officially supported, but maybe you can help me anyway.
It 's not supported because none of us owns a Mac :P
We 'd be glad though to have Mac-guy on board :D

*EDIT*:
Notice that under linux it only works with wx2.4 currently. So if you finally build it but it doesn't run, don't despair. It might have the same problem with the linux port. In that case, either try to fix it (and many users will be greatful :) ), or use wx2.4.
« Last Edit: August 30, 2005, 09:11:43 pm by mandrav »
Be patient!
This bug will be fixed soon...

TheWizzard

  • Guest
Re: Compiling on Mac OS X
« Reply #7 on: August 30, 2005, 09:30:02 pm »
I use the latest CVS and did a make clean but now it already fails at libwxscintilla.so.

I think I'll just build wx 2.6 from source and try again then. I'll let you know if it works (or at least compiles)

TheWizzard

  • Guest
Re: Compiling on Mac OS X
« Reply #8 on: August 30, 2005, 10:06:20 pm »
Well,

The Makefile.unix.wx2.6 doesn't seem to include scintilla :(
and the other one won't work with wx 2.6, will it?

TheWizzard

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Compiling on Mac OS X
« Reply #9 on: August 30, 2005, 10:57:46 pm »
Sorry, my bad  :oops:
Because the linux port doesn't work with wx2.6, the relevant project file and makefile were outdated...

I 'm updating both now.
Because anonymous cvs lags a few hours, I 'm attaching a (hopefully) correct Makefile.unix.wx2.6 as a zip file.
If it doesn't work, try Makefile.unix. You will only have to change the lib names for wx...

[attachment deleted by admin]
Be patient!
This bug will be fixed soon...

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 836
Re: Compiling on Mac OS X
« Reply #10 on: August 30, 2005, 11:17:32 pm »
Hi, maybe I've found the cause of crashes under wx2.6 - some compiler flags set globally in wx2.6 project changed calling convention for some functions what was the cause of seg faults. In wx2.4 projet there's only `wx-config --cflags` left. After removing other flags it compiles and runs without any crashes at the beginning :)
I've to check it once more since I've checked out whole repository (I've messed in source code too much to find the cause of crashes ;) ). But I guess it will work :)

Yep. I've really seen C::B on Linux using wx 2.6 :D

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Compiling on Mac OS X
« Reply #11 on: August 31, 2005, 12:22:11 am »
Calling conventions?  :? Please explain further... this is some area where i'm a total n00b.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 836
Re: Compiling on Mac OS X
« Reply #12 on: August 31, 2005, 12:35:04 am »
Calling conventions?  :? Please explain further... this is some area where I'm a total n00b.

I think the cause of crashes on wx 2.6 was that wx code was compiled with one configuration of passing arguments and return values from functions and C::B with second one. In such case stack frames are incorrectly created - arguments may be shifted in stack space and incorrectly read. F. ex. reading address of place where to store result instead of 'this' pointer (what probably caused crashes in simple GetClientSize() function ).

I guess that -fno-pcc-struct-return compiler flag messed here ;)

I've attached project and makefile in http://forums.codeblocks.org/index.php/topic,824.msg5737.html#msg5737

And hope that wx 2.6 will soon be also supported ;)

xjluo

  • Guest
Re: Compiling on Mac OS X
« Reply #13 on: August 31, 2005, 05:02:15 am »
The byo's solution succeeded on my Debian Linux with wxGTK-2.6.1, but failed on Mac OS X with wxMac-2.6.1.
I have downloaded the CVS version and replaced following setting in the Makefile:
-shared --> -dynamiclib
-D__WXGTK__ --> -D__WXMAC__
.so -> .dylib
and added -D__WXMAC_CARBON__ to all ???_GLOBAL_CFLAGS to avoid wxGenericImageList link error.
It finally stops on wxDockit compiling and says "Your platform does not currently support wxGdi".

Does anyone else have more information on Mac OS X platform?

grv575

  • Guest
Re: Compiling on Mac OS X
« Reply #14 on: August 31, 2005, 05:33:25 am »
The -fno-pcc-struct-return flag is probably no longer needed for the windows version either.
http://64.233.187.104/search?q=cache:DVNNfK54IZoJ:www.bzzt.net/~wxwindows/xmldocs/generating/texdocs/wxWidgets/src/makeg95.env+fno-pcc-struct-return&hl=en&client=firefox-a

It was needed to workaround an mingw bug (prior to 08/98).

xjluo:
even the 2.1 wxDockit say:
"NOTE: wxDockIt currently supports only the wxGTK port of wxWidgets.
       wxX11 and wxMotif cannot be used with wxDockIt."

So I guess wxMAC won't work with wxDockit.