Bug 547153

Summary: Building krb5 with gcc-4.4.2-14 fails with multiple definition of `asn1buf_insert_octet'
Product: [Fedora] Fedora Reporter: Robert Scheck <redhat-bugzilla>
Component: krb5Assignee: Nalin Dahyabhai <nalin>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: jakub, nalin
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-12-14 14:41:14 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Robert Scheck 2009-12-13 14:40:48 EST
Description of problem:
--- snipp ---
+ gcc -std=gnu99 -shared -fPIC -Wl,-h,libkrb5.so.3,--no-undefined -o libkrb5.so.3.3 krb5_libinit.so error_tables/asn1_err.so error_tables/kdb5_err.so error_t
ables/krb5_err.so error_tables/kv5m_err.so error_tables/krb524_err.so asn.1/asn1_decode.so asn.1/asn1_k_decode.so asn.1/asn1_encode.so asn.1/asn1_get.so asn.
1/asn1_make.so asn.1/asn1buf.so asn.1/krb5_decode.so asn.1/krb5_encode.so asn.1/asn1_k_encode.so asn.1/ldap_key_seq.so asn.1/asn1_misc.so ccache/ccbase.so cc
ache/cccopy.so ccache/cccursor.so ccache/ccdefault.so ccache/ccdefops.so ccache/cc_retr.so ccache/cc_file.so ccache/cc_memory.so ccache/cc_keyring.so ccache/
ccfns.so ccache/ser_cc.so keytab/ktadd.so keytab/ktbase.so keytab/ktdefault.so keytab/ktfr_entry.so keytab/ktremove.so keytab/ktfns.so keytab/kt_any.so keyta
b/kt_file.so keytab/kt_memory.so keytab/kt_srvtab.so keytab/read_servi.so krb/addr_comp.so krb/addr_order.so krb/addr_srch.so krb/appdefault.so krb/auth_con.
so krb/bld_pr_ext.so krb/bld_princ.so krb/chk_trans.so krb/chpw.so krb/conv_creds.so krb/conv_princ.so krb/copy_addrs.so krb/copy_auth.so krb/copy_athctr.so
krb/copy_cksum.so krb/copy_creds.so krb/copy_data.so krb/copy_key.so krb/copy_princ.so krb/copy_tick.so krb/cp_key_cnt.so krb/decode_kdc.so krb/decrypt_tk.so
 krb/deltat.so krb/enc_helper.so krb/encode_kdc.so krb/encrypt_tk.so krb/fast.so krb/free_rtree.so krb/fwd_tgt.so krb/gc_frm_kdc.so krb/gc_via_tkt.so krb/gen
_seqnum.so krb/gen_subkey.so krb/get_creds.so krb/get_in_tkt.so krb/gic_keytab.so krb/gic_opt.so krb/gic_pwd.so krb/in_tkt_sky.so krb/init_ctx.so krb/init_ke
yblock.so krb/kdc_rep_dc.so krb/kerrs.so krb/kfree.so krb/mk_cred.so krb/mk_error.so krb/mk_priv.so krb/mk_rep.so krb/mk_req.so krb/mk_req_ext.so krb/mk_safe
.so krb/pac.so krb/parse.so krb/pr_to_salt.so krb/preauth.so krb/preauth2.so krb/princ_comp.so krb/rd_cred.so krb/rd_error.so krb/rd_priv.so krb/rd_rep.so kr
b/rd_req.so krb/rd_req_dec.so krb/rd_safe.so krb/recvauth.so krb/sendauth.so krb/send_tgs.so krb/ser_actx.so krb/ser_adata.so krb/ser_addr.so krb/ser_auth.so
 krb/ser_cksum.so krb/ser_ctx.so krb/ser_key.so krb/ser_princ.so krb/serialize.so krb/set_realm.so krb/srv_dec_tkt.so krb/srv_rcache.so krb/str_conv.so krb/t
gtname.so krb/unparse.so krb/valid_times.so krb/vfy_increds.so krb/vic_opt.so krb/walk_rtree.so rcache/rc_base.so rcache/rc_dfl.so rcache/rc_io.so rcache/rcd
ef.so rcache/rc_none.so rcache/rc_conv.so rcache/ser_rc.so rcache/rcfns.so unicode/ucdata.so unicode/ure.so unicode/urestubs.so unicode/ucstr.so os/accessor.
so os/an_to_ln.so os/c_ustime.so os/def_realm.so os/ccdefname.so os/changepw.so os/dnsglue.so os/dnssrv.so os/free_krbhs.so os/free_hstrl.so os/full_ipadr.so
 os/get_krbhst.so os/gen_port.so os/genaddrs.so os/gen_rname.so os/hostaddr.so os/hst_realm.so os/init_os_ctx.so os/krbfileio.so os/ktdefname.so os/kuserok.s
o os/mk_faddr.so os/localaddr.so os/locate_kdc.so os/lock_file.so os/net_read.so os/net_write.so os/osconfig.so os/port2ip.so os/prompter.so os/read_msg.so o
s/read_pwd.so os/realm_dom.so os/realm_iter.so os/sendto_kdc.so os/sn2princ.so os/thread_safe.so os/timeofday.so os/toffset.so os/unlck_file.so os/ustime.so
os/write_msg.so ../../util/profile/prof_tree.so ../../util/profile/prof_file.so ../../util/profile/prof_parse.so ../../util/profile/prof_get.so ../../util/pr
ofile/prof_set.so ../../util/profile/prof_err.so ../../util/profile/prof_init.so -L../../lib -lk5crypto -lcom_err -lkrb5support -lresolv -Wl,--version-script
 binutils.versions
asn.1/asn1_k_decode.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
asn.1/asn1_encode.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
asn.1/asn1_get.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
asn.1/asn1_make.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
asn.1/asn1buf.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.c:170: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
asn.1/krb5_decode.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
asn.1/krb5_encode.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
asn.1/asn1_k_encode.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
asn.1/ldap_key_seq.so: In function `asn1buf_insert_octet':
/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: multiple definition of `asn1buf_insert_octet'
asn.1/asn1_decode.so:/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5/asn.1/asn1buf.h:143: first defined here
collect2: ld returned 1 exit status
make[2]: *** [libkrb5.so.3.3] Error 1
make[2]: Leaving directory `/usr/src/rpm/BUILD/krb5-1.7/src/lib/krb5'
make[1]: *** [all-recurse] Error 1
make[1]: Leaving directory `/usr/src/rpm/BUILD/krb5-1.7/src/lib'
make: *** [all-recurse] Error 1
--- snapp ---

Version-Release number of selected component (if applicable):
krb5-1.7-13
gcc-4.4.2-7
gcc-4.4.2-14

How reproducible:
Everytime, see above and below.

Actual results:
The Fedora buildsystem currently seems to use gcc-4.4.2-7 to build krb5-1.7-13 
- at least when I use a local mockbuild. If I directly rebuild krb5-1.7-13 on
my local system (without mock), the build fails. I can't see a real difference 
except the gcc. But maybe I'm wrong, that's why I'm adding Jakub here.

If I edit krb5-1.7/src/lib/krb5/asn.1/asn1buf.h and replace the
  #if ((__GNUC__ >= 2) [...]
line by a simple
  #if 0
the package rebuild works as expected...

Expected results:
A working rebuild...
Comment 1 Robert Scheck 2009-12-13 15:04:52 EST
The file krb5-1.7/src/lib/krb5/asn.1/asn1buf.c contains:

#define ASN1BUF_OMIT_INLINE_FUNCS
#include "asn1buf.h"

And then, krb5-1.7/src/lib/krb5/asn.1/asn1buf.h contains:

#if ((__GNUC__ >= 2) && !defined(ASN1BUF_OMIT_INLINE_FUNCS)) && !defined(CONFIG_SMALL)

Why is it true? Shouldn't it be false, because of the definement?
Comment 2 Jakub Jelinek 2009-12-14 07:39:19 EST
Where does the -std=gnu99 come from?  I don't see it in krb5 src.rpm.
The function in question is extern inline and expects GNU inline semantics, so of course breaks when you request ISO C99 inline semantics.  You can either compile
with -std=gnu99 -fgnu89-inline, or add __attribute__((__gnu_inline__)) to the extern inlines that expect GNU inline semantics.
See http://gcc.gnu.org/gcc-4.3/porting_to.html for more details.
Comment 3 Robert Scheck 2009-12-14 14:41:14 EST
Jakub, you're my man; %__cc and %__gcc was defined with -std=gnu99. Thank you.