Bug 14680 - error: implicit declaration of function 'DEBUG' is invalid in C99
Summary: error: implicit declaration of function 'DEBUG' is invalid in C99
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.14.2
Hardware: x64 Mac OS X
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2021-03-31 23:30 UTC by samba
Modified: 2021-09-09 16:36 UTC (History)
1 user (show)

See Also:

build log (38.10 KB, application/x-bzip2)
2021-03-31 23:30 UTC, samba
no flags Details
Patch (746 bytes, patch)
2021-04-01 05:58 UTC, Volker Lendecke
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description samba 2021-03-31 23:30:37 UTC
Created attachment 16577 [details]
build log

Hi, I'm a developer with MacPorts trying to update our samba4 port to 4.14.2. It doesn't build for me on macOS 10.13.6 with Xcode 9.4.1. If I put "-Werror=implicit-function-declaration" in CFLAGS then the error is:

../../lib/util/charset/charset_macosxfs.c:278:4: error: implicit declaration of function 'DEBUG' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                        debug_out("String conversion: "
../../lib/util/charset/charset_macosxfs.c:140:22: note: expanded from macro 'debug_out'
#define debug_out(s)    DEBUG(0,(s))

Treating implicit declaration of functions as an error is the default behavior in Xcode 12 and later so I add "-Werror=implicit-function-declaration" to CFLAGS to simulate that. If I don't do that, then it proceeds past that problem with just a warning but fails at the link stage with:

Undefined symbols for architecture x86_64:
  "_DEBUG", referenced from:
      _macosxfs_encoding_pull in charset_macosxfs.c.1.o
      _macosxfs_encoding_push in charset_macosxfs.c.1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Reverting https://gitlab.com/samba-team/samba/-/commit/1701041d532bb6684c33e89420273631c063a2fa lets the build get further.
Comment 1 Volker Lendecke 2021-04-01 05:58:28 UTC
Created attachment 16579 [details]

Can you try this patch?
Comment 2 samba 2021-04-02 00:14:06 UTC
Yes, thanks, I think that patch is sufficient. It gets me to the same place as reverting commit 1701041 (as described in bug #14681).
Comment 3 Akihiro Suda 2021-09-04 18:19:49 UTC
(In reply to Volker Lendecke from comment #1)

Thank you for creating the patch.
Could you submit the patch to the upstream?

This patch is critical for installing Samba to macOS.
Comment 4 Akihiro Suda 2021-09-09 16:36:21 UTC
The patch seems submitted to the upstream by Alexander Richardson (thank you!)