On 2026-05-08 22:15, Bruno Haible wrote:
Please make sure that a testdir of all of Gnulib still builds:
   $ ./gnulib-tool --create-testdir --dir=../testdir-all --with-c++- tests --without-privileged-tests --single-configure `./all-modules`
   $ cd ../testdir-all
   $ ./configure
   $ make
   $ make check

I ran into a problem when trying this recipe on Solaris 10. I can reproduce it with current Gnulib by building testdir-all with the above recipe on Fedora 44, then copying testdir-all to Solaris 10 sparc and then running:

# This uses Oracle Developer Studio 12.6 152881-04 2019/03/08.
export PATH=/opt/developerstudio12.6/bin:$PATH
./configure CC=cc CXX=CC
make

This eventually fails with:

CC -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -I. -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. \ -I../gllib -I./../gllib -D_REENTRANT -Wno-error -Wno-error -g -c -o test-arpa_inet-h-c++.o test-arpa_inet-h-c++.cc "../gllib/string.h", line 1823: Error: Template declarations cannot have extern "C" linkage. "../gllib/string.h", line 1824: Error: Template declarations cannot have extern "C" linkage. "../gllib/string.h", line 1826: Error: Template declarations cannot have extern "C" linkage.
3 Error(s) detected.

Here are lines 1821-1829 of gllib/string.h:

#  ifdef __cplusplus
_GL_BEGIN_NAMESPACE
template <typename T> T strnul (T);
template <> inline const char *strnul<const char *> (const char *s)
{ return _gl_strnul (s); }
template <> inline       char *strnul<      char *> (      char *s)
{ return const_cast<char *>(_gl_strnul (s)); }
_GL_END_NAMESPACE
#  else

You can see the full log in the build directory by logging into cfarm210 and inspecting ~eggert/testdir-all/build-log.txt.

Should there be be a 'extern "C++"' around this template, just as there is for mbsstr, mbspcasecmp, mbscasestr in lib/string.in.h? But those other instances are marked "needed for AIX", not "needed for Oracle Developer Studio".

Reply via email to