Building dependent shared libs with cygwin

Hi Axel,

Thanks for the advice, unfortunately it doesn’t work any better than before. I still get an enormous list of ‘multiple definition’ errors when I try to build the second library, starting like this :

/home/frankland/lib/libKVMultiDet.dll(.text+0x0):streambuf-inst.cc: multiple definition of ___do_sjlj_init' /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/crtbegin.o(.text+0x0):crtstuff.c: first defined here /home/frankland/lib/libKVMultiDet.dll(.text+0xd92c0):streambuf-inst.cc: multiple definition ofKVBase::List()'
KVINDRA.o(.text$_ZN6KVBase4ListEv[KVBase::List()]+0x0):KVINDRA.cpp: first defined here
/home/frankland/lib/libKVMultiDet.dll(.text+0xdb6c0):streambuf-inst.cc: multiple definition of TNamed::IsSortable() const' KVINDRA.o(.text$_ZNK6TNamed10IsSortableEv[TNamed::IsSortable() const]+0x0):KVINDRA.cpp: first defined here /home/frankland/lib/libKVMultiDet.dll(.text+0xdb6d0):streambuf-inst.cc: multiple definition ofTNamed::Hash() const’
KVINDRA.o(.text$_ZNK6TNamed4HashEv[TNamed::Hash() const]+0x0):KVINDRA.cpp: first defined here
/home/frankland/lib/libKVMultiDet.dll(.text+0xdb6f0):streambuf-inst.cc: multiple definition of TNamed::GetName() const' KVINDRA.o(.text$_ZNK6TNamed7GetNameEv[TNamed::GetName() const]+0x0):KVINDRA.cpp: first defined here /home/frankland/lib/libKVMultiDet.dll(.text+0xdb700):streambuf-inst.cc: multiple definition ofTNamed::GetTitle() const’
KVINDRA.o(.text$_ZNK6TNamed8GetTitleEv[TNamed::GetTitle() const]+0x0):KVINDRA.cpp: first defined here
/home/frankland/lib/libKVMultiDet.dll(.text+0xdb860):streambuf-inst.cc: multiple definition of `TObject::GetOption() const’
KVINDRA.o(.text$_ZNK7TObject9GetOptionEv[TObject::GetOption() const]+0x0):KVINDRA.cpp: first defined here
etc. etc.

and ending like this :

KVIDGCsI.o(.text+0x672):KVIDGCsI.cpp: multiple definition of __fu61___ZTV5TIter' /home/frankland/lib/libKVMultiDet.dll(.text+0x55a2):streambuf-inst.cc: first defined here KVIDGCsI.o(.text+0x798):KVIDGCsI.cpp: multiple definition of__fu62___ZTV5TIter’
/home/frankland/lib/libKVMultiDet.dll(.text+0x7c65):streambuf-inst.cc: first defined here
KVIDGCsI.o(.text+0xea2):KVIDGCsI.cpp: multiple definition of `__fu63___ZTV5TIter’
/home/frankland/lib/libKVMultiDet.dll(.text+0x855b):streambuf-inst.cc: first defined here
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/…/…/…/…/i686-pc-cygwin/bin/ld: BFD 2.15.94 20041229 assertion fail /netrel/src/binutils-20041229-1/bfd/cofflink.c:2270
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/…/…/…/…/i686-pc-cygwin/bin/ld: /home/frankland/lib/libKVMultiDet.dll(d011375.o): illegal symbol index -397360059 in relocs
collect2: ld returned 1 exit status

Here is my link for the first library :

g++ -shared -Wl,–enable-runtime-pseudo-reloc -Wl,–export-all-symbols KVBase.o KVDetectorEvent.o KVDetector.o KVEvent.o KVList.o KVRList.o KVMaterial.o KVModule.o KVMultiDetArray.o KVNucleus.o KVParticle.o KVPosition.o KVRing.o KVTelescope.o KVTestEvent.o KVLayer.o KVGroup.o KVCalibrator.o KVReconstructedNucleus.o KVBrowser.o KVDetectorBrowser.o KVWidget.o KVWidgetList.o KVMultiDetBrowser.o KVLayerBrowser.o KVRingBrowser.o KVBrowserWidget.o KVACQParam.o KVBrowserNameDialog.o KVTarget.o KVDataBase.o KVDBKey.o KVDBRecord.o KVDBTable.o KVRegister.o KVIDTelescope.o KV2Body.o KVDataBaseBrowser.o KVIDLine.o KVIDZLine.o KVIDZALine.o KVIDGrid.o KVIDZGrid.o KVIDZAGrid.o KVRegBinary.o KVIDGridManager.o KVMultiDetDict.o -Wl,–enable-auto-import -L/usr/X11R6/lib -L/cygdrive/c/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lMatrix -lRint -lPhysics -lGui -o libKVMultiDet.dll

And here is the second link, including the link to the first library :

g++ -shared -Wl,–enable-runtime-pseudo-reloc -Wl,–export-all-symbols KVINDRA.o KVSilicon.o KVChIo.o KVCsI.o KVPhoswich.o KVINDRAReconNuc.o KVINDRAReconEvent.o KVChannelVolt.o KVVoltEnergyAlpha.o KVChannelEnergyAlpha.o KVDBParameterSet.o KVDBRun.o KVDBSystem.o KVDBTape.o KVINDRACodes.o KVDBAlphaPeak.o KVINDRADB.o KVLineCSV.o KVINDRACodeMask.o KVChannelEnergyBrho.o KVIDSiCsI.o KVIDChIoSi.o KVIDCsI.o KVLineDST.o KVINDRADB1.o KVUpDater.o KVUpDater1.o KVINDRADB2.o KVUpDater2.o KVINDRA2.o KVINDRADB4.o KVUpDater4.o KVINDRA4.o KVIDPhoswich.o KVIDChIoCsI.o KVIDChIoSi75.o KVIDSi75SiLi.o KVIDSiLiCsI.o KVDBElasticPeak.o KVDBPeak.o KVChannelEnergyChIo.o KVLightEnergyCsI.o KVIDCsIRLLine.o KVIDGCsI.o KVIDGChIoSi.o KVIndraDict.o -Wl,–enable-auto-import -L/home/frankland/lib -lKVMultiDet -L/usr/X11R6/lib -L/cygdrive/c/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lMatrix -lRint -lPhysics -lGui -o libKVIndra.dll

What am I doing wrong ?
Thanks a lot
John

PS. I did read the “ld” and “gcc” man pages, unfortunately it didn’t make me any wiser - well, actually I think I might have fallen into a coma before getting to the end… :open_mouth: