title: C++ compiling incubator-pagespeed-mod with newer sparse_hash_map lib (systemlib) results in errors
body: <p>i trying to build pagespeed-mod and have a problem who I have no idea how to fix that.</p>
  <p>I tried it booth - with the embedded lib old 0.7 google sparsehash lib it compiles - but fails when i configure NGINX with the mod - when i add the newer lib (sparsehash from alpine repo) psol build failed.</p>
  <p>I trying to make a patch file to embed the lib directly in the source and rename the typedef correctly like so:</p>
  <pre class="lang-c prettyprint-override"><code>  typedef google::sparse_hash_map&lt;
      GoogleString, const char*,
      CaseFoldStringHash,
      CaseFoldStringEqual&gt; StringStringSparseHashMapInsensitive;
    typedef google::sparse_hash_map&lt;
      GoogleString, const char*,
      CasePreserveStringHash&gt; StringStringSparseHashMapSensitive;
  </code></pre>
  <p>It is the only usage of that lib, but the build fails to build with the same error.</p>
  <p>Here is the error that I get:</p>
  <pre><code>#30 2561.8 In file included from /usr/include/sparsehash/internal/sparsehashtable.h:104,
  #30 2561.8                  from /usr/include/sparsehash/sparse_hash_map:93,
  #30 2561.8                  from ./pagespeed/kernel/html/html_keywords.h:27,
  #30 2561.8                  from pagespeed/kernel/util/statistics_logger.cc:42:
  #30 2561.8 /usr/include/sparsehash/type_traits.h:94:52: error: expected class-name before '{' token
  #30 2561.8    94 | template &lt;class T&gt; struct is_integral : false_type { };
  #30 2561.8       |                                                    ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:95:49: error: expected class-name before '{' token
  #30 2561.8    95 | template&lt;&gt; struct is_integral&lt;bool&gt; : true_type { };
  #30 2561.8       |                                                 ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:96:49: error: expected class-name before '{' token
  #30 2561.8    96 | template&lt;&gt; struct is_integral&lt;char&gt; : true_type { };
  #30 2561.8       |                                                 ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:97:58: error: expected class-name before '{' token
  #30 2561.8    97 | template&lt;&gt; struct is_integral&lt;unsigned char&gt; : true_type { };
  #30 2561.8       |                                                          ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:98:56: error: expected class-name before '{' token
  #30 2561.8    98 | template&lt;&gt; struct is_integral&lt;signed char&gt; : true_type { };
  #30 2561.8       |                                                        ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:105:52: error: expected class-name before '{' token
  #30 2561.8   105 | template&lt;&gt; struct is_integral&lt;wchar_t&gt; : true_type { };
  #30 2561.8       |                                                    ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:107:50: error: expected class-name before '{' token
  #30 2561.8   107 | template&lt;&gt; struct is_integral&lt;short&gt; : true_type { };
  #30 2561.8       |                                                  ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:108:59: error: expected class-name before '{' token
  #30 2561.8   108 | template&lt;&gt; struct is_integral&lt;unsigned short&gt; : true_type { };
  #30 2561.8       |                                                           ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:109:48: error: expected class-name before '{' token
  #30 2561.8   109 | template&lt;&gt; struct is_integral&lt;int&gt; : true_type { };
  #30 2561.8       |                                                ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:110:57: error: expected class-name before '{' token
  #30 2561.8   110 | template&lt;&gt; struct is_integral&lt;unsigned int&gt; : true_type { };
  #30 2561.8       |                                                         ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:111:49: error: expected class-name before '{' token
  #30 2561.8   111 | template&lt;&gt; struct is_integral&lt;long&gt; : true_type { };
  #30 2561.8       |                                                 ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:112:58: error: expected class-name before '{' token
  #30 2561.8   112 | template&lt;&gt; struct is_integral&lt;unsigned long&gt; : true_type { };
  #30 2561.8       |                                                          ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:114:54: error: expected class-name before '{' token
  #30 2561.8   114 | template&lt;&gt; struct is_integral&lt;long long&gt; : true_type { };
  #30 2561.8       |                                                      ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:115:63: error: expected class-name before '{' token
  #30 2561.8   115 | template&lt;&gt; struct is_integral&lt;unsigned long long&gt; : true_type { };
  #30 2561.8       |                                                               ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:123:58: error: expected class-name before '{' token
  #30 2561.8   123 | template &lt;class T&gt; struct is_floating_point : false_type { };
  #30 2561.8       |                                                          ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:124:56: error: expected class-name before '{' token
  #30 2561.8   124 | template&lt;&gt; struct is_floating_point&lt;float&gt; : true_type { };
  #30 2561.8       |                                                        ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:125:57: error: expected class-name before '{' token
  #30 2561.8   125 | template&lt;&gt; struct is_floating_point&lt;double&gt; : true_type { };
  #30 2561.8       |                                                         ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:126:62: error: expected class-name before '{' token
  #30 2561.8   126 | template&lt;&gt; struct is_floating_point&lt;long double&gt; : true_type { };
  #30 2561.8       |                                                              ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:137:51: error: expected class-name before '{' token
  #30 2561.8   137 | template &lt;class T&gt; struct is_pointer : false_type { };
  #30 2561.8       |                                                   ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:138:54: error: expected class-name before '{' token
  #30 2561.8   138 | template &lt;class T&gt; struct is_pointer&lt;T*&gt; : true_type { };
  #30 2561.8       |                                                      ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:148:29: error: 'small_' does not name a type
  #30 2561.8   148 |   template &lt;class U&gt; static small_ tester(void (U::*)());
  #30 2561.8       |                             ^~~~~~
  #30 2561.8 /usr/include/sparsehash/type_traits.h:149:29: error: 'big_' does not name a type
  #30 2561.8   149 |   template &lt;class U&gt; static big_ tester(...);
  #30 2561.8       |                             ^~~~
  #30 2561.8 /usr/include/sparsehash/type_traits.h:150:36: error: 'tester' was not declared in this scope
  #30 2561.8   150 |   static const bool value = sizeof(tester&lt;T&gt;(0)) == sizeof(small_);
  #30 2561.8       |                                    ^~~~~~
  #30 2561.8 /usr/include/sparsehash/type_traits.h:150:44: error: expected primary-expression before '&gt;' token
  #30 2561.8   150 |   static const bool value = sizeof(tester&lt;T&gt;(0)) == sizeof(small_);
  #30 2561.8       |                                            ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:150:60: error: 'small_' was not declared in this scope
  #30 2561.8   150 |   static const bool value = sizeof(tester&lt;T&gt;(0)) == sizeof(small_);
  #30 2561.8       |                                                            ^~~~~~
  #30 2561.8 /usr/include/sparsehash/type_traits.h:158:62: error: expected class-name before '{' token
  #30 2561.8   158 | template &lt;class T&gt; struct is_enum_impl&lt;true, T&gt; : false_type { };
  #30 2561.8       |                                                              ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:193:55: error: expected class-name before '{' token
  #30 2561.8   193 | template&lt;typename T&gt; struct is_reference : false_type {};
  #30 2561.8       |                                                       ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:194:58: error: expected class-name before '{' token
  #30 2561.8   194 | template&lt;typename T&gt; struct is_reference&lt;T&amp;&gt; : true_type {};
  #30 2561.8       |                                                          ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:202:21: error: expected template-name before '&lt;' token
  #30 2561.8   202 |  : integral_constant&lt;bool, (is_integral&lt;T&gt;::value ||
  #30 2561.8       |                     ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:202:21: error: expected '{' before '&lt;' token
  #30 2561.8 /usr/include/sparsehash/type_traits.h:221:22: error: expected template-name before '&lt;' token
  #30 2561.8   221 |   : integral_constant&lt;bool,
  #30 2561.8       |                      ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:221:22: error: expected '{' before '&lt;' token
  #30 2561.8 /usr/include/sparsehash/type_traits.h:236:22: error: expected template-name before '&lt;' token
  #30 2561.8   236 |   : integral_constant&lt;bool,
  #30 2561.8       |                      ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:236:22: error: expected '{' before '&lt;' token
  #30 2561.8 /usr/include/sparsehash/type_traits.h:249:22: error: expected template-name before '&lt;' token
  #30 2561.8   249 |   : integral_constant&lt;bool,
  #30 2561.8       |                      ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:249:22: error: expected '{' before '&lt;' token
  #30 2561.8 /usr/include/sparsehash/type_traits.h:262:22: error: expected template-name before '&lt;' token
  #30 2561.8   262 |   : integral_constant&lt;bool,
  #30 2561.8       |                      ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:262:22: error: expected '{' before '&lt;' token
  #30 2561.8 /usr/include/sparsehash/type_traits.h:296:69: error: expected class-name before '{' token
  #30 2561.8   296 | template&lt;typename T, typename U&gt; struct is_same : public false_type { };
  #30 2561.8       |                                                                     ^
  #30 2561.8 /usr/include/sparsehash/type_traits.h:297:62: error: expected class-name before '{' token
  #30 2561.8   297 | template&lt;typename T&gt; struct is_same&lt;T, T&gt; : public true_type { };
  #30 2561.8       |                                                              ^
  #30 2561.9 /usr/include/sparsehash/type_traits.h:314:10: error: 'small_' does not name a type
  #30 2561.9   314 |   static small_ Test(To);
  #30 2561.9       |          ^~~~~~
  #30 2561.9 /usr/include/sparsehash/type_traits.h:315:10: error: 'big_' does not name a type
  #30 2561.9   315 |   static big_ Test(...);
  #30 2561.9       |          ^~~~
  #30 2561.9 /usr/include/sparsehash/type_traits.h:323:24: error: expected template-name before '&lt;' token
  #30 2561.9   323 |     : integral_constant&lt;bool,
  #30 2561.9       |                        ^
  #30 2561.9 /usr/include/sparsehash/type_traits.h:323:24: error: expected '{' before '&lt;' token
  #30 2561.9 In file included from /usr/include/sparsehash/internal/sparsehashtable.h:106,
  #30 2561.9                  from /usr/include/sparsehash/sparse_hash_map:93,
  #30 2561.9                  from ./pagespeed/kernel/html/html_keywords.h:27,
  #30 2561.9                  from pagespeed/kernel/util/statistics_logger.cc:42:
  #30 2561.9 /usr/include/sparsehash/sparsetable:266:25: error: 'true_type' has not been declared in 'google'
  #30 2561.9   266 | using GOOGLE_NAMESPACE::true_type;
  #30 2561.9       |                         ^~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:267:25: error: 'false_type' has not been declared in 'google'
  #30 2561.9   267 | using GOOGLE_NAMESPACE::false_type;
  #30 2561.9       |                         ^~~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:268:25: error: 'integral_constant' has not been declared in 'google'
  #30 2561.9   268 | using GOOGLE_NAMESPACE::integral_constant;
  #30 2561.9       |                         ^~~~~~~~~~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1086:40: error: 'google::base::true_type' has not been declared
  #30 2561.9  1086 |   void set_aux(size_type offset, base::true_type) {
  #30 2561.9       |                                        ^~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1098:40: error: 'google::base::false_type' has not been declared
  #30 2561.9  1098 |   void set_aux(size_type offset, base::false_type) {
  #30 2561.9       |                                        ^~~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1098:8: error: 'void google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::set_aux(google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::size_type, int)' cannot be overloaded with 'void google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::set_aux(google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::size_type, int)'
  #30 2561.9  1098 |   void set_aux(size_type offset, base::false_type) {
  #30 2561.9       |        ^~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1086:8: note: previous declaration 'void google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::set_aux(google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::size_type, int)'
  #30 2561.9  1086 |   void set_aux(size_type offset, base::true_type) {
  #30 2561.9       |        ^~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1151:42: error: 'google::base::true_type' has not been declared
  #30 2561.9  1151 |   void erase_aux(size_type offset, base::true_type) {
  #30 2561.9       |                                          ^~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1168:42: error: 'google::base::false_type' has not been declared
  #30 2561.9  1168 |   void erase_aux(size_type offset, base::false_type) {
  #30 2561.9       |                                          ^~~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1168:8: error: 'void google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::erase_aux(google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::size_type, int)' cannot be overloaded with 'void google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::erase_aux(google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::size_type, int)'
  #30 2561.9  1168 |   void erase_aux(size_type offset, base::false_type) {
  #30 2561.9       |        ^~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1151:8: note: previous declaration 'void google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::erase_aux(google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::size_type, int)'
  #30 2561.9  1151 |   void erase_aux(size_type offset, base::true_type) {
  #30 2561.9       |        ^~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable: In member function 'google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::reference google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::set(google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::size_type, google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::const_reference)':
  #30 2561.9 /usr/include/sparsehash/sparsetable:1118:21: error: 'integral_constant' in namespace 'google::base' does not name a template type
  #30 2561.9  1118 |       typedef base::integral_constant&lt;bool,
  #30 2561.9       |                     ^~~~~~~~~~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1125:23: error: there are no arguments to 'realloc_and_memmove_ok' that depend on a template parameter, so a declaration of 'realloc_and_memmove_ok' must be available [-fpermissive]
  #30 2561.9  1125 |       set_aux(offset, realloc_and_memmove_ok());
  #30 2561.9       |                       ^~~~~~~~~~~~~~~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1125:23: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
  #30 2561.9 /usr/include/sparsehash/sparsetable: In member function 'void google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::erase(google::sparsegroup&lt;T, GROUP_SIZE, Alloc&gt;::size_type)':
  #30 2561.9 /usr/include/sparsehash/sparsetable:1190:23: error: 'integral_constant' in namespace 'google::base' does not name a template type
  #30 2561.9  1190 |         typedef base::integral_constant&lt;bool,
  #30 2561.9       |                       ^~~~~~~~~~~~~~~~~
  #30 2561.9 /usr/include/sparsehash/sparsetable:1197:27: error: there are no arguments to 'realloc_and_memmove_ok' that depend on a template parameter, so a declaration of 'realloc_and_memmove_ok' must be available [-fpermissive]
  #30 2561.9  1197 |         erase_aux(offset, realloc_and_memmove_ok());
  #30 2561.9       |                           ^~~~~~~~~~~~~~~~~~~~~~
  #30 2562.0   CXX(target) out/Release/obj.target/util/pagespeed/kernel/util/url_to_filename_encoder.o
  #30 2562.3 make[1]: *** [pagespeed/util.target.mk:323: out/Release/obj.target/util/pagespeed/kernel/util/statistics_logger.o] Error 1
  #30 2562.3 make[1]: *** Waiting for unfinished jobs....
  #30 2563.1 make: *** [Makefile:209: build_libraries] Error 2
  </code></pre>
  <p>Can someone help me please to resolve this error?
  The code is building on an Alpine I managed that with some patches (Source for some patches are the patches from FreeBSD: <a href="https://svnweb.freebsd.org/ports/head/www/mod_pagespeed/files/?pathrev=548979" rel="nofollow noreferrer">https://svnweb.freebsd.org/ports/head/www/mod_pagespeed/files/?pathrev=548979</a>)
  Mostly only the OpenSSL 1.1 Support patch.</p>