[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#202927: gcc-3.3: Link order on Sparc: system directories vs specified directories



Package: gcc-3.3
Version: 1:3.3.1-0pre0
Severity: normal

Hello,

I remarked a problem with gcc on Sparc which concerns the linking order
of libraries. I have done a simple test to show that:

First foo.c:
<--->
void foo()
{
}

<--->

Second file, main.c:
<--->
int main()
{
  foo();
  return 0;
}

<--->

Then the commands:
 gcc -c -o foo.o foo.c
 ar -rcu libutil.a foo.o
 ranlib libutil.a
 gcc -c -o main.o main.c

Until there everything works on all architectures.

But when linking, I get the following on Sparc:
 gcc -o main main.o -L. -lutil

 main.o(.text+0x4): In function `main':
 : undefined reference to `foo'
 collect2: ld returned 1 exit status

It seems that the library /usr/lib/libutil.a is used instead of the
libutil.a in the current directory. AFAIK, the problem appears only on 
Sparc (among Debian supported architectures), and moreover only with 
gcc-3.2 and gcc-3.3 (it works well with gcc-2.95).

Aurelien


-- System Information:
Debian Release: testing/unstable
Architecture: sparc
Kernel: Linux vore 2.4.21-rc2 #1 Fri May 16 09:03:19 EDT 2003 sparc64
Locale: LANG=C, LC_CTYPE=C

Versions of packages gcc-3.3 depends on:
ii  binutils                 2.14.90.0.4-0.1 The GNU assembler, linker and bina
ii  cpp-3.3                  1:3.3.1-0pre0   The GNU C preprocessor
ii  gcc-3.3-base             1:3.3.1-0pre0   The GNU Compiler Collection (base 
ii  libc6                    2.3.2-1         GNU C Library: Shared libraries an
ii  libgcc1                  1:3.3.1-0pre0   GCC support library

-- no debconf information




Reply to: