Sorry of this is off topic, but I have been attempting to port DS9, a astronomical image editing program to X - windows on OSX and I have run into a problem. In order to build DS9 the BLT library for TK/TCL must be built. At the link stage for the dynamic libraries I am getting an error that the symbol dyld_stub_binding_helper is undefined.
Can anyone help me resolve the cause of this error?
Here is the link command and error:
ld -dynamic -o libBLT24.dylib bltInit.o bltGrAxis.o bltGrBar.o bltGrElem.o bltGrGrid.o bltGrHairs.o bltGrLegd.o bltGrLine.o bltGrMarker.o bltGrMisc.o bltGrPen.o bltGrPs.o bltGraph.o bltBgexec.o bltChain.o bltDebug.o bltList.o bltNsUtil.o bltParse.o bltSpline.o bltTree.o bltTreeCmd.o bltUnixPipe.o bltUtil.o bltVector.o bltWatch.o bltBeep.o bltBind.o bltBitmap.o bltBusy.o bltCanvEps.o bltColor.o bltConfig.o bltContainer.o bltCutbuffer.o bltDnd.o bltHierbox.o bltHiertable.o bltHtCmd.o bltHtColumn.o bltHtText.o bltHtext.o bltImage.o bltPs.o bltTable.o bltTabnotebook.o bltTabset.o bltText.o bltTile.o bltUnixDnd.o bltWindow.o bltWinop.o tkButton.o tkFrame.o tkScrollbar.o bltTed.o -L/Users/bruce/Documents/DS9/saods9/lib -ltk8.3 -ltcl8.3 -L/usr/X11R6/lib -lX11 -L/usr/lib -L/usr/local/lib -L/usr/lib/gcc/darwin/default/ -lm
ld: Undefined symbols:
Not really off topic. We setup the XonX-Porting list here for this kind of discussion, but so far it hasn't gotten any traffic. In any case, I would suggest you use cc to link things rather than directly calling ld. If you are trying to build a dynamic shared library you would use cc with the -dynamiclib option. The nice thing about cc is that it takes care of making sure all the correct flags are passed to ld. In this case, if you are trying to build a dynamic shared library, you would likely want to pass -dylib to ld in addition to -dynamic.
Thanks for the advice. Using cc is not really an option because of the complexity of the make file and the number changes which would have to be made. I tried adding -dylib to the ld command with the following results (at least the previous error is gone):
ld: common symbols not allowed with MH_DYLIB output format
bltImage.o definition of common _blueMaskShift (size 4)
bltImage.o definition of common _greenMaskShift (size 4)
bltImage.o definition of common _redMaskShift (size 4)
bltHiertable.o definition of common _bltHiertableLastInstance (size 4)
bltImage.o definition of common _blueAdjust (size 4)
bltImage.o definition of common _greenAdjust (size 4)
bltImage.o definition of common _redAdjust (size 4)
/Users/bruce/Documents/DS9/saods9/lib/libtk8.3.a(tkStubLib.o) definition of common _tkIntPlatStubsPtr (size 4)
/Users/bruce/Documents/DS9/saods9/lib/libtk8.3.a(tkStubLib.o) definition of common _tkIntStubsPtr (size 4)
/Users/bruce/Documents/DS9/saods9/lib/libtk8.3.a(tkStubLib.o) definition of common _tkIntXlibStubsPtr (size 4)
/Users/bruce/Documents/DS9/saods9/lib/libtk8.3.a(tkStubLib.o) definition of common _tkPlatStubsPtr (size 4)
/Users/bruce/Documents/DS9/saods9/lib/libtk8.3.a(tkStubLib.o) definition of common _tkStubsPtr (size 4)
/Users/bruce/Documents/DS9/saods9/lib/libtk8.3.a(tkMain.o) definition of common _dataKey (size 4)
Cool. This is shaping up to be a Darwin porting primer. You have two choices to eliminate the common symbols:
1. The easy way: Make sure that everything is compiled in the first place with the cc option -fno-common.
2. The harder "proper" way: Go through and eliminate all the common symbols in the source code. By this I mean make sure that all global variables are initialized. So, for example, if you see:
int someVar = 0;
Well I tried your suggestions for compilation and linking (I do not want to have to edit the source files). When I re-built BLT all of the link errors related to the blt*.o files disappeared but not the ones in the libtk8.3.a. I then went back to th tk directory and modified the make file to use -fno-common and -dynamiclib options. The libraries appeared to build correctly, but when I tried to link the blt library I ended up with the same error.
It would appear that there is something basically incompatible with Darwin in this distribution. Perhaps the ./configure files are too old (isn't the configure file a common file for most unix/linux packages?).
This is a complex build which, in addition to DS9, also has to build TK and TCL versions 8.3.2 as well as BLT. This is a more complicated project than I have worked previously and I may be in over my head. I want to keep plugging away on this in my spare time because I really need this package for my astronomy work.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.