Bug 14526 - Failure to build with Sun C compiler
Summary: Failure to build with Sun C compiler
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.10.18
Hardware: Sparc Solaris
: P5 normal (vote)
Target Milestone: ---
Assignee: Björn Jacke
QA Contact: Samba QA Contact
Depends on:
Reported: 2020-10-08 04:34 UTC by Albert Chin
Modified: 2020-10-16 06:10 UTC (History)
0 users

See Also:

Patch to lib/util/debug.c (484 bytes, patch)
2020-10-08 04:34 UTC, Albert Chin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Chin 2020-10-08 04:34:00 UTC
Created attachment 16275 [details]
Patch to lib/util/debug.c

When building 4.10.18 on Solaris 10/11 with the vendor C compiler, the following error is reported:
[ 454/3077] Compiling lib/util/debug.c
12:25:55 runner ['c99', '-D_SAMBA_BUILD_=4', '-DHAVE_CONFIG_H=1', '-mr', '-Qn', '-xstrconst', '-xO2', '-xtarget=ultra2', '-m32', '-xarch=sparcvis', '-D__EXTENSIONS__', '-D_STDC_C99=1', '-D_XPG6=1', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '-DHAVE_CONFIG_H=1', '-KPIC', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_REENTRANT', '-DSTATIC_samba_debug_MODULES=NULL', '-DSTATIC_samba_debug_MODULES_PROTO=extern void __samba_debug_dummy_module_proto(void)', '-Iinclude/public', '-I../../include/public', '-Isource4', '-I../../source4', '-Ilib', '-I../../lib', '-Isource4/lib', '-I../../source4/lib', '-Isource4/include', '-I../../source4/include', '-Iinclude', '-I../../include', '-Ilib/replace', '-I../../lib/replace', '-I.', '-I../..', '-Ilib/talloc', '-I../../lib/talloc', '../../lib/util/debug.c', '-c', '-o', '/opt/build/samba-4.10.18/bin/default/lib/util/debug.c.9.o', '-I/opt/TWWfsw/gettext018/include', '-I/opt/TWWfsw/libarchive31/include', '-I/opt/TWWfsw/libgcrypt15/include', '-I/opt/TWWfsw/libgnutls212/include', '-I/opt/TWWfsw/libgpgerror111/include', '-I/opt/TWWfsw/libiconv113/include', '-I/opt/TWWfsw/libgpgme14/include', '-I/opt/TWWfsw/libjansson212/include', '-I/opt/TWWfsw/liblmdb09/include', '-I/opt/TWWfsw/libz12/include', '-I/opt/TWWfsw/openldap24/include']
"../../lib/talloc/talloc.h", line 1058: warning:  attribute "deprecated" is unknown, ignored
"../../lib/talloc/talloc.h", line 1924: warning:  attribute "deprecated" is unknown, ignored
"../../lib/util/debug.c", line 163: non-constant initializer: op "NAME"
c99: acomp failed for ../../lib/util/debug.c

In lib/util/debug.c, we have:
static struct debug_class debug_class_list_initial[ARRAY_SIZE(default_classname_
table)] = {
        [DBGC_ALL] = (struct debug_class) { .fd = 2 },

Removing (struct debug_class) fixes the compile issue.
Comment 1 Björn Jacke 2020-10-08 16:33:55 UTC
amzaingly that compiler does not even support the deprecated attribute. Current versions of the studio compiler do support that as far as I know. Which version do you have there? I actually think that you should update the compiler, that will probably also make it accept modern struct assignments then.
Comment 2 Samba QA Contact 2020-10-16 06:10:06 UTC
This bug was referenced in samba master: