Bug#421229: FTBFS with GCC 4.3: missing #includes

Martin Michlmayr tbm at cyrius.com
Fri Apr 27 09:47:05 UTC 2007


Package: dasher
Version: 4.4.1-1
Usertags: ftbfs-gcc-4.3
Tags: patch

Your package fails to build with GCC 4.3.  Version 4.3 has not been
released yet but I'm building with a snapshot in order to find errors
and give people an advance warning.  In GCC 4.3, the C++ header
dependencies have been cleaned up.  The advantage of this is that
programs will compile faster.  The downside is that you actually
need to directly #include everything you use (but you really should
do this anyway, otherwise your program won't work with any compiler
other than GCC).  Some background of this can be found at
http://gcc.gnu.org/PR28080

There are some new failures in the new upstream version you uploaded.
In fact, dasher does something really evil.  WordLanguageModel.cpp
fails to build because it uses atoi without including cstdlib.
However, when I added the #include we started failing in an even worse
way.  I found out that essentially (through local includes, in the end
of AlphIO.h) dasher does:

namespace expat {
#include <cstdlib>
}
#include <cstdlib>

and this horribly fails.  I "fixed" this by including cstdlib in
AlphIO.h and ColourIO.h before the horrible namespace'd #include.

You can reproduce this problem with gcc-snapshot (20070326-1 or higher)
from unstable. (Currently not available for i386, but for amd64, powerpc
and ia64.  I hope to have i386 binaries in the archive in the near
future.)

> Automatic build of dasher_4.4.1-1 on em64t by sbuild/amd64 0.53
...
> g++ -DHAVE_CONFIG_H -I. -I. -I../../..     -g -Wall -O2 -Wall -Wno-non-virtual-dtor -c -o DictLanguageModel.o DictLanguageModel.cpp
> DictLanguageModel.cpp: In member function 'Dasher::CDictLanguageModel::CDictnode* Dasher::CDictLanguageModel::AddSymbolToNode(Dasher::CDictLanguageModel::CDictnode*, Dasher::symbol, int*)':
> DictLanguageModel.cpp:69: error: 'USHRT_MAX' was not declared in this scope
> make[5]: *** [DictLanguageModel.o] Error 1

--- Src/DasherCore/LanguageModelling/DictLanguageModel.cpp~	2007-04-27 09:04:33.000000000 +0000
+++ Src/DasherCore/LanguageModelling/DictLanguageModel.cpp	2007-04-27 09:04:39.000000000 +0000
@@ -13,6 +13,7 @@
 #include <stack>
 #include <iostream>
 #include <fstream>
+#include <climits>
 using namespace Dasher;
 using namespace std;
 
--- Src/DasherCore/LanguageModelling/WordLanguageModel.cpp~	2007-04-27 09:05:39.000000000 +0000
+++ Src/DasherCore/LanguageModelling/WordLanguageModel.cpp	2007-04-27 09:07:40.000000000 +0000
@@ -11,6 +11,7 @@
 #include "PPMLanguageModel.h"
 
 #include <cmath>
+#include <cstdlib>
 #include <stack>
 #include <iostream>
 #include <fstream>
--- Src/DasherCore/Alphabet/AlphIO.h~	2007-04-27 09:26:06.000000000 +0000
+++ Src/DasherCore/Alphabet/AlphIO.h	2007-04-27 09:26:16.000000000 +0000
@@ -13,6 +13,7 @@
 //#include "Alphabet.h"
 #include "GroupInfo.h"
 
+#include <cstdlib>
 #include <string>
 #include <map>
 #include <vector>
--- Src/DasherCore/ColourIO.h~	2007-04-27 09:29:37.000000000 +0000
+++ Src/DasherCore/ColourIO.h	2007-04-27 09:29:54.000000000 +0000
@@ -11,6 +11,7 @@
 
 #include "DasherTypes.h"
 
+#include <cstdlib>
 #include <string>
 #include <map>
 #include <vector>
--- Src/DasherCore/UserLocation.cpp~	2007-04-27 09:34:42.000000000 +0000
+++ Src/DasherCore/UserLocation.cpp	2007-04-27 09:34:49.000000000 +0000
@@ -3,6 +3,7 @@
 
 #include "UserLocation.h"
 
+#include <cstdlib>
 #include <sys/timeb.h>
 
 // Track memory leaks on Windows to the line that new'd the memory
--- Src/DasherCore/XMLUtil.cpp~	2007-04-27 09:35:46.000000000 +0000
+++ Src/DasherCore/XMLUtil.cpp	2007-04-27 09:35:52.000000000 +0000
@@ -3,6 +3,7 @@
 
 #include "XMLUtil.h"
 
+#include <cstdlib>
 #include <sys/types.h>
 #include <sys/stat.h>
 

-- 
Martin Michlmayr
http://www.cyrius.com/




More information about the pkg-gnome-maintainers mailing list