g++ -O3 -mtune=pentium2 -march=pentium2 -pipe -fomit-frame-pointer -O3 -mtune=pentium2 -march=pentium2 -pipe -fomit-frame-pointer -I../src/include/gen -I../src/include -ggdb -O3 -march=i586 -mcpu=i686 -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC -DPROD_BUILD -O3 -mtune=pentium2 -march=pentium2 -pipe -fomit-frame-pointer -I../src/include/gen -I../src/include -ggdb -O3 -march=i586 -mcpu=i686 -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC -DPROD_BUILD -I../src/include/gen -I../src/include -ggdb -O3 -march=i586 -mcpu=i686 -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC -DPROD_BUILD -O3 -mtune=pentium2 -march=pentium2 -pipe -fomit-frame-pointer -I../src/include/gen -I../src/include -ggdb -O3 -march=i586 -mcpu=i686 -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC -DPROD_BUILD -I../src/include/gen -I../src/include -ggdb -O3 -march=i586 -mcpu=i686 -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC -DPROD_BUILD -I../src/include/gen -I../src/include -ggdb -O3 -march=i586 -mcpu=i686 -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC -DPROD_BUILD -c ../src/common/classes/alloc.cpp -o ../temp/libfbcommon/common/classes/alloc.o In file included from ../src/common/classes/../../include/../common/classes/tree.h:35, from ../src/common/classes/../../include/../common/classes/alloc.h:36, from ../src/common/classes/../../include/firebird.h:75, from ../src/common/classes/alloc.cpp:26: ../src/common/classes/../../include/../common/classes/vector.h: In member function `bool Firebird::SortedVector<Value, Capacity, Key, KeyOfValue, Cmp>::find(const Key&, int&)': ../src/common/classes/../../include/../common/classes/vector.h:103: error: `count' undeclared (first use this function) ../src/common/classes/../../include/../common/classes/vector.h:103: error: (Each undeclared identifier is reported only once for each function it appears in.) ../src/common/classes/../../include/../common/classes/vector.h:106: error: `data' undeclared (first use this function) In file included from ../src/common/classes/../../include/../common/classes/alloc.h:36, from ../src/common/classes/../../include/firebird.h:75, from ../src/common/classes/alloc.cpp:26: ../src/common/classes/../../include/../common/classes/tree.h: In member function `int Firebird::BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp, LeafCount, NodeCount>::getCount() const': ../src/common/classes/../../include/../common/classes/tree.h:218: error: `count' undeclared (first use this function) ../src/common/classes/../../include/../common/classes/tree.h: In static member function `static const Key& Firebird::BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp, LeafCount, NodeCount>::NodeList::generate(void*, void*)': ../src/common/classes/../../include/../common/classes/tree.h:263: error: expected primary-expression before ')' token ../src/common/classes/../../include/../common/classes/tree.h:263: error: expected `)' before "item" ../src/common/classes/../../include/../common/classes/tree.h:263: error: expected `)' before ';' token In file included from ../src/common/classes/alloc.cpp:28: /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/g++-v3/new: At global scope: /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/g++-v3/new:54: error: redefinition of `class std::bad_alloc' ../src/common/classes/../../include/../common/classes/alloc.h:245: error: previous definition of `class std::bad_alloc' /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/g++-v3/new:82: error: declaration of `void* operator new(size_t) throw (std::bad_alloc)' throws different exceptions ../src/common/classes/../../include/../common/classes/alloc.h:248: error: than previous declaration `void* operator new(size_t)' /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/g++-v3/new:83: error: declaration of `void* operator new [](size_t) throw (std::bad_alloc)' throws different exceptions ../src/common/classes/../../include/../common/classes/alloc.h:261: error: than previous declaration `void* operator new [](size_t)' /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/g++-v3/new: In function `void* operator new(size_t, void*)': /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/g++-v3/new:92: error: redefinition of `void* operator new(size_t, void*)' ../src/common/classes/../../include/../common/classes/alloc.h:283: error: `void* operator new(size_t, void*)' previously defined here /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/g++-v3/new: In function `void* operator new [](size_t, void*)': /usr/lib/gcc/i686-pc-linux-gnu/3.4.1/include/g++-v3/new:93: error: redefinition of `void* operator new [](size_t, void*)' ../src/common/classes/../../include/../common/classes/alloc.h:284: error: `void* operator new [](size_t, void*)' previously defined here ../src/common/classes/alloc.cpp:64: confused by earlier errors, bailing out make[3]: *** [../temp/libfbcommon/common/classes/alloc.o] Error 1 make[3]: Leaving directory `/mnt/Dati/Gentoo/tmp/portage/firebird-1.5.1/work/firebird-1.5.1.4481/src' make[2]: *** [libfbcommon] Error 2 make[2]: Leaving directory `/mnt/Dati/Gentoo/tmp/portage/firebird-1.5.1/work/firebird-1.5.1.4481/src' make[1]: *** [../gen/firebird/bin/gpre_static] Error 2 make[1]: Leaving directory `/mnt/Dati/Gentoo/tmp/portage/firebird-1.5.1/work/firebird-1.5.1.4481/src' make: *** [firebird] Error 2 !!! ERROR: dev-db/firebird-1.5.1 failed. !!! Function src_compile, Line 43, Exitcode 2 !!! error during make i guess patch needed..
I have the same probelm!
it even failed with 3.3.4! during linking due to some undefined functions...
I have the same problem to. Is it possible that this is a bug related to gcc33/gcc34 upgrade, and some library/dependency is linked with the old gcc33 libraries/headers? Sidenote: What is the correct method to upgrade to a new version of gcc?
I've upgraded my whole system by running 'emerge -ve world' after recompiling gcc-3.4.1 and glibc, but firebird still fails with the same error. This is probably an bug for the firebird folks, not gentoo related to gcc341. Please forward to them.
I've filed the bug upstream with firebird folks. Check out: https://sourceforge.net/tracker/index.php?func=detail&aid=1013004&group_id=9028&atid=109028
This also happens on my system that was bootstrapped with a GCC 3.4 profile, so I don't think the issue is related to upgrading GCC.
Created attachment 39422 [details, diff] Simple patch to make firebird more ANSI C++ compliant Hmm... Compiled just fine here after obvious C++ fixes...
Patch work for me too, added to portage
Comment on attachment 39422 [details, diff] Simple patch to make firebird more ANSI C++ compliant diff -uNr firebird-1.5.1.4481-orig/src/common/classes/alloc.h firebird-1.5.1.4481/src/common/classes/alloc.h --- firebird-1.5.1.4481-orig/src/common/classes/alloc.h 2003-10-30 22:25:52.000000000 +0000 +++ firebird-1.5.1.4481/src/common/classes/alloc.h 2004-09-14 04:12:37.967099632 +0000 @@ -237,12 +237,17 @@ // loaded by host application using STL // This is to prevent inclusion of <new> header -#ifdef __NEW__ +#if defined( _NEW ) || defined ( __NEW__ ) #error "alloc.h must be included before <new>" #endif +#define _NEW #define __NEW__ namespace std { class bad_alloc : public exception {}; +#if ( __GNUC__ > 3) || ((__GNUC__==3) && __GNUC_MINOR__ >=4) + struct nothrow_t { }; + extern const nothrow_t nothrow; +#endif } // Define operators as static inline to prevent replacement of STL versions static inline void* operator new(size_t s) { @@ -258,6 +263,21 @@ ); } +#if ( __GNUC__ > 3) || ((__GNUC__==3) && __GNUC_MINOR__ >=4) +static inline void* operator new(size_t s, const std::nothrow_t&) { +#if defined(DEV_BUILD) +// Do not complain here. It causes client tools to crash on Red Hat 8.0 +// fprintf(stderr, "You MUST allocate all memory from a pool. Don't use the default global new().\n"); +#endif // DEV_BUILD +// return getDefaultMemoryPool()->calloc(s, 0 + return getDefaultMemoryPool()->allocate(s, 0 +#ifdef DEBUG_GDS_ALLOC + ,__FILE__,__LINE__ +#endif + ); +} +#endif + static inline void* operator new[](size_t s) { #if defined(DEV_BUILD) // Do not complain here. It causes client tools to crash on Red Hat 8.0 diff -uNr firebird-1.5.1.4481-orig/src/common/classes/array.h firebird-1.5.1.4481/src/common/classes/array.h --- firebird-1.5.1.4481-orig/src/common/classes/array.h 2004-03-29 07:40:23.000000000 +0000 +++ firebird-1.5.1.4481/src/common/classes/array.h 2004-09-14 04:10:26.267121072 +0000 @@ -60,15 +60,15 @@ class Array : private Storage { public: Array(MemoryPool* p) : - count(0), capacity(getStorageSize()), data(getStorage()), pool(p) {} + count(0), capacity(Storage::getStorageSize()), data(Storage::getStorage()), pool(p) {} Array(MemoryPool* p, int InitialCapacity) : count(0), - capacity(getStorageSize()), data(getStorage()), pool(p) + capacity(Storage::getStorageSize()), data(Storage::getStorage()), pool(p) { ensureCapacity(InitialCapacity); } ~Array() { - if (data != getStorage()) + if (data != Storage::getStorage()) pool->deallocate(data); } void clear() { count = 0; }; @@ -170,7 +170,7 @@ #endif )); memcpy(newdata, data, sizeof(T) * count); - if (data != getStorage()) + if (data != Storage::getStorage()) pool->deallocate(data); data = newdata; capacity = newcapacity; @@ -188,17 +188,17 @@ SortedArray(MemoryPool* p, int s) : Array<Value>(p, s) {} SortedArray(MemoryPool* p) : Array<Value>(p) {} bool find(const Key& item, int& pos) { - int highBound = count, lowBound = 0; + int highBound = Array<Value>::count, lowBound = 0; while (highBound > lowBound) { int temp = (highBound + lowBound) >> 1; - if (Cmp::compare(item, KeyOfValue::generate(this, data[temp]))) + if (Cmp::compare(item, KeyOfValue::generate(this, Array<Value>::data[temp]))) lowBound = temp + 1; else highBound = temp; } pos = lowBound; - return highBound != count && - !Cmp::compare(KeyOfValue::generate(this, data[lowBound]), item); + return highBound != Array<Value>::count && + !Cmp::compare(KeyOfValue::generate(this, Array<Value>::data[lowBound]), item); } int add(const Value& item) { int pos; diff -uNr firebird-1.5.1.4481-orig/src/common/classes/tree.h firebird-1.5.1.4481/src/common/classes/tree.h --- firebird-1.5.1.4481-orig/src/common/classes/tree.h 2003-10-30 22:25:52.000000000 +0000 +++ firebird-1.5.1.4481/src/common/classes/tree.h 2004-09-14 04:10:26.268120920 +0000 @@ -215,7 +215,7 @@ } Value& current() const { return (*curr)[curPos]; } Value& getAddErrorValue() { return addErrorValue; } - int getCount() const { return count; } +// int getCount() const { return count; } private: BePlusTree(Allocator *_pool, void *rootPage) : pool(_pool), level(0), curr(new(rootPage) ItemList()), root(rootPage), curPos(0)/*, count(0)*/ {}; @@ -260,7 +260,7 @@ static const Key& generate(void *sender, void *item) { for (int lev = ((NodeList *)sender)->level; lev > 0; lev--) item = *((NodeList *)item)->begin(); - return KeyOfValue::generate(item,*((BePlusTree::ItemList *)item)->begin()); + return KeyOfValue::generate(item,*(reinterpret_cast<typename BePlusTree<Value,Key,Allocator,KeyOfValue,Cmp,LeafCount,NodeCount>::ItemList *>(item))->begin()); } static void setNodeParentAndLevel(void *node, int level, NodeList *parent) { if (level) { diff -uNr firebird-1.5.1.4481-orig/src/common/classes/vector.h firebird-1.5.1.4481/src/common/classes/vector.h --- firebird-1.5.1.4481-orig/src/common/classes/vector.h 2002-12-14 21:43:18.000000000 +0000 +++ firebird-1.5.1.4481/src/common/classes/vector.h 2004-09-14 04:10:26.268120920 +0000 @@ -100,17 +100,17 @@ public: SortedVector() : Vector<Value, Capacity>() {} bool find(const Key& item, int& pos) { - int highBound=count, lowBound=0; + int highBound=Vector<Value, Capacity>::count, lowBound=0; while (highBound > lowBound) { int temp = (highBound + lowBound) >> 1; - if (Cmp::compare(item, KeyOfValue::generate(this,data[temp]))) + if (Cmp::compare(item, KeyOfValue::generate(this,Vector<Value, Capacity>::data[temp]))) lowBound = temp+1; else highBound = temp; } pos = lowBound; - return highBound != count && - !Cmp::compare(KeyOfValue::generate(this,data[lowBound]), item); + return highBound != Vector<Value, Capacity>::count && + !Cmp::compare(KeyOfValue::generate(this,Vector<Value, Capacity>::data[lowBound]), item); } int add(const Value& item) { int pos;
Oops. I've never tested patch with gcc 3.3.4 :-( Now we have other problem: firebird can not be compiled with gcc 3.3.4.
OK, i've updated this patch. Thanks for info