Bug 11750 - gcc6 fails to build internal heimdal (seen with 4.4.0rc3)
Summary: gcc6 fails to build internal heimdal (seen with 4.4.0rc3)
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-24 15:07 UTC by Guenther Deschner
Modified: 2021-01-19 10:18 UTC (History)
4 users (show)

See Also:


Attachments
patch from master branch (1.61 KB, patch)
2016-04-07 10:16 UTC, Douglas Bagnall
no flags Details
git-am fix for 4.4.next. (12.57 KB, patch)
2016-07-01 15:57 UTC, Jeremy Allison
abartlet: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guenther Deschner 2016-02-24 15:07:31 UTC
default/source4/heimdal/lib/roken/vis_3.o: In function `tolower':
/usr/include/ctype.h:216: multiple definition of `tolower'
default/source4/heimdal/lib/roken/hex_3.o:/usr/include/ctype.h:216: first defined here
default/source4/heimdal/lib/roken/vis_3.o: In function `toupper':
/usr/include/ctype.h:222: multiple definition of `toupper'
default/source4/heimdal/lib/roken/hex_3.o:/usr/include/ctype.h:222: first defined here
collect2: error: ld returned 1 exit status
default/source4/heimdal/lib/roken/vis_3.o: In function `tolower':
/usr/include/ctype.h:216: multiple definition of `tolower'
default/source4/heimdal/lib/roken/hex_3.o:/usr/include/ctype.h:216: first defined here
default/source4/heimdal/lib/roken/vis_3.o: In function `toupper':
/usr/include/ctype.h:222: multiple definition of `toupper'
default/source4/heimdal/lib/roken/hex_3.o:/usr/include/ctype.h:222: first defined here
default/source4/heimdal/lib/asn1/asn1parse_130.o: In function `tolower':
/usr/include/ctype.h:216: multiple definition of `tolower'
default/source4/heimdal/lib/roken/hex_3.o:/usr/include/ctype.h:216: first defined here
default/source4/heimdal/lib/asn1/asn1parse_130.o: In function `toupper':
/usr/include/ctype.h:222: multiple definition of `toupper'
default/source4/heimdal/lib/roken/hex_3.o:/usr/include/ctype.h:222: first defined here
default/source4/heimdal/lib/asn1/lex_130.o: In function `tolower':
/usr/include/ctype.h:216: multiple definition of `tolower'
default/source4/heimdal/lib/roken/hex_3.o:/usr/include/ctype.h:216: first defined here
default/source4/heimdal/lib/asn1/lex_130.o: In function `toupper':
/usr/include/ctype.h:222: multiple definition of `toupper'
default/source4/heimdal/lib/roken/hex_3.o:/usr/include/ctype.h:222: first defined here
collect2: error: ld returned 1 exit status
Waf: Leaving directory `/builddir/build/BUILD/samba-4.4.0rc3/bin'
Build failed:
 -> task failed (err #1): 
        {task: cc_link base64_3.o,ct_3.o,hex_3.o,bswap_3.o,dumpdata_3.o,emalloc_3.o,ecalloc_3.o,getarg_3.o,get_window_size_3.o,getdtablesize_3.o,h_errno_3.o,issuid_3.o,net_read_3.o,net_write_3.o,parse_time_3.o,parse_units_3.o,vis_3.o,strlwr_3.o,strsep_copy_3.o,strsep_3.o,strupr_3.o,strpool_3.o,estrdup_3.o,erealloc_3.o,simple_exec_3.o,strcollect_3.o,rtbl_3.o,rand_3.o,cloexec_3.o,xfree_3.o,replace_3.o,closefrom_3.o,print_version_128.o,version_128.o,parse_132.o,lex_132.o,compile_et_132.o,replace_1.o -> compile_et}
 -> task failed (err #1): 
        {task: cc_link base64_3.o,ct_3.o,hex_3.o,bswap_3.o,dumpdata_3.o,emalloc_3.o,ecalloc_3.o,getarg_3.o,get_window_size_3.o,getdtablesize_3.o,h_errno_3.o,issuid_3.o,net_read_3.o,net_write_3.o,parse_time_3.o,parse_units_3.o,vis_3.o,strlwr_3.o,strsep_copy_3.o,strsep_3.o,strupr_3.o,strpool_3.o,estrdup_3.o,erealloc_3.o,simple_exec_3.o,strcollect_3.o,rtbl_3.o,rand_3.o,cloexec_3.o,xfree_3.o,replace_3.o,closefrom_3.o,print_version_128.o,version_128.o,main_130.o,gen_130.o,gen_copy_130.o,gen_decode_130.o,gen_encode_130.o,gen_free_130.o,gen_glue_130.o,gen_length_130.o,gen_seq_130.o,gen_template_130.o,hash_130.o,symbol_130.o,asn1parse_130.o,lex_130.o,replace_1.o -> asn1_compile}
Makefile:8: recipe for target 'all' failed
Comment 1 Guenther Deschner 2016-02-24 15:08:36 UTC
Same bug in debian:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=812264
Comment 2 Roderich Schupp 2016-04-07 08:05:47 UTC
The Debian bug report has an explanation: the heimdal sources erroneously define
__attribute__ away. This has also caused other build problems, leading to
the 2 commits below:

https://git.samba.org/?p=samba.git;a=commitdiff;h=1dc05386f20481596ee7360d6f4e628a16675d3f
https://git.samba.org/?p=samba.git;a=commitdiff;h=1c796547f20fa3c7c2e93fd5ce6ee8453a2bb435
Comment 3 Douglas Bagnall 2016-04-07 10:16:50 UTC
Created attachment 11970 [details]
patch from master branch

This was fixed in the master branch with the attached patch.

I haven't yet tried it with 4.4, but it seems likely to apply.
Comment 4 Douglas Bagnall 2016-04-07 10:26:09 UTC
You may also want some of commits 88be24c27..78f8a89bd

Which replace tests like

#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )

mostly as a proxy check for __attribute__, and which fail with GCC 6.0.0 (as the pre-release builds are versioned). At least some of these caused build errors with -O3.
Comment 5 Mathieu Parent 2016-07-01 02:56:20 UTC
Can somebody take care of this bug in 4.4.x?

Thanks
Comment 6 Jeremy Allison 2016-07-01 15:57:37 UTC
Created attachment 12251 [details]
git-am fix for 4.4.next.

Here is the patchset I think we need - cherry pick from master with BUG: ref added to the commit comments.
Comment 7 Douglas Bagnall 2016-07-04 22:26:53 UTC
Comment on attachment 12251 [details]
git-am fix for 4.4.next.

The patch "git-am fix for 4.4.next" LGTM, though for released versions of GCC 6,
I think only the first patch is necessary (as below). 

The other patches fix things for GCC pre-releases which have a zero in the minor 
version. The first 6.x release was 6.1.


From 50cb2787bd6fb0bf8726a7cb3e4a58a44c708dab Mon Sep 17 00:00:00 2001
From: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Date: Tue, 8 Mar 2016 10:23:09 +1300
Subject: [PATCH 1/8] configure: set HAVE___ATTRIBUTE__ for heimdal

Without this, heimdal ends up defining __attribute__ away, causing
gcc-6 compile errors with -Werror=return-type because it can't tell
when functions have __attribute__((noreturn)).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11750

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar  9 13:52:26 CET 2016 on sn-devel-144

(cherry picked from commit 1c796547f20fa3c7c2e93fd5ce6ee8453a2bb435)
---
 buildtools/wafsamba/wscript | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 586cc4b..8802e5a 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -402,6 +402,22 @@ def configure(conf):
             addmain=False,
             msg='Checking for library destructor support')
 
+    conf.CHECK_CODE('''
+            void test_attribute(void) __attribute__ (());
+
+            void test_attribute(void)
+            {
+                return;
+            }
+
+            int main(void) {
+                return 0;
+            }
+            ''',
+            'HAVE___ATTRIBUTE__',
+            addmain=False,
+            msg='Checking for __attribute__')
+
     if sys.platform.startswith('aix'):
         conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True)
         # Might not be needed if ALL_SOURCE is defined
-- 
2.8.0.rc3.226.g39d4020
Comment 8 Andrew Bartlett 2016-07-30 01:50:03 UTC
Fixed in Samba 4.5.0rc1 with commits leading up to d64877541036c6b82aa0204671bfdae08936b529
Comment 9 Andrew Bartlett 2016-07-30 01:50:41 UTC
Assigning to kseeger for 4.4
Comment 10 Karolin Seeger 2016-08-02 07:26:07 UTC
Pushed to autobuild-v4-4-test.
Comment 11 Karolin Seeger 2016-08-05 07:35:02 UTC
(In reply to Karolin Seeger from comment #10)
Pushed to v4-4-test.
Closing out bug report.
Thanks!