pbzip2 1.1.x - fix compile/link error on older gcc

Bug #613909 reported by Jeff Gilchrist
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pbzip2
New
Undecided
Unassigned

Bug Description

From: Jan 'RedBully' Seiffert <kaffeemonster /at/ googlemail [dot] com>
date Fri, Jul 2, 2010 at 9:15 AM
subject [patch] fix compile/link error on older gcc

Hiho!

I tried to install the latest pbzip2-1.1.1 on an older SuSE 9.0 (don't
ask). Unfortunatly that failed.
The compiler would eat it, but then the linker hat some problems about
unresolved symbols in all this C++ fluff.
Basically some .gnu.linkonce.t symbol with all this typetrait BS for
allocator sysmbol whatever (i don't understand this C++ gibberish,
whats wrong with malloc, ahh, yes, i remember C++ typesystem is anal).

gcc is:
$ gcc --version
gcc (GCC) 3.3.1 (SuSE Linux)
Copyright (C) 2003 Free Software Foundation, Inc.
....

$ make
g++ -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-D_POSIX_PTHREAD_SEMANTICS -DUSE_STACKSIZE_CUSTOMIZATION -pthread
pbzip2.cpp BZ2StreamScanner.cpp -o pbzip2 -lbz2 -lpthread
pbzip2.cpp: In function `void* fileWriter(void*)':
pbzip2.cpp:1387: warning: assignment to `int' from `double'
pbzip2.cpp:1387: warning: argument to `int' from `double'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNSbIhSt11char_traitsIhESaIhEEaSEPKh+0xc):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::operator=(unsigned char const*)':
: undefined reference to `std::char_traits<unsigned
char>::length(unsigned char const*)'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNSbIhSt11char_traitsIhESaIhEE6assignEPKhj+0xc8):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::assign(unsigned char const*, unsigned)':
: undefined reference to `std::char_traits<unsigned
char>::copy(unsigned char*, unsigned char const*, unsigned)'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNSbIhSt11char_traitsIhESaIhEE6assignEPKhj+0xd8):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::assign(unsigned char const*, unsigned)':
: undefined reference to `std::char_traits<unsigned
char>::move(unsigned char*, unsigned char const*, unsigned)'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNSbIhSt11char_traitsIhESaIhEE13_S_copy_charsEPhPKhS5_+0x10):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::_S_copy_chars(unsigned char*, unsigned char const*, unsigned char
const*)':
: undefined reference to `std::char_traits<unsigned
char>::copy(unsigned char*, unsigned char const*, unsigned)'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNKSbIhSt11char_traitsIhESaIhEE7compareEjjPKhj+0x20):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::compare(unsigned, unsigned, unsigned char const*, unsigned) const':
: undefined reference to `std::char_traits<unsigned
char>::length(unsigned char const*)'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNKSbIhSt11char_traitsIhESaIhEE7compareEjjPKhj+0x6a):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::compare(unsigned, unsigned, unsigned char const*, unsigned) const':
: undefined reference to `std::char_traits<unsigned
char>::compare(unsigned char const*, unsigned char const*, unsigned)'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNSbIhSt11char_traitsIhESaIhEE9_M_mutateEjjj+0xe2):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::_M_mutate(unsigned, unsigned, unsigned)':
: undefined reference to `std::char_traits<unsigned
char>::move(unsigned char*, unsigned char const*, unsigned)'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNSbIhSt11char_traitsIhESaIhEE9_M_mutateEjjj+0xfd):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::_M_mutate(unsigned, unsigned, unsigned)':
: undefined reference to `std::char_traits<unsigned
char>::copy(unsigned char*, unsigned char const*, unsigned)'
/tmp/ccOEJEw7.o(.gnu.linkonce.t._ZNSbIhSt11char_traitsIhESaIhEE9_M_mutateEjjj+0x11f):
In function `std::basic_string<unsigned char,
std::char_traits<unsigned char>, std::allocator<unsigned char>
>::_M_mutate(unsigned, unsigned, unsigned)':
: undefined reference to `std::char_traits<unsigned
char>::copy(unsigned char*, unsigned char const*, unsigned)'
collect2: ld returned 1 exit status
make: *** [pbzip2] Error 1

looks like what the compiler generates can not be linked.
So i made a patch to solve this by lowering this problematic C++ to C.

Maybe it is usefull to you.

Greetings
Jan

Revision history for this message
Jeff Gilchrist (jeff-gilchrist) wrote :
Revision history for this message
Yavor Nikolov (yavor-nikolov) wrote :

I'll try to find/setup an environment with older g++ version to see what happens (I suspect there is some mismatch with the relevant version of the libstdc++ runtime library).

Revision history for this message
Yavor Nikolov (yavor-nikolov) wrote :

The problem seems to be that there is no specialization for char_traits<unsigned char> in g++ 3.3.

I'm attaching an alternative simpler patch which makes pbzip2 1.1.0 compile and link with no errors using g++ 3.3 (I haven't tested yet other compilers nor how does pbzip2 work after that).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.