?
Solved

gcc not working

Posted on 2002-04-04
14
Medium Priority
?
726 Views
Last Modified: 2012-05-04
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.
0
Comment
Question by:rama_krishna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
  • +2
14 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 6919749
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
 

Author Comment

by:rama_krishna
ID: 6919965
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6920388
please post result when you call gcc with -v option
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:rama_krishna
ID: 6930924
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6932146
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
 
LVL 40

Expert Comment

by:jlevie
ID: 6932278
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6932308
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
 

Author Comment

by:rama_krishna
ID: 6932976
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
 

Author Comment

by:rama_krishna
ID: 6932977
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
 
LVL 40

Expert Comment

by:jlevie
ID: 6933040
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6933425
> 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
 

Author Comment

by:rama_krishna
ID: 6933647
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
 
LVL 21

Expert Comment

by:tfewster
ID: 7833589
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
 

Accepted Solution

by:
modulo earned 0 total points
ID: 7909003
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question