gcc not working

I have installed gcc's c compiler ( package downloaded and added). I tested it . It is working fine from last 2 months. now suddenly it giving error. when i compile any c file
$ gcc test.c

ld.so.1: /usr/ccs/bin/ld: fatal: relocation error: file /usr/ccs/lib/libld.so.2: symbol _elf_getxoff: referenced symbol not found
gcc: Internal compiler error: program ld got fatal signal 9

what is wrong ? I reinstalled the package. but still it is giving the same error why? please help...
thank u.
rama_krishnaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
moduloConnect With a Mentor Commented:
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0
 
jlevieCommented:
This is a Solaris system, right? What version?

Have you made any changes in the system recently, other than to re-install gcc?

What's happening is that when gcc has compiled your code it then invokes Sun's ld program to link the object code and libraries. ld is complaining that it can't find a particular symbol in /usr/ccs/li/libld.so.2. In fact, that reference is actually a symbolic link to /usr/lib/libld.so.2. Check to be sure that the target of the link is still there. I'd think you'd get a different error if it was missing, but...
0
 
rama_krishnaAuthor Commented:
OS is intel sun solaris 2.6. I have not made any changes to the system recently. /usr/ccs/li/libld.so.2 is there which is linked to /usr//lib/libld.so.2 ( which is also present).
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
ahoffmannCommented:
please post result when you call gcc with -v option
0
 
rama_krishnaAuthor Commented:
When i do
@gcc -v file1.c
the output is
gcc -v test1.c
Reading specs from /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/specs
gcc version 2.8.1
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=8 -Dunix -D__svr4__ -D__SVR4 -Dsun -D__unix__ -D__svr4__ -D__SVR4 -D__sun__ -D__unix -D__sun -Asystem(svr4) -Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -Asystem(unix) -Acpu(i386) -Amachine(i386) test1.c /var/tmp/ccsTOQt_.i
GNU CPP version 2.8.1 (i386 System V Release 4)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/i386-pc-solaris2.6/include
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/cc1 /var/tmp/ccsTOQt_.i -quiet -dumpbase test1.c -version -o /var/tmp/ccsTOQt_.s
GNU C version 2.8.1 (i386-pc-solaris2.6) compiled by GNU C version 2.8.1.
 /usr/ccs/bin/as -V -Qy -o /var/tmp/ccsTOQt_1.o /var/tmp/ccsTOQt_.s
as: WorkShop Compilers 4.2 alpha 14 Jun 1996
 /usr/ccs/bin/ld -V -Y P,/usr/ccs/lib:/usr/lib -Qy /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crt1.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crti.o /usr/ccs/lib/values-Xa.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtbegin.o -L/usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1 -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/local/lib /var/tmp/ccsTOQt_1.o -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtend.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtn.o
ld: Software Generation Utilities - Solaris-ELF (4.0)
Undefined                       first referenced
 symbol                             in file
sqlcxt                              /var/tmp/ccsTOQt_1.o
ld: fatal: Symbol referencing errors. No output written to a.out
0
 
ahoffmannCommented:
very simple:
  you have a reference to sqlcxt  (variable or procedure) somewhere in your test1.c

Either remove this reference (if possible), or specify the lib where to find it using the -l option.
0
 
jlevieCommented:
Hmm, I wonder if the problem all along has been a messed up LD_LIBRARY_PATH. Obviously, as ahoffmann has noted, that C code is refernencing functions that aren't in any of the standard GCC or system libraries, probably some SQL function.

What is LD_LIBRARY_PATH set to ('echo $LD_LIBRARY_PATH' should tell)?

What happens if you try to compile:

#include <stdio.h>
main(){printf("Welcome to my nightmare\n");}
0
 
ahoffmannCommented:
hmm, I know that Sun's bundled ld evaluate LD_LIBRARY_PATH for finding libs (if not told to do otherwise), but there was no lib given on command line, and sqlcxt is not a symbol in any lib linked against by default.
0
 
rama_krishnaAuthor Commented:
yes that program contains one sql statement. Even normal c programm is also not running.
my c programme is
#######
#include <stdio.h>
main(){
printf("Hello world");
}

The error i got after $ gcc -v test.c
is
Reading specs from /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/specs
gcc version 2.8.1
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=8 -Dunix -D__svr4__ -D__SVR4 -Dsun -D__unix__ -D__svr4__ -D__SVR4 -D__sun__ -D__unix -D__sun -Asystem(svr4) -Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -Asystem(unix) -Acpu(i386) -Amachine(i386) anil.c /var/tmp/cc0088fq.i
GNU CPP version 2.8.1 (i386 System V Release 4)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/i386-pc-solaris2.6/include
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/cc1 /var/tmp/cc0088fq.i -quiet -dumpbase anil.c -version -o /var/tmp/cc0088fq.s
GNU C version 2.8.1 (i386-pc-solaris2.6) compiled by GNU C version 2.8.1.
 /usr/ccs/bin/as -V -Qy -o /var/tmp/cc0088fq1.o /var/tmp/cc0088fq.s
as: WorkShop Compilers 4.2 alpha 14 Jun 1996
 /usr/ccs/bin/ld -V -Y P,/usr/ccs/lib:/usr/lib -Qy /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crt1.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crti.o /usr/ccs/lib/values-Xa.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtbegin.o -L/usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1 -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/local/lib /var/tmp/cc0088fq1.o -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtend.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtn.o
ld: Software Generation Utilities - Solaris-ELF (4.0)
ld.so.1: /usr/ccs/bin/ld: fatal: relocation error: file /usr/ccs/lib/libld.so.2: symbol _elf_getxoff: referenced symbol not found
gcc: Internal compiler error: program ld got fatal signal 9
0
 
rama_krishnaAuthor Commented:
yes that program contains one sql statement. Even normal c programm is also not running.
my c programme is
#######
#include <stdio.h>
main(){
printf("Hello world");
}

The error i got after $ gcc -v test.c
is
Reading specs from /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/specs
gcc version 2.8.1
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=8 -Dunix -D__svr4__ -D__SVR4 -Dsun -D__unix__ -D__svr4__ -D__SVR4 -D__sun__ -D__unix -D__sun -Asystem(svr4) -Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -Asystem(unix) -Acpu(i386) -Amachine(i386) anil.c /var/tmp/cc0088fq.i
GNU CPP version 2.8.1 (i386 System V Release 4)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/i386-pc-solaris2.6/include
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/cc1 /var/tmp/cc0088fq.i -quiet -dumpbase anil.c -version -o /var/tmp/cc0088fq.s
GNU C version 2.8.1 (i386-pc-solaris2.6) compiled by GNU C version 2.8.1.
 /usr/ccs/bin/as -V -Qy -o /var/tmp/cc0088fq1.o /var/tmp/cc0088fq.s
as: WorkShop Compilers 4.2 alpha 14 Jun 1996
 /usr/ccs/bin/ld -V -Y P,/usr/ccs/lib:/usr/lib -Qy /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crt1.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crti.o /usr/ccs/lib/values-Xa.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtbegin.o -L/usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1 -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/local/lib /var/tmp/cc0088fq1.o -lgcc -lc -lgcc /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtend.o /usr/local/lib/gcc-lib/i386-pc-solaris2.6/2.8.1/crtn.o
ld: Software Generation Utilities - Solaris-ELF (4.0)
ld.so.1: /usr/ccs/bin/ld: fatal: relocation error: file /usr/ccs/lib/libld.so.2: symbol _elf_getxoff: referenced symbol not found
gcc: Internal compiler error: program ld got fatal signal 9
0
 
jlevieCommented:
The way I see the error when using the simple test program it sure looks like a problem with the system environment. Unfortunately I don't have any 2.6 x86 boxes to look at so I can't tell you what the file sizes for the libs should be.

You could try compiling the test program statically with 'gcc -static test.c'. If the problem is only with one of the dynamic libs, which is what the error indicates, the static link should work. That would also tend to eliminate gcc as being the cause of the problem.
0
 
ahoffmannCommented:
> gcc version 2.8.1
hmm I'm also not failar with x386 Solaris and gcc, but try to update to gcc 2.95.3

Another try: what does following tell you:
   ldd /usr/ccs/lib/libld.so.2
0
 
rama_krishnaAuthor Commented:
I add a patch 107734-09 (downloaded from sun site). This patch is for linker problems. Now the problem has been solved.
Thank u all.........
0
 
tfewsterCommented:
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- PAQ & refund points

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster (I don't work here, I'm just an Expert :-)
0
All Courses

From novice to tech pro — start learning today.