Moving from downstream bug report:
The mass rebuild of OpenChange  shows a failure of the build due to reference
to memset_s() in macros provided by samba. Part of the error message is here .
Am I able to do anything about it in the openchange package? Eventually, am I supposed to do anything with it at all? I mean, it feels like a regression, but I do not know whether the memset_s() had been used in those macros before. If the memset_s() requires any special defines being defined, then those should be added by samba headers.
I tried to move ndr.h include as the first include in the openchange's ndr_mapi.c file, but it didn't help at all . My idea was that maybe something includes string.h before samba has a chance to influence it, but it was not it.
 Part of the build log from :
Compiling ndr_mapi.c with -fPIC
BUILDSTDERR: In file included from /usr/include/samba-4.0/ndr.h:29,
BUILDSTDERR: from /usr/include/samba-4.0/dcerpc.h:32,
BUILDSTDERR: from libmapi/libmapi.h:45,
BUILDSTDERR: from ndr_mapi.c:22:
BUILDSTDERR: ndr_mapi.c: In function 'ndr_pull_EcDoRpc':
BUILDSTDERR: /usr/include/samba-4.0/util/memory.h:54:24: warning: implicit declaration of function 'memset_s'; did you mean 'memset'? [-Wimplicit-function-declaration]
BUILDSTDERR: 54 | #define ZERO_STRUCT(x) memset_s((char *)&(x), sizeof(x), 0, sizeof(x))
BUILDSTDERR: | ^~~~~~~~
BUILDSTDERR: ndr_mapi.c:924:3: note: in expansion of macro 'ZERO_STRUCT'
BUILDSTDERR: 924 | ZERO_STRUCT(r->out);
BUILDSTDERR: | ^~~~~~~~~~~
BUILDSTDERR: /usr/bin/ld: libmapi-openchange.so.2.3: undefined reference to `memset_s'
BUILDSTDERR: collect2: error: ld returned 1 exit status
BUILDSTDERR: make: *** [Makefile:450: bin/libmapixx-test] Error 1
BUILDSTDERR: error: Bad exit status from /var/tmp/rpm-tmp.aoXFCs (%build)
I've pushed a fix to https://gitlab.com/samba-team/samba/merge_requests/238
(In reply to Andreas Schneider from comment #1)
Can't you just build openchange with -D__STDC_WANT_LIB_EXT1__=1 ?
Stefan, memset_s() is C11 and glibc doesn't provide this call (yet). Also the C standard doesn't require to implement memset_s() it is optional which really sucks!
objdump -T /lib64/libc.so.6 | grep memset
00000000000a60d0 w iD .text 0000000000000047 GLIBC_2.2.5 wmemset
000000000010bd10 g iD .text 0000000000000047 GLIBC_2.4 __wmemset_chk
000000000008b120 g iD .text 0000000000000091 GLIBC_2.2.5 memset
000000000010a4c0 g iD .text 0000000000000091 GLIBC_2.3.4 __memset_chk
Created attachment 14848 [details]
Patch for 4.10
Karolin, please add the patch to the 4.10 branch. Thanks!
(In reply to Andreas Schneider from comment #5)
Pushed to autobuild-v4-10-test.
(In reply to Karolin Seeger from comment #6)
Pushed to v4-10-test.
Closing out bug report.