This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with libstdc++ (i586-pc-linux-gnulibc1)




Hi!


I have following problem with libstdc++ from both gcc-2.8.1 and
egcs-1.0.3a (System: Pentium 200MMX, Linux kernel-2.0.35, libc-5.4.46):

When trying to build STATICALLY linked executables I'm sometimes getting
conflict between libc.a and libstdc++.a. I met this problem with 
big application and didn't succeed to find some simple example to
ilustrate the problem. So only thing I have to do is to give output
of linking this executable and inform about workaround I tried
successfully for gcc-2.8.1 + libstdc++-2.8.1.1 and also for
one of latest snapshots of egcs (980715). Currently I have egcs-1.0.3
installed and didn't rebuild libraries yet.

------------  Output of linking the executable ------------------

Reading specs from /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)
 /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.29/ld -m elf_i386
 -dynamic-linker /lib/ld-linux.so.1 -o idegc.exe /usr/lib/crt1.o
 /usr/lib/crti.o 
/usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.29/crtbegin.o -L. 
-Llibide -Llibrhgdb -Llibtvgdb -Llibtvuti -Llibrhuti -Ltvision -Llibgdb
 -Llibset -Ltvdemo -L/usr/local/qt/lib -L.
 -L/usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.29
 -L/usr/i586-pc-linux-gnulibc1/lib debobj/abstorel.o debobj/commands.o
 debobj/fstrcmp.o debobj/ideapp.o debobj/idebug.o debobj/idecolor.o
 debobj/idecomp.o debobj/idedebug.o debobj/idedefau.o debobj/idedial.o
 debobj/ideenv.o debobj/ideexter.o debobj/ideflags.o debobj/ideforma.o
 debobj/idegcc.o debobj/idehelp.o debobj/idehints.o debobj/idemain.o
 debobj/idemak.o debobj/idemenu.o debobj/idemsg.o debobj/ideopt.o
 debobj/ideprj.o debobj/idercs.o debobj/idespec.o debobj/idestatu.o
 debobj/idestrm.o debobj/idesupp.o debobj/idesynta.o debobj/ideuser.o
 debobj/ideutil.o debobj/ideversi.o debobj/openedit.o debobj/rhassert.o
 -Bstatic -no-whole-archive -lide -ltvgdb -ltvuti -lrhuti -lset -ltvdem
 -lrhgdb -lgdb -ltv -lstdc++ -lintl -lncurses -lgpm -lm -lgcc -lc
 -lgcc /usr/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.29/crtend.o
 /usr/lib/crtn.o

/usr/lib/libc.a(putc.o): In function `_IO_putc':
putc.o(.text+0x0): multiple definition of `_IO_putc'
/usr/lib/libstdc++.a(ioputc.o)(.text+0x0): first defined here
/usr/i586-pc-linux-gnulibc1/bin/ld: Warning: size of symbol `_IO_putc' 
changed fcollect2: ld returned 1 exit status

------------------------------------------------------------------

- First thing I did was to replace libio/config/linuxlibc1.mt with
  libio/config/linux.mt which only includes in library libio/iogetline.c
  (to get rid of _IO_* functions that are present both in libc.a 
  and libstdc++.a). This change does not break other systems so I
  don't think it's dangerous.

  As the result I got different conflict situation with iogetline.c:
    - this file contains 2 functions _IO_getline and _IO_getline_info
      and only the second one is missing from libc.a.
  So I got similar message as above but now about '_IO_getline'
  which can be found in 2 libraries

- After that I commented out _IO_getline from iogetline.c. Now all
  worked and I didn't get any more problems in some latest months (I did it
  for gcc-2.8.1 at end of March). Of course the second workaround is
  ugly and cannot be used more widely. 

The best way I see is to split libio/iogetline.c in 2 files and include 
only the one that contains _IO_getline_info for target 
i[34567]86-pc-linux-libc1. 

I downloaded some previous versions of libc and libstdc++ (2.7.2.1):
  - libstdc++.a (version 2.7.2.1 for Linux) does not contain _IO_...
    functions. _IO_getline_info were not introduced at all at this 
    time as I understood.

There may be some more incompatibilities between different versions of
libc:
       5.0.44 and 5.0.46 contains _IO_ferror and _IO_fputc which
       are missing from 5.0.37 and earlier versions. According to 
       ChangeLog of libc these functions were introduced in Aug 1997
       to improve compatibility with glibc beginning with libc-5.0.38

So for this target it is necessary to look for following functions in
libc:  _IO_ferror, _IO_fputc and _IO_getline and _IO_getline_info.
We should only include missing ones in libstdc++.   

Andris Pavenis

pavenis@lanet.lv


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]