Re: GCC linker error... Help?

Richard Henderson (
Mon, 11 Nov 1996 22:52:37 -0600 (CST)

> I am trying to compile the VTK, a mesa program for data
> visualization, and have run into a problem I wondered if anyone else new
> about.
> c++ -o vtk tkAppInit.o vtkAutoInit.o vtkTclUtil.o \
> -L. -lvtkTcl vtkXRenderWindowInteractor.o \
> -L../src -lvtk -L/usr/X11R6/lib -lGL /usr/lib/ /usr/lib/
> -ldl -L/usr/X11R6/lib -lXext -lXt -lSM -lICE -lX11 -lm
> /usr/lib/gcc-lib/alpha-linux/2.7.2/crtend.o(.text+0x14): relocation truncated
> to fit: LITERAL __CTOR_END__
> relocation truncated to fit: LITERAL $C229

There are two possible problems:

1) less likely, you are mixing ELF and ECOFF object files or libraries.

2) you've run into a limit in the current ELF linker in the size of the
.got section (which is related to the number of global variables and
functions in the program).

Assuming the second, there is a way that you can work around the problem
right now: turn some of your static libraries into shared libraries.

>From your link line, there appear to be three likely candidates:
-lvtkTcl, -lvtk, and -lGL. The link line for doing that is

gcc -shared -o <library>.so -Wl,--whole-archive <library>.a \

Now you have three options: (1) you can either put the newly created
shared libraries in one of the standard library directories, (2) if
you have a dedicated directory heirarchy for your application (e.g.
/usr/local/vtk/) you can put them in /usr/local/vtk/lib and add that
to your /etc/, or (3) you can pick a directory (usually
the one the executable resides in) and add -Wl,-rpath=<directory> to
the link line _for the executable_.


To unsubscribe: send e-mail to with
'unsubscribe' as the subject.  Do not send it to

Feedback | Store | News | Support | Product Errata | About Us | Linux Info | Search | JumpWords
No Frames | Show Frames

Copyright © 1995-1997 Red Hat Software. Legal notices