Samba doesn't compile with GCC of version 7.5.0 without optimization

Pavel Kalugin PKalugin at inno.tech
Tue Mar 26 07:05:36 UTC 2024


Hi All.

I pulled the Samba master and found that it doesn't compile on my OpenSUSE 15.5
with the stock GCC version 7.5.0 in developer mode, i.e. with optimizations disabled.

Is that GCC version is still supported?

In case it is:
The problem commit is this: https://gitlab.com/samba-team/samba/-/commit/924eb6bac50885a4d90cba227de569087185a06d

The message is:
```
[1909/4885] Compiling lib/crypto/gkdi.c
In file included from /usr/lib64/gcc/x86_64-suse-linux/7/include/stdint.h:9:0,
                  from /usr/include/inttypes.h:27,
                  from ../../lib/crypto/../replace/replace.h:64,
                  from ../../source4/include/includes.h:23,
                  from ../../lib/crypto/gkdi.c:21:
.../../lib/crypto/gkdi.c: In function ‘gkdi_get_key_start_time’:
.../../lib/crypto/gkdi.c:197:4: error: initializer element is not constant
     UINT64_MAX /
     ^
.../../lib/crypto/gkdi.c:197:4: note: (near initialization for ‘max_gkid.l0_idx’)
.../../lib/crypto/gkdi.c:200:4: error: initializer element is not constant
     UINT64_MAX /
     ^
.../../lib/crypto/gkdi.c:200:4: note: (near initialization for ‘max_gkid.l1_idx’)
.../../lib/crypto/gkdi.c:204:4: error: initializer element is not constant
     UINT64_MAX / gkdi_key_cycle_duration %
     ^
.../../lib/crypto/gkdi.c:204:4: note: (near initialization for ‘max_gkid.l2_idx’)
```

The reason is that GCC version < 8.1 can't handle such initialization, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66618 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69960

The fix that is working for me is here: https://gitlab.com/samba-team/samba/-/merge_requests/3574

And the solution is to give up the static specifier in such a case, unfortunately.

-- 
Pavel Kalugin
inno.tech



More information about the samba-technical mailing list