🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52175

Shared Libraries

#52175
From: David Campbell
Date: Tue, 02 Feb 1993 00:09
138 lines
7154 bytes
Can somebody please explain my problem here with building shared libraries
with G++.  This compile works properly when built using Sun C++2.1, and it also
works when built statically using G++.

I'm using G++ 2.3.3 linking with Sun's linker under SunOS 4.1.3.

I get a bunch of unresolved symbols which are all defined in libxs.sa.0.1,
as C [common] type symbols (different from Sun C++2.1 which defines
them as D [data] type symbols).  I tried using the -fno-common flag to G++
which changed the symbol definitions to D, but didn't help at all.

Your help would be appreciated.

[mizar:/proj/dv/xs/src] make
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsfunctions.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsdisplay.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xslist.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsjlist.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xstype.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xshandler.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsstack.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xspointstack.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsxpointstack.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xscleverxpointstack.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsxarcstack.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xssubdob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsdob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xssubicon.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsicon.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xscolormap.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xslinedob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xslinecoredob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xspointdob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xspolygondob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsicondob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsimagedob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsgridlinedob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xslegend.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xspolygoncoredob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xspicturedob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsovaldob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xslegdob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xslegsubdob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xslegmanager.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xstextsubdob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xstextdob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsdistancedob.cc
g++2.3.3  -g -DXSINTERNAL -fPIC -c xstestmap.cc
ld -dp -o libxs.so.0.1 -assert pure-text xsfunctions.o xsmap.o xslayer.o xsdispl
ay.o xslist.o  xsjlist.o xstype.o xshandler.o xsstack.o xspointstack.o xsxpoints
tack.o  xscleverxpointstack.o xsxarcstack.o xssubdob.o xsdob.o xssubicon.o  xsic
on.o xscolormap.o xslinedob.o xslinecoredob.o xspointdob.o  xspolygondob.o xsico
ndob.o xsimagedob.o xsgridlinedob.o xslegend.o  xspolygoncoredob.o xspicturedob.
o xsovaldob.o xslegdob.o  xslegsubdob.o xslegmanager.o xstextsubdob.o xstextdob.
o  xsdistancedob.o xstestmap.o
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsglobals.cc
ar rl libxs.sa.0.1 xsglobals.o
ranlib libxs.sa.0.1
ar rl libxs.a xsfunctions.o xsmap.o xslayer.o xsdisplay.o xslist.o  xsjlist.o xs
type.o xshandler.o xsstack.o xspointstack.o xsxpointstack.o  xscleverxpointstack
.o xsxarcstack.o xssubdob.o xsdob.o xssubicon.o  xsicon.o xscolormap.o xslinedob
.o xslinecoredob.o xspointdob.o  xspolygondob.o xsicondob.o xsimagedob.o xsgridl
inedob.o xslegend.o  xspolygoncoredob.o xspicturedob.o xsovaldob.o xslegdob.o  x
slegsubdob.o xslegmanager.o xstextsubdob.o xstextdob.o  xsdistancedob.o xstestma
p.o xsglobals.o
ar: filename xscleverxpointstack.o truncated to xscleverxpoints
ar: filename xspolygoncoredob.o truncated to xspolygoncoredo
ranlib libxs.a
g++2.3.3  -g -DXSINTERNAL -fPIC -c xstest.cc
xstest.cc: In function `int  main (int, char **)':
xstest.cc:91: warning: implicit declaration of function `select'
g++2.3.3  -g -DXSINTERNAL -fPIC -c xsdemo.cc
g++2.3.3 -o xsdemo xsdemo.o -L.  -lxs -lX11 -lm
ld: Undefined symbol
   _XsFlashOn
   _XsWarn
   _XsMaps
   _XsDisplays
   _XsDebug
   _XsDebug2
   _XsGlobalMaskTimeStamp
   __19XsCleverXPointStack$YCutHiI
   __19XsCleverXPointStack$YCutLoI
   __19XsCleverXPointStack$XCutHiI
   __19XsCleverXPointStack$XCutLoI
   __19XsCleverXPointStack$FirstOne
   __19XsCleverXPointStack$LastX
   __19XsCleverXPointStack$LastY
   __19XsCleverXPointStack$Scale
   __19XsCleverXPointStack$Y0
   __19XsCleverXPointStack$X0
   __19XsCleverXPointStack$FirstX
   __19XsCleverXPointStack$FirstY
   __19XsCleverXPointStack$YCutHi
   __19XsCleverXPointStack$XCutHi
   __19XsCleverXPointStack$YCutLo
   __19XsCleverXPointStack$XCutLo
   _XsNowhere
   _XsRandomValue
   __13XsLineCoreDob$iEventDrivenDraw
   __9XsOvalDob$iEventDrivenDraw
   __11XsMapTester$iDistanceDob
   __11XsMapTester$iGridLineDob
   __11XsMapTester$iImageDob
   __11XsMapTester$iAllTanks
   __11XsMapTester$iGraveIcon
   __11XsMapTester$iXsIcon
   __11XsMapTester$iMapTesters
collect: /usr/bin/ld returned 2 exit status
*** Error code 1
make: Fatal error: Command failed for target `xsdemo'
[mizar:/proj/dv/xs/src] nm -o lib* | grep _XsRandomValue
libxs.a:xsdob.o:         U _XsRandomValue
libxs.a:xsglobals.o:00000008 C _XsRandomValue
libxs.sa.0.1:xsglobals.o:00000008 C _XsRandomValue
[mizar:/proj/dv/xs/src] g++2.3.3 -static -o xsdemo xsdemo.o -L. -lxs -lX11 -lm
[mizar:/proj/dv/xs/src]

Then I used the -v option on GCC to find out the command it was using and I
tried making it use the sun linker:

[mizar:/proj/dv/xs/src] /bin/ld -e start -dc -dp -o xsdemo /lib/crt0.o -L. -L/u
sr/local/lib/gcc-lib/sun4/2.3.3 -L/usr/local/lib xsdemo.o -lxs -lX11 -lg++ -lm
-lgcc -lc -lgcc
<same link errors here too>

-- 
  +--------------------------------------------------+-----------------------+
  | Dave Campbell                                    |            UNIX & C++ |
  | Phone: + 61 6 275 0944      Fax: + 61 6 257 1052 |   _--_|\       PLEASE |
  | CSIRO Division of Information Technology         |  /      \             |
  | Centre for Spatial Information Systems           |  \_.--._/ <- Canberra |
  | PO BOX 664                                       |        v              |
  | CANBERRA ACT 2601       +------------------------+                       |
  | AUSTRALIA               | dave@csis.dit.csiro.au |                       |
  +-------------------------+------------------------+-----------------------+
  |                       Get right.....or get left.                         |
  +--------------------------------------------------------------------------+
Technical Details
Message-ID: <1993Feb2.000925.26627@csis.dit.csiro.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!udel!darwin.sura.net!sgiblab!munnari.oz.au!manuel.anu.edu.au!dubhe.anu.edu.au!csis!mizar!dave

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,96c3208dc01a486c,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-02-01 16:09:25 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!udel!darwin.sura.net!sgiblab!munnari.oz.au!manuel.anu.edu.au!dubhe.anu.edu.au!csis!mizar!dave
From: dave@mizar.csis.dit.csiro.au (David Campbell)
Subject: Shared Libraries
Message-ID: <1993Feb2.000925.26627@csis.dit.csiro.au>
Sender: dave@mizar (David Campbell)
Nntp-Posting-Host: mizar
Organization: CSIRO Division of Information Technology
Date: Tue, 2 Feb 1993 00:09:25 GMT
Lines: 138