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

Bug#432460: gcc-4.1 (and gcc-4.1 multilib) *on amd64*: ld cannot find -lgcc_s when linking static libraries



Package: gcc-4.1
Version: 4.1.2-12
Severity: serious

I am not a package maintainer but think that this might be of interest
to you. There appears to be a problem when trying to link static libraries
using gcc on Debian amd64. The linker tries to link gcc (statically?)
and claims that it cannot find libgcc_s. This seems to be true
whether I use the gcc-4.1-multilib packages or other gcc packages available for the and64 platform. Here is an
example for a simple program that uses libgd (attached)

% gcc -Wl,-Bstatic -lgd -o codehop-gr codehop-gr.c
/usr/bin/ld: cannot find -lgcc_s

The program compiles and works fine if I compile as follows:

% gcc -lgd -o codehop-gr codehop-gr.c

I have experienced the same problem when I remove the gcc-4.1 package and install gcc-4.1-multilib as well as when I have only gcc-3.3 installed. This could be a problem for those who must link against projects that only have static libraries available.

Thanks for your hard work. -rdb

Here is some information that might be helpful; system information follows:

% ll `locate gcc`
-rwxr-xr-x 1 root root 839K 2007-07-09 11:59 /opt/Downloads/gcc/gcc-3.3.6/gcc/32/libgcc_s.so.1 lrwxrwxrwx 1 root root 16 2007-07-09 11:59 /opt/Downloads/gcc/gcc-3.3.6/gcc/libgcc_s_32.so -> 32/libgcc_s.so.1 lrwxrwxrwx 1 root staff 13 2007-07-09 11:59 /usr/local/lib64/libgcc_s.so -> libgcc_s.so.1
-rw-r--r-- 1 root staff 871K 2007-07-09 11:59 /usr/local/lib64/libgcc_s.so.1
lrwxrwxrwx 1 root staff 13 2007-07-09 11:59 /usr/local/lib/libgcc_s_32.so -> libgcc_s.so.1
-rw-r--r-- 1 root staff 839K 2007-07-09 11:59 /usr/local/lib/libgcc_s.so.1
lrwxrwxrwx 1 root root 13 2007-07-09 11:36 /opt/Downloads/gcc/gcc-3.3.6/gcc/libgcc_s.so -> libgcc_s.so.1 -rwxr-xr-x 1 root root 871K 2007-07-09 11:36 /opt/Downloads/gcc/gcc-3.3.6/gcc/libgcc_s.so.1 -rwxr-xr-x 1 root root 839K 2007-07-09 11:33 /opt/Downloads/gcc/gcc-3.3.6/gcc/stage2/libgcc_s_32.so -rwxr-xr-x 1 root root 871K 2007-07-09 11:33 /opt/Downloads/gcc/gcc-3.3.6/gcc/stage2/libgcc_s.so -rwxr-xr-x 1 root root 839K 2007-07-09 11:28 /opt/Downloads/gcc/gcc-3.3.6/gcc/stage1/libgcc_s_32.so -rwxr-xr-x 1 root root 871K 2007-07-09 11:28 /opt/Downloads/gcc/gcc-3.3.6/gcc/stage1/libgcc_s.so lrwxrwxrwx 1 root root 18 2007-07-09 09:17 /usr/lib/gcc/x86_64-linux-gnu/4.2/libgcc_s.so -> /lib/libgcc_s.so.1 lrwxrwxrwx 1 root root 24 2007-07-09 08:59 /usr/lib/gcc/x86_64-linux-gnu/4.1.2/32/libgcc_s.so -> ../../4.1/32/libgcc_s.so lrwxrwxrwx 1 root root 18 2007-07-09 08:59 /usr/lib/gcc/x86_64-linux-gnu/4.1.2/libgcc_s.so -> ../4.1/libgcc_s.so lrwxrwxrwx 1 root root 38 2007-07-09 08:59 /usr/lib/gcc/x86_64-linux-gnu/4.1/32/libgcc_s.so -> /emul/ia32-linux/usr/lib/libgcc_s.so.1 lrwxrwxrwx 1 root root 38 2007-07-09 08:59 /usr/lib/gcc/x86_64-linux-gnu/4.1/libgcc_s_32.so -> /emul/ia32-linux/usr/lib/libgcc_s.so.1 lrwxrwxrwx 1 root root 18 2007-07-09 08:59 /usr/lib/gcc/x86_64-linux-gnu/4.1/libgcc_s.so -> /lib/libgcc_s.so.1 -rw-r--r-- 1 root root 41K 2007-07-07 13:27 /emul/ia32-linux/usr/lib/libgcc_s.so.1
-rw-r--r-- 1 root root   55K 2007-07-07 13:27 /lib/libgcc_s.so.1


# ldconfig -p | grep gcc
libstlport_gcc.so.4.6 (libc6,x86-64) => /usr/lib/libstlport_gcc.so.4.6
       libgccpp.so.1 (libc6,x86-64) => /usr/lib/libgccpp.so.1
       libgcc_s.so.1 (libc6,x86-64) => /lib/libgcc_s.so.1
       libgcc_s.so.1 (libc6) => /usr/lib32/libgcc_s.so.1
       libgcc_s.so (libc6,x86-64) => /usr/lib/libgcc_s.so

# dpkg -l gcc
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                     Version                  Description
+++-========================-========================-================================================================
ii  gcc                      4.1.1-15                 The GNU C compiler


-- System Information:
Debian Release: 4.0
 APT prefers stable
 APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages gcc-4.1-multilib depends on:
ii  gcc-4.1                 4.1.2-12         The GNU C compiler
ii gcc-4.1-base 4.1.2-12 The GNU Compiler Collection (base ii lib32gcc1 1:4.2-20070707-1 GCC support library (32 bit Versio ii libc6-dev-i386 2.6-1 GNU C Library: 32bit development l

gcc-4.1-multilib recommends no packages.

-- no debconf information

#include <stdio.h>
#include "gd.h"
#include "gdfontg.h"

int main(void)
{
  /* Declare the image */
  gdImagePtr im;
  /* Declare output files */
  FILE *pngout;
    
  /* Declare color indexes */
  int black, white;
  int red, green, blue;

  /* Allocate the image: 64 pixels across by 64 pixels tall */
  im = gdImageCreate(900, 300);

  /* make white the first color */
  white = gdImageColorAllocate(im, 255, 255, 255);

  /* we need a black pen */
  black = gdImageColorAllocate(im, 0, 0, 0);
  
  /* a line representing the nucleotide */
  gdImageLine(im, 0, 150, 899, 150, black);
  
  /* dome decoration */ 
  red = gdImageColorAllocate(im, 255, 0, 0);
  green = gdImageColorAllocate(im, 0, 255, 0);
  blue = gdImageColorAllocate(im, 0, 0, 255);
  
  gdImageString(im, gdFontGiant, 5, 160, 
		(unsigned char *) "5'", red);

  gdImageString(im, gdFontGiant, 880, 160, 
		(unsigned char *) "3'", red);
  
  /* the rectangles representing the blocks */
  gdImageLine(im, 50, 100, 420, 100, black);	
  gdImageLine(im, 420, 100, 420, 200, black);	
  gdImageLine(im, 420, 200, 50, 200, black);	
  gdImageLine(im, 50, 200, 50, 100, black);	

  gdImageString(im, gdFontGiant, 320, 175, 
		(unsigned char *) "ACBP-A", black);

  /* write the image */
  pngout = fopen("codehop-gr.png", "wb");
  gdImagePng(im, pngout);
  fclose(pngout);

  /* Destroy the image in memory. */
  gdImageDestroy(im);

}

Reply to: