tags 520598 +patch
thanks

A simple test app that reproduces this issue:

#include <google/sparse_hash_set>

int main() {
}

The problem seems to be that g++-4.3 puts hash_fun.h in a different location from g++-4.1 and g++-4.2. Sparsehash uses whatever the location was for the default compiler at the time it was built. So a build on a system with g++-4.3 as the default compiler will produce a header that fails with g++-4.1 and g++-4.2 and a build on a system with g++-4.1 or g++-4.2 as the default compiler will produce a header that fails with g++-4.3.

This issue affects lenny squeeze and sid.

A patch is attatched that makes the package produce a header that builds with 4.1, 4.2 and 4.3

diff -ur sparsehash-1.1/debian/rules sparsehash-1.1.new/debian/rules
--- sparsehash-1.1/debian/rules	2009-03-21 14:09:47.000000000 +0000
+++ sparsehash-1.1.new/debian/rules	2009-03-21 14:06:45.000000000 +0000
@@ -13,6 +13,14 @@
 
 	# Add here commands to compile the package.
 	./configure --prefix=/usr/
+	$(MAKE) src/google/sparsehash/sparseconfig.h
+	echo ''                                                                 >> src/google/sparsehash/sparseconfig.h
+	echo '/* the location of <hash_fun.h>/<stl_hash_fun.h> */'              >> src/google/sparsehash/sparseconfig.h
+	echo '#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))' >> src/google/sparsehash/sparseconfig.h 
+	echo '  #define HASH_FUN_H <hash_fun.h>'                                >> src/google/sparsehash/sparseconfig.h
+	echo '#else'                                                            >> src/google/sparsehash/sparseconfig.h
+	echo '  #define HASH_FUN_H <ext/hash_fun.h>'                            >> src/google/sparsehash/sparseconfig.h
+	echo '#endif'                                                           >> src/google/sparsehash/sparseconfig.h
 	$(MAKE)
 
 	touch build-stamp
diff -ur sparsehash-1.1/src/config.h.include sparsehash-1.1.new/src/config.h.include
--- sparsehash-1.1/src/config.h.include	2007-11-29 19:56:43.000000000 +0000
+++ sparsehash-1.1.new/src/config.h.include	2009-03-21 13:44:20.000000000 +0000
@@ -8,7 +8,9 @@
  ***/
 GOOGLE_NAMESPACE
 HASH_NAMESPACE
-HASH_FUN_H
+/*autoheader only gets this right for the version of g++ that is used at
+  package build time, so add it later from debian/rules*/
+HASH_FUN_H*/
 SPARSEHASH_HASH
 HAVE_UINT16_T
 HAVE_U_INT16_T
Only in sparsehash-1.1/src/google/sparsehash: sparseconfig.h

Reply via email to