[patchset] build fixes

Björn Jacke bjacke at samba.org
Fri Feb 15 23:20:47 UTC 2019


Hi,

this patchset contains several build fixes for non-mainstream systems,
which we completely lost since we moved to waf. Review and push
appreciated...

Thanks
Björn
-------------- next part --------------
From 32c9f16fd1799f032c70a680120e95cb484c25da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Sat, 9 Feb 2019 01:33:13 +0100
Subject: [PATCH 01/10] waf: fix WERROR_CFLAGS check

if we found the right WERROR flags of the compiler then the compiler is right
to fail because we explicitly give it an empty file to compile. We
should not do that because that makes the almost successful test fail.
This fixed the studio compiler test.

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 buildtools/wafsamba/wscript | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 86293d347a1c..75f24158600e 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -308,8 +308,7 @@ def configure(conf):
               "-qhalt=w",     # IBM xlc
               "-w2",           # Tru64
              ]:
-        if conf.CHECK_CFLAGS([f], '''
-'''):
+        if conf.CHECK_CFLAGS([f]):
             if not 'WERROR_CFLAGS' in conf.env:
                 conf.env['WERROR_CFLAGS'] = []
             conf.env['WERROR_CFLAGS'].extend([f])
-- 
2.17.1


From 9933fece7951a29f2ea2dfaa0286d5afc12577d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Sun, 10 Feb 2019 00:07:57 +0100
Subject: [PATCH 02/10] waf: fix compiler warnings in configure checks

the studio compiler issued here:

warning: statement not reached

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 buildtools/wafsamba/samba_conftests.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index 96345ca00c63..ef632ba90336 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -86,7 +86,7 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
     '''see what we need for largefile support'''
     getconf_cflags = conf.CHECK_COMMAND(['getconf', 'LFS_CFLAGS']);
     if getconf_cflags is not False:
-        if (conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+        if (conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
                             define='WORKING_GETCONF_LFS_CFLAGS',
                             execute=True,
                             cflags=getconf_cflags,
@@ -101,13 +101,13 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
                     else:
                         conf.DEFINE(flag_split[0], flag_split[1])
 
-    if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+    if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
                        define,
                        execute=True,
                        msg='Checking for large file support without additional flags'):
         return True
 
-    if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+    if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
                        define,
                        execute=True,
                        cflags='-D_FILE_OFFSET_BITS=64',
@@ -115,7 +115,7 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
         conf.DEFINE('_FILE_OFFSET_BITS', 64)
         return True
 
-    if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+    if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
                        define,
                        execute=True,
                        cflags='-D_LARGE_FILES',
-- 
2.17.1


From 7e298f58ccef3307a6cfefe62e52e28ef334bc71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Sun, 10 Feb 2019 00:44:14 +0100
Subject: [PATCH 03/10] waf: remove duplicate WERROR cflags

WERROR flags are already added by the strict=True switch.

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 buildtools/wafsamba/wscript | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 75f24158600e..82011a8da1bc 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -347,7 +347,7 @@ def configure(conf):
     else:
         conf.env.HAVE_LD_VERSION_SCRIPT = False
 
-    if conf.CHECK_CFLAGS(['-fvisibility=hidden'] + conf.env.WERROR_CFLAGS):
+    if conf.CHECK_CFLAGS(['-fvisibility=hidden']):
         conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden'
         conf.CHECK_CODE('''int main(void) { return 0; }
                            __attribute__((visibility("default"))) void vis_foo2(void) {}\n''',
-- 
2.17.1


From e5b127242ee311cc0363c6cda012a9d4e9256845 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Sun, 10 Feb 2019 00:47:59 +0100
Subject: [PATCH 04/10] waf: remove redundant WERROR flag

CHECK_CFLAGS always uses WERROR flags

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 buildtools/wafsamba/wscript | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 82011a8da1bc..4ed3ae16b1a5 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -449,7 +449,7 @@ def configure(conf):
     # See memset_s() details here:
     # https://en.cppreference.com/w/c/string/byte/memset
     #
-    if conf.CHECK_CFLAGS(['-D__STDC_WANT_LIB_EXT1__=1'] + conf.env.WERROR_CFLAGS):
+    if conf.CHECK_CFLAGS(['-D__STDC_WANT_LIB_EXT1__=1']):
         conf.ADD_CFLAGS('-D__STDC_WANT_LIB_EXT1__=1')
 
     # on Tru64 certain features are only available with _OSF_SOURCE set to 1
-- 
2.17.1


From 0856e1c01072b7fd4756a5d11c67259be4d7c068 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Sun, 10 Feb 2019 01:29:22 +0100
Subject: [PATCH 05/10] waf: use the correct WERROR_CFLAGS in CHECK_CODE

all the non gcc version were incorrectly set here till now

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 buildtools/wafsamba/samba_autoconf.py | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 9d45ada13121..7d975393c5b0 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -397,13 +397,8 @@ def CHECK_CODE(conf, code, define,
     # Be strict when relying on a compiler check
     # Some compilers (e.g. xlc) ignore non-supported features as warnings
     if strict:
-        extra_cflags = None
-        if conf.env["CC_NAME"] == "gcc":
-            extra_cflags = "-Werror"
-        elif conf.env["CC_NAME"] == "xlc":
-            extra_cflags = "-qhalt=w"
-        if extra_cflags:
-            cflags.append(extra_cflags)
+        if 'WERROR_CFLAGS' in conf.env:
+            cflags.extend(conf.env['WERROR_CFLAGS'])
 
     if local_include:
         cflags.append('-I%s' % conf.path.abspath())
-- 
2.17.1


From d199e752d1979e4e286d3a0036365c613c5a64df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Mon, 11 Feb 2019 10:03:00 +0100
Subject: [PATCH 06/10] waf: print the library name in which we search for a
 function

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 buildtools/wafsamba/samba_autoconf.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 7d975393c5b0..ee1fc231eb9a 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -251,7 +251,10 @@ def CHECK_FUNC(conf, f, link=True, lib=None, headers=None):
 
     ret = False
 
-    conf.COMPOUND_START('Checking for %s' % f)
+    in_lib_str = ""
+    if lib:
+        in_lib_str = " in %s" % lib
+    conf.COMPOUND_START('Checking for %s%s' % (f, in_lib_str))
 
     if link is None or link:
         ret = CHECK_CODE(conf,
-- 
2.17.1


From 4a02aef566d98ae104b497f503ddf9ed578d5c49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Mon, 11 Feb 2019 15:30:24 +0100
Subject: [PATCH 07/10] wafsamba: we should also remove stale symlinks here

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 buildtools/wafsamba/wafsamba.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 70ab736e2a78..1b98e1ceb2c6 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -740,7 +740,7 @@ def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
         link_dst = os.path.join(tgtdir, os.path.basename(iname))
         if os.path.islink(link_dst) and os.readlink(link_dst) == link_src:
             continue
-        if os.path.exists(link_dst):
+        if os.path.islink(link_dst):
             os.unlink(link_dst)
         Logs.info("symlink: %s -> %s/%s" % (s, installdir, iname))
         symlink(link_src, link_dst)
-- 
2.17.1


From 6b63d377ac1df59c52ff669480c4d9995bdad8e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Sun, 10 Feb 2019 03:41:50 +0100
Subject: [PATCH 08/10] waf: fix setting of RPATH_ST variable

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 buildtools/wafsamba/wscript | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 4ed3ae16b1a5..ab19859a83fe 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -315,7 +315,9 @@ def configure(conf):
             break
 
     # check which compiler/linker flags are needed for rpath support
-    if not conf.CHECK_LDFLAGS(['-Wl,-rpath,.']) and conf.CHECK_LDFLAGS(['-Wl,-R,.']):
+    if conf.CHECK_LDFLAGS(['-Wl,-rpath,.']):
+        conf.env['RPATH_ST'] = '-Wl,-rpath,%s'
+    elif conf.CHECK_LDFLAGS(['-Wl,-R,.']):
         conf.env['RPATH_ST'] = '-Wl,-R,%s'
 
     # check for rpath
-- 
2.17.1


From cac7bab63a40da62554b6d4fb7f31053697e5fb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Sun, 10 Feb 2019 02:02:06 +0100
Subject: [PATCH 09/10] third_party/nss_wrapper/wscript: fix check for
 gethostbyname

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 third_party/nss_wrapper/wscript | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/third_party/nss_wrapper/wscript b/third_party/nss_wrapper/wscript
index 2e9d1db13b10..fb9710636c42 100644
--- a/third_party/nss_wrapper/wscript
+++ b/third_party/nss_wrapper/wscript
@@ -32,8 +32,8 @@ def configure(conf):
         conf.CHECK_FUNCS('__posix_getpwnam_r __posix_getpwuid_r')
         conf.CHECK_FUNCS('__posix_getgrgid_r __posix_getgrnam_r')
 
-        conf.CHECK_FUNCS_IN('nsl',
-                            'gethostname',
+        conf.CHECK_FUNCS_IN('gethostname',
+                            'nsl',
                             checklibc=True,
                             headers='unistd.h')
 
-- 
2.17.1


From fdf49f5737580944c31ca95c9102e2f0e729e08d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= <bjacke at samba.org>
Date: Sun, 10 Feb 2019 22:38:49 +0100
Subject: [PATCH 10/10] waf: add library dependency for sendfile on Solaris

Signed-off-by: Bjoern Jacke <bjacke at samba.org>
---
 lib/smbconf/wscript_build | 2 +-
 source3/wscript           | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/smbconf/wscript_build b/lib/smbconf/wscript_build
index 9879624726b9..4f9930a1ae04 100644
--- a/lib/smbconf/wscript_build
+++ b/lib/smbconf/wscript_build
@@ -1,5 +1,5 @@
 bld.SAMBA_SUBSYSTEM('LIBSMBCONF',
                     source='smbconf.c smbconf_txt.c smbconf_util.c',
-                    deps='talloc'
+                    deps='talloc sendfile'
                     )
 
diff --git a/source3/wscript b/source3/wscript
index 7646a75fa6d9..424c0f285022 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -1252,6 +1252,8 @@ main() {
                     addmain=False,
                     execute=True)
 
+    conf.SET_TARGET_TYPE('sendfile', 'EMPTY')
+    conf.CHECK_LIB('sendfile')
     if not Options.options.with_sendfile_support == False:
         if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('k*bsd*-gnu') > -1) or (host_os.rfind('kopensolaris*-gnu') > -1):
             conf.CHECK_CODE('''
-- 
2.17.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20190216/2024398e/signature.sig>


More information about the samba-technical mailing list