Re: Building v15 on Solaris fails xxhash.h error: '_Static_assert' was not declared in this scope
Andrew Watkins <[email protected]> Thu, 14 May 2026 17:38:00 +0100
| Newsgroups | gmane.comp.sysutils.backup.bacula.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============7415990649745528082==
Content-Type: multipart/alternative;
boundary="------------HrknVfECYKnyUn1AVBVZozIj"
Content-Language: en-GB
--------------HrknVfECYKnyUn1AVBVZozIj
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Very useful information you have given me.
Looks like the GCC build on Solaris has "__STDC_VERSION__" defined,
trying to find a good reference, but looks like all for compatibility
reasons.
ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57025 &
https://github.com/jperkin/notes/blob/main/gcc-cpp-stdc/README.md
"On Solaris, __STDC_VERSION__ is defined even for C++ build, meaning that
the following check doesn't work as expected. Replacing it with __cplusplus
fixes the issue."
Solaris11.4$ /usr/gcc/14/bin/g++ -dM -x c++ -E - < /dev/null | egrep
"__cplusplus|_STDC_VERSION_"
#define __cplusplus 201703L
#define __STDC_VERSION__ 201112L
Ubuntu24.04$ g++-14 -dM -x c++ -E - < /dev/null | egrep
"__cplusplus|_STDC_VERSION_"
#define __cplusplus 201703L
I think a possible fix which may work on all platforms is:
--- bacula-15.0.3/src/lib/xxhash.h 2025-03-26 14:34:35.000000000 +0000
+++ bacula-15.0.3/src/lib/xxhash.h 2026-05-14 11:19:57.899228372 +0100
@@ -1808,7 +1808,7 @@
/* note: use after variable declarations */
#ifndef XXH_STATIC_ASSERT
-# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /*
C11 */
+# if !defined(__cplusplus) && defined(__STDC_VERSION__) &&
(__STDC_VERSION__ >= 201112L) /* C11 */
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
# elif defined(__cplusplus) && (__cplusplus >= 201103L) /*
C++11 */
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
static_assert((c),m); } while(0)
Anyway, thanks for your help so far.
Andrew
On 5/13/2026 8:30 PM, Martin Simmons wrote:
> Yes, it should be picking line 1814, but it appears to be picking line 1812
> because __STDC_VERSION__ is defined unexpectedly.
>
> Your test with -dD is useful, but I suggest trying it with xxhash.c and the
> compiler used by libtool in case that is different, i.e.
>
> cd src/lib
> /usr/gcc/14/bin/g++ -E -dD -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti -I. -I.. -g -O2 -Wall -m64 -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti xxhash.c -fPIC -DPIC
>
> and verify that also defines __STDC_VERSION__ as a "<built-in>" macro.
>
> If it isn't a "<built-in>" macro, then which file defines it?
>
> If it is a "<built-in>" macro, then I think your /usr/gcc/14/bin/g++ is
> broken, because __STDC_VERSION__ should not be defined when compiling C++
> according to
> https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html.
>
> Also, does it define __cplusplus like it should?
>
> I see you are now using /usr/gcc/14/bin/g++ instead of /usr/gcc/13/bin/g++ as
> in previous output. FWIW, __STDC_VERSION__ is not defined in FreeBSD's g++13
> and g++14 when -x c++ is passed. This must be true for most other
> platforms/version as well, otherwise the problem would have been fixed
> already.
>
> __Martin
>
>
>>>>>> On Wed, 13 May 2026 16:10:44 +0100, Andrew Watkins said:
>> Hi,
>>
>> Full output of compile below.
>>
>> I see the problem the libtool is picking this line 1812 in xxhash.h:
>>
>> # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
>> /* C11 */
>> define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> *_Static_assert*((c),m); } while(0)
>>
>> Where it should be "I am gussing" line 1814:
>>
>> # elif defined(__cplusplus) && (__cplusplus >= 201103L)
>> /* C++11 */
>> # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> *static_assert*((c),m); } while(0)
>>
>> The question of how to fix it. Information I have:
>>
>> # gcc -x c++ /dev/null -E -dD |grep STDC_VERSION
>> #define __STDC_VERSION__ 201112L
>>
>> Full output:
>>
>> $ cd src/lib
>> $ /home/andrew/src/bacula-15.0.3/libtool --tag=CXX --mode=compile
>> /usr/gcc/14/bin/g++ -c -x c++ -fno-strict-aliasing -fno-exceptions
>> -fno-rtti -I. -I.. -g -O2 -W all -m64 -x c++ -fno-strict-aliasing
>> -fno-exceptions -fno-rtti xxhash.c
>> libtool: compile: /usr/gcc/14/bin/g++ -c -x c++ -fno-strict-aliasing
>> -fno-exceptions -fno-rtti -I. -I.. -g -O2 -Wall -m64 -x c++
>> -fno-strict-aliasing -fno-exceptions -fno-rtti xxhash.c -fPIC -DPIC -o
>> .libs/xxhash.o
>> In file included from xxhash.c:43:
>> *xxhash.h: In function 'void XXH32_canonicalFromHash(XXH32_canonical_t*,
>> XXH32_hash_t)':*
>> *xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>> scope; did you mean 'static_assert'?*
>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> _Static_assert((c),m); } while(0)
>> | ^~~~~~~~~~~~~~
>> xxhash.h:1818:32: note: in expansion of macro
>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>> 1818 | # define XXH_STATIC_ASSERT(c)
>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> xxhash.h:2535:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
>> 2535 | XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) ==
>> sizeof(XXH32_hash_t));
>> | ^~~~~~~~~~~~~~~~~
>> xxhash.h: In function 'void XXH64_canonicalFromHash(XXH64_canonical_t*,
>> XXH64_hash_t)':
>> xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>> scope; did you mean 'static_assert'?
>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> _Static_assert((c),m); } while(0)
>> | ^~~~~~~~~~~~~~
>> xxhash.h:1818:32: note: in expansion of macro
>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>> 1818 | # define XXH_STATIC_ASSERT(c)
>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> xxhash.h:2961:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
>> 2961 | XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) ==
>> sizeof(XXH64_hash_t));
>> | ^~~~~~~~~~~~~~~~~
>> xxhash.h: In function 'void XXH3_initCustomSecret_sse2(void*, xxh_u64)':
>> xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>> scope; did you mean 'static_assert'?
>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> _Static_assert((c),m); } while(0)
>> | ^~~~~~~~~~~~~~
>> xxhash.h:1818:32: note: in expansion of macro
>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>> 1818 | # define XXH_STATIC_ASSERT(c)
>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> xxhash.h:4383:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
>> 4383 | XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0);
>> | ^~~~~~~~~~~~~~~~~
>> xxhash.h: In function 'void XXH3_initCustomSecret_scalar(void*, xxh_u64)':
>> xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>> scope; did you mean 'static_assert'?
>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> _Static_assert((c),m); } while(0)
>> | ^~~~~~~~~~~~~~
>> xxhash.h:1818:32: note: in expansion of macro
>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>> 1818 | # define XXH_STATIC_ASSERT(c)
>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> xxhash.h:4752:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
>> 4752 | XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0);
>> | ^~~~~~~~~~~~~~~~~
>> xxhash.h: In function 'XXH64_hash_t XXH3_hashLong_64b_internal(const
>> void*, std::size_t, const void*, std::size_t, XXH3_f_accumulate_512,
>> XXH3_f_scrambleAcc)':
>> xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>> scope; did you mean 'static_assert'?
>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> _Static_assert((c),m); } while(0)
>> | ^~~~~~~~~~~~~~
>> xxhash.h:1818:32: note: in expansion of macro
>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>> 1818 | # define XXH_STATIC_ASSERT(c)
>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> xxhash.h:4976:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
>> 4976 | XXH_STATIC_ASSERT(sizeof(acc) == 64);
>> | ^~~~~~~~~~~~~~~~~
>> xxhash.h: In function 'XXH_errorcode XXH3_update(XXH3_state_t*, const
>> xxh_u8*, std::size_t, XXH3_f_accumulate_512, XXH3_f_scrambleAcc)':
>> xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>> scope; did you mean 'static_assert'?
>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> _Static_assert((c),m); } while(0)
>> | ^~~~~~~~~~~~~~
>> xxhash.h:1818:32: note: in expansion of macro
>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>> 1818 | # define XXH_STATIC_ASSERT(c)
>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> xxhash.h:5342:9: note: in expansion of macro 'XXH_STATIC_ASSERT'
>> 5342 | XXH_STATIC_ASSERT(XXH3_INTERNALBUFFER_SIZE % XXH_STRIPE_LEN ==
>> 0); /* clean multiple */
>> | ^~~~~~~~~~~~~~~~~
>> xxhash.h: In function 'XXH128_hash_t XXH3_hashLong_128b_internal(const
>> void*, std::size_t, const xxh_u8*, std::size_t, XXH3_f_accumulate_512,
>> XXH3_f_scrambleAcc)':
>> xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>> scope; did you mean 'static_assert'?
>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> _Static_assert((c),m); } while(0)
>> | ^~~~~~~~~~~~~~
>> xxhash.h:1818:32: note: in expansion of macro
>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>> 1818 | # define XXH_STATIC_ASSERT(c)
>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> xxhash.h:5768:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
>> 5768 | XXH_STATIC_ASSERT(sizeof(acc) == 64);
>> | ^~~~~~~~~~~~~~~~~
>> xxhash.h: In function 'void
>> XXH128_canonicalFromHash(XXH128_canonical_t*, XXH128_hash_t)':
>> xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>> scope; did you mean 'static_assert'?
>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>> _Static_assert((c),m); } while(0)
>> | ^~~~~~~~~~~~~~
>> xxhash.h:1818:32: note: in expansion of macro
>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>> 1818 | # define XXH_STATIC_ASSERT(c)
>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> xxhash.h:6011:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
>> 6011 | XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) ==
>> sizeof(XXH128_hash_t));
>> | ^~~~~~~~~~~~~~~~~
>>
>> Thanks,
>> Andrew
>>
>> On 5/11/2026 5:56 PM, Martin Simmons wrote:
>>> The config.out looks OK to me.
>>>
>>> In particular in:
>>>
>>> C Compiler: gcc 13.4.0
>>> C++ Compiler: /usr/gcc/13/bin/g++ 13.4.0
>>> Compiler flags: -g -O2 -Wall -m64 -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti
>>>
>>> the -x c++ option is supposed to force the compiler to compile the file as
>>> C++, so __STDC_VERSION__ should not be defined. That works for gcc/g++ in
>>> general.
>>>
>>> I think you have to investigate the exact command line used to compile
>>> xxhash.c by doing:
>>>
>>> cd src/lib
>>> make NO_ECHO=
>>>
>>> That should make it print the commands so you can check it is using the
>>> expected compiler and flags. I assume this will give the same error.
>>>
>>> If you see it running libtool --silent then try running the same libtool
>>> command without --silent to see how libtool is invoking the compiler.
>>>
>>> __Martin
>>>
>>>
>>>>>>>> On Fri, 1 May 2026 19:57:20 +0100, Andrew Watkins said:
>>>> Hi,
>>>>
>>>> I can see what it is doing but why?
>>>>
>>>> From xxhash.h
>>>>
>>>> /* note: use after variable declarations */
>>>> #ifndef XXH_STATIC_ASSERT
>>>> # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /*
>>>> C11 */ <<<<<
>>>> # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>>>> _Static_assert((c),m); } while(0) <<<<< This being picked in error!!!
>>>> # elif defined(__cplusplus) && (__cplusplus >= 201103L) /*
>>>> C++11 */
>>>> # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>>>> static_assert((c),m); } while(0) <<<<< Is this correct for Solaris?
>>>> # else
>>>> # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa {
>>>> char x[(c) ? 1 : -1]; }; } while(0)
>>>> # endif
>>>> # define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>>>> #endif
>>>>
>>>> Attached is config.out
>>>>
>>>> Thanks,
>>>> Andrew
>>>>
>>>>
>>>> On 5/1/2026 5:27 PM, Martin Simmons wrote:
>>>>>>>>>> On Fri, 1 May 2026 12:14:09 +0100, Andrew Watkins said:
>>>>>> Hello,
>>>>>>
>>>>>> I was looking at moving to Bacula 15.0.3 on our servers, but it does not
>>>>>> build on Solaris 11.4
>>>>>>
>>>>>> Version 13.0.4 builds on Solaris.
>>>>>>
>>>>>> I get this in xxhash (doesn't look like this is in v13)
>>>>>>
>>>>>> In file included from xxhash.c:43:
>>>>>> xxhash.h: In function 'void XXH32_canonicalFromHash(XXH32_canonical_t*,
>>>>>> XXH32_hash_t)':
>>>>>> xxhash.h:1812:54: error: '_Static_assert' was not declared in this
>>>>>> scope; did you mean 'static_assert'?
>>>>>> 1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
>>>>>> _Static_assert((c),m); } while(0)
>>>>>> | ^~~~~~~~~~~~~~
>>>>>> xxhash.h:1818:32: note: in expansion of macro
>>>>>> 'XXH_STATIC_ASSERT_WITH_MESSAGE'
>>>>>> 1818 | # define XXH_STATIC_ASSERT(c)
>>>>>> XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
>>>>>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>> xxhash.h:2535:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
>>>>>> 2535 | XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) ==
>>>>>> sizeof(XXH32_hash_t));
>>>>>> | ^~~~~~~~~~~~~~~~~
>>>>> It looks like there is some confusion about C v.s. C++.
>>>>>
>>>>> What C++ compiler & version are you using?
>>>>>
>>>>> Can you show us the contents of config.out (generated by configure)?
>>>>>
>>>>> __Martin
>>>> --
>>>> *****************************************************
>>>> ***** [email protected] *****
>>>> *****************************************************
>>>> * Andrew Watkins *
>>>> * Birkbeck, University of London *
>>>> * Computing and Mathematical Sciences *
>>>> *https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fnotallmicrosoft.blogspot.com&c=E,1,wm3CK_7eqnUXaHAjzfsRLCBJb57d1tQSxCgVdR7fBUl0EOcqDDZiY3osSJYGGLO5uWR0p9F8P2bQQgDQz0UIDEvkV1Cn0256T-dDtOFVLo4l&typo=1 *
>>>> *****************************************************
>>>>
>> --
>> *****************************************************
>> ***** Support [email protected] *****
>> *****************************************************
>> * Andrew Watkins *
>> * Birkbeck, University of London *
>> * Computing and Mathematical Sciences *
>> *https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fnotallmicrosoft.blogspot.com&c=E,1,6cLoHThLPIkc4Wiz-1yuip6MNklMxViyw2i6xd4qeCoWvv1cqhfusu-ScQQU9HdPwr3dS6sG0BChW5F8mkU3M1b7fPMdRpnt52Qw3kI-eH7_eHw,&typo=1 *
>> *****************************************************
>>
--
*****************************************************
***** Support Request [email protected] *****
*****************************************************
* Andrew Watkins *
* Birkbeck, University of London *
* Computing and Mathematical Sciences *
*http://notallmicrosoft.blogspot.com *
*****************************************************
--------------HrknVfECYKnyUn1AVBVZozIj
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html><html data-lt-installed="true"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="padding-bottom: 1px;">
<p>Very useful information you have given me.</p>
<p>Looks like the GCC build on Solaris has "__STDC_VERSION__"
defined, trying to find a good reference, but looks like all for
compatibility reasons.</p>
<p>ref: <a class="moz-txt-link-freetext" href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57025">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57025</a> &
<a class="moz-txt-link-freetext" href="https://github.com/jperkin/notes/blob/main/gcc-cpp-stdc/README.md">https://github.com/jperkin/notes/blob/main/gcc-cpp-stdc/README.md</a></p>
<p>"On Solaris, __STDC_VERSION__ is defined even for C++ build,
meaning that<br>
the following check doesn't work as expected. Replacing it with
__cplusplus<br>
fixes the issue."</p>
<font face="monospace">Solaris11.4$ /usr/gcc/14/bin/g++ -dM -x c++
-E - < /dev/null | egrep "__cplusplus|_STDC_VERSION_"<br>
#define __cplusplus 201703L<br>
#define __STDC_VERSION__ 201112L<br>
</font><br>
<font face="monospace">Ubuntu24.04$ g++-14 -dM -x c++ -E - <
/dev/null | egrep "__cplusplus|_STDC_VERSION_"<br>
#define __cplusplus 201703L</font>
<p>I think a possible fix which may work on all platforms is:</p>
<font face="monospace">--- bacula-15.0.3/src/lib/xxhash.h
2025-03-26 14:34:35.000000000 +0000<br>
+++ bacula-15.0.3/src/lib/xxhash.h 2026-05-14 11:19:57.899228372
+0100<br>
@@ -1808,7 +1808,7 @@<br>
<br>
/* note: use after variable declarations */<br>
#ifndef XXH_STATIC_ASSERT<br>
-# if defined(__STDC_VERSION__) && (__STDC_VERSION__
>= 201112L) /* C11 */<br>
+# if !defined(__cplusplus) && defined(__STDC_VERSION__)
&& (__STDC_VERSION__ >= 201112L) /* C11 */<br>
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)<br>
# elif defined(__cplusplus) && (__cplusplus >=
201103L) /* C++11 */<br>
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
static_assert((c),m); } while(0)</font>
<p>Anyway, thanks for your help so far.</p>
<p>Andrew</p>
<div class="moz-cite-prefix">On 5/13/2026 8:30 PM, Martin Simmons
wrote:<br>
</div>
<blockquote type="cite" cite="mid:[email protected]">
<pre wrap="" class="moz-quote-pre">Yes, it should be picking line 1814, but it appears to be picking line 1812
because __STDC_VERSION__ is defined unexpectedly.
Your test with -dD is useful, but I suggest trying it with xxhash.c and the
compiler used by libtool in case that is different, i.e.
cd src/lib
/usr/gcc/14/bin/g++ -E -dD -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti -I. -I.. -g -O2 -Wall -m64 -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti xxhash.c -fPIC -DPIC
and verify that also defines __STDC_VERSION__ as a "<built-in>" macro.
If it isn't a "<built-in>" macro, then which file defines it?
If it is a "<built-in>" macro, then I think your /usr/gcc/14/bin/g++ is
broken, because __STDC_VERSION__ should not be defined when compiling C++
according to
<a class="moz-txt-link-freetext" href="https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html">https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html</a>.
Also, does it define __cplusplus like it should?
I see you are now using /usr/gcc/14/bin/g++ instead of /usr/gcc/13/bin/g++ as
in previous output. FWIW, __STDC_VERSION__ is not defined in FreeBSD's g++13
and g++14 when -x c++ is passed. This must be true for most other
platforms/version as well, otherwise the problem would have been fixed
already.
__Martin
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">On Wed, 13 May 2026 16:10:44 +0100, Andrew Watkins said:
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap="" class="moz-quote-pre">
Hi,
Full output of compile below.
I see the problem the libtool is picking this line 1812 in xxhash.h:
# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
/* C11 */
define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
*_Static_assert*((c),m); } while(0)
Where it should be "I am gussing" line 1814:
# elif defined(__cplusplus) && (__cplusplus >= 201103L)
/* C++11 */
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
*static_assert*((c),m); } while(0)
The question of how to fix it. Information I have:
# gcc -x c++ /dev/null -E -dD |grep STDC_VERSION
#define __STDC_VERSION__ 201112L
Full output:
$ cd src/lib
$ /home/andrew/src/bacula-15.0.3/libtool --tag=CXX --mode=compile
/usr/gcc/14/bin/g++ -c -x c++ -fno-strict-aliasing -fno-exceptions
-fno-rtti -I. -I.. -g -O2 -W all -m64 -x c++ -fno-strict-aliasing
-fno-exceptions -fno-rtti xxhash.c
libtool: compile: /usr/gcc/14/bin/g++ -c -x c++ -fno-strict-aliasing
-fno-exceptions -fno-rtti -I. -I.. -g -O2 -Wall -m64 -x c++
-fno-strict-aliasing -fno-exceptions -fno-rtti xxhash.c -fPIC -DPIC -o
.libs/xxhash.o
In file included from xxhash.c:43:
*xxhash.h: In function 'void XXH32_canonicalFromHash(XXH32_canonical_t*,
XXH32_hash_t)':*
*xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?*
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:2535:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
2535 | XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) ==
sizeof(XXH32_hash_t));
| ^~~~~~~~~~~~~~~~~
xxhash.h: In function 'void XXH64_canonicalFromHash(XXH64_canonical_t*,
XXH64_hash_t)':
xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:2961:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
2961 | XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) ==
sizeof(XXH64_hash_t));
| ^~~~~~~~~~~~~~~~~
xxhash.h: In function 'void XXH3_initCustomSecret_sse2(void*, xxh_u64)':
xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:4383:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
4383 | XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0);
| ^~~~~~~~~~~~~~~~~
xxhash.h: In function 'void XXH3_initCustomSecret_scalar(void*, xxh_u64)':
xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:4752:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
4752 | XXH_STATIC_ASSERT((XXH_SECRET_DEFAULT_SIZE & 15) == 0);
| ^~~~~~~~~~~~~~~~~
xxhash.h: In function 'XXH64_hash_t XXH3_hashLong_64b_internal(const
void*, std::size_t, const void*, std::size_t, XXH3_f_accumulate_512,
XXH3_f_scrambleAcc)':
xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:4976:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
4976 | XXH_STATIC_ASSERT(sizeof(acc) == 64);
| ^~~~~~~~~~~~~~~~~
xxhash.h: In function 'XXH_errorcode XXH3_update(XXH3_state_t*, const
xxh_u8*, std::size_t, XXH3_f_accumulate_512, XXH3_f_scrambleAcc)':
xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:5342:9: note: in expansion of macro 'XXH_STATIC_ASSERT'
5342 | XXH_STATIC_ASSERT(XXH3_INTERNALBUFFER_SIZE % XXH_STRIPE_LEN ==
0); /* clean multiple */
| ^~~~~~~~~~~~~~~~~
xxhash.h: In function 'XXH128_hash_t XXH3_hashLong_128b_internal(const
void*, std::size_t, const xxh_u8*, std::size_t, XXH3_f_accumulate_512,
XXH3_f_scrambleAcc)':
xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:5768:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
5768 | XXH_STATIC_ASSERT(sizeof(acc) == 64);
| ^~~~~~~~~~~~~~~~~
xxhash.h: In function 'void
XXH128_canonicalFromHash(XXH128_canonical_t*, XXH128_hash_t)':
xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:6011:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
6011 | XXH_STATIC_ASSERT(sizeof(XXH128_canonical_t) ==
sizeof(XXH128_hash_t));
| ^~~~~~~~~~~~~~~~~
Thanks,
Andrew
On 5/11/2026 5:56 PM, Martin Simmons wrote:
</pre>
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">The config.out looks OK to me.
In particular in:
C Compiler: gcc 13.4.0
C++ Compiler: /usr/gcc/13/bin/g++ 13.4.0
Compiler flags: -g -O2 -Wall -m64 -x c++ -fno-strict-aliasing -fno-exceptions -fno-rtti
the -x c++ option is supposed to force the compiler to compile the file as
C++, so __STDC_VERSION__ should not be defined. That works for gcc/g++ in
general.
I think you have to investigate the exact command line used to compile
xxhash.c by doing:
cd src/lib
make NO_ECHO=
That should make it print the commands so you can check it is using the
expected compiler and flags. I assume this will give the same error.
If you see it running libtool --silent then try running the same libtool
command without --silent to see how libtool is invoking the compiler.
__Martin
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">On Fri, 1 May 2026 19:57:20 +0100, Andrew Watkins said:
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap="" class="moz-quote-pre">Hi,
I can see what it is doing but why?
From xxhash.h
/* note: use after variable declarations */
#ifndef XXH_STATIC_ASSERT
# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /*
C11 */ <<<<<
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0) <<<<< This being picked in error!!!
# elif defined(__cplusplus) && (__cplusplus >= 201103L) /*
C++11 */
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
static_assert((c),m); } while(0) <<<<< Is this correct for Solaris?
# else
# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { struct xxh_sa {
char x[(c) ? 1 : -1]; }; } while(0)
# endif
# define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
#endif
Attached is config.out
Thanks,
Andrew
On 5/1/2026 5:27 PM, Martin Simmons wrote:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="" class="moz-quote-pre">On Fri, 1 May 2026 12:14:09 +0100, Andrew Watkins said:
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap="" class="moz-quote-pre">Hello,
I was looking at moving to Bacula 15.0.3 on our servers, but it does not
build on Solaris 11.4
Version 13.0.4 builds on Solaris.
I get this in xxhash (doesn't look like this is in v13)
In file included from xxhash.c:43:
xxhash.h: In function 'void XXH32_canonicalFromHash(XXH32_canonical_t*,
XXH32_hash_t)':
xxhash.h:1812:54: error: '_Static_assert' was not declared in this
scope; did you mean 'static_assert'?
1812 | # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do {
_Static_assert((c),m); } while(0)
| ^~~~~~~~~~~~~~
xxhash.h:1818:32: note: in expansion of macro
'XXH_STATIC_ASSERT_WITH_MESSAGE'
1818 | # define XXH_STATIC_ASSERT(c)
XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xxhash.h:2535:5: note: in expansion of macro 'XXH_STATIC_ASSERT'
2535 | XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) ==
sizeof(XXH32_hash_t));
| ^~~~~~~~~~~~~~~~~
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">It looks like there is some confusion about C v.s. C++.
What C++ compiler & version are you using?
Can you show us the contents of config.out (generated by configure)?
__Martin
</pre>
</blockquote>
<pre wrap="" class="moz-quote-pre">--
*****************************************************
***** Support <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> *****
*****************************************************
* Andrew Watkins *
* Birkbeck, University of London *
* Computing and Mathematical Sciences *
*<a class="moz-txt-link-freetext" href="https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fnotallmicrosoft.blogspot.com&c=E,1,wm3CK_7eqnUXaHAjzfsRLCBJb57d1tQSxCgVdR7fBUl0EOcqDDZiY3osSJYGGLO5uWR0p9F8P2bQQgDQz0UIDEvkV1Cn0256T-dDtOFVLo4l&typo=1">https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fnotallmicrosoft.blogspot.com&c=E,1,wm3CK_7eqnUXaHAjzfsRLCBJb57d1tQSxCgVdR7fBUl0EOcqDDZiY3osSJYGGLO5uWR0p9F8P2bQQgDQz0UIDEvkV1Cn0256T-dDtOFVLo4l&typo=1</a> *
*****************************************************
</pre>
</blockquote>
</blockquote>
<pre wrap="" class="moz-quote-pre">--
*****************************************************
***** Support Request <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> *****
*****************************************************
* Andrew Watkins *
* Birkbeck, University of London *
* Computing and Mathematical Sciences *
*<a class="moz-txt-link-freetext" href="https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fnotallmicrosoft.blogspot.com&c=E,1,6cLoHThLPIkc4Wiz-1yuip6MNklMxViyw2i6xd4qeCoWvv1cqhfusu-ScQQU9HdPwr3dS6sG0BChW5F8mkU3M1b7fPMdRpnt52Qw3kI-eH7_eHw,&typo=1">https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fnotallmicrosoft.blogspot.com&c=E,1,6cLoHThLPIkc4Wiz-1yuip6MNklMxViyw2i6xd4qeCoWvv1cqhfusu-ScQQU9HdPwr3dS6sG0BChW5F8mkU3M1b7fPMdRpnt52Qw3kI-eH7_eHw,&typo=1</a> *
*****************************************************
</pre>
</blockquote>
</blockquote>
<pre class="moz-signature" cols="72">--
*****************************************************
***** Support Request to <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a> *****
*****************************************************
* Andrew Watkins *
* Birkbeck, University of London *
* Computing and Mathematical Sciences *
* <a class="moz-txt-link-freetext" href="http://notallmicrosoft.blogspot.com">http://notallmicrosoft.blogspot.com</a> *
*****************************************************</pre>
</body>
<lt-container></lt-container>
</html>
--------------HrknVfECYKnyUn1AVBVZozIj--
--===============7415990649745528082==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============7415990649745528082==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel
--===============7415990649745528082==--