Bug 6105 - build fails with --as-needed
build fails with --as-needed
Status: RESOLVED FIXED
Product: Samba 3.3
Classification: Unclassified
Component: Build environment
3.3.0
Other Linux
: P3 normal
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-12 07:43 UTC by pva
Modified: 2009-09-08 02:35 UTC (History)
3 users (show)

See Also:
bjacke: review+
gd: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pva 2009-02-12 07:43:35 UTC
During build I've got the following error:
Linking bin/cifs.upcall
lib/system.o: In function `sys_aio_suspend':
system.c:(.text+0x1ae): undefined reference to `aio_suspend64'
lib/system.o: In function `sys_aio_fsync':
system.c:(.text+0x1d8): undefined reference to `aio_fsync64'
lib/system.o: In function `sys_aio_error':
system.c:(.text+0x1fb): undefined reference to `aio_error64'
lib/system.o: In function `sys_aio_cancel':
system.c:(.text+0x225): undefined reference to `aio_cancel64'
lib/system.o: In function `sys_aio_return':
system.c:(.text+0x248): undefined reference to `aio_return64'
lib/system.o: In function `sys_aio_write':
system.c:(.text+0x26b): undefined reference to `aio_write64'
lib/system.o: In function `sys_aio_read':
system.c:(.text+0x28e): undefined reference to `aio_read64'
lib/system.o: In function `set_process_capability':
system.c:(.text+0xc70): undefined reference to `cap_get_proc'
system.c:(.text+0xd29): undefined reference to `cap_free'
system.c:(.text+0xda3): undefined reference to `cap_free'
system.c:(.text+0xdb2): undefined reference to `cap_free'
system.c:(.text+0xdf7): undefined reference to `cap_set_flag'
system.c:(.text+0xe1b): undefined reference to `cap_set_flag'
system.c:(.text+0xe23): undefined reference to `cap_set_proc'
lib/access.o: In function `string_match':
access.c:(.text+0x83d): undefined reference to `yp_get_default_domain'
lib/util.o: In function `automount_lookup':
util.c:(.text+0x3b26): undefined reference to `yp_get_default_domain'
util.c:(.text+0x3b7d): undefined reference to `yperr_string'
util.c:(.text+0x3c2b): undefined reference to `yp_match'
util.c:(.text+0x3dc2): undefined reference to `yperr_string'

I've made make to output what it calls to build this object and here is the output:

============================================================================
Linking bin/cifs.upcall
i686-pc-linux-gnu-gcc  -O -D_SAMBA_BUILD_=3  -Iinclude -I./include  -I. -I. -I./lib/replace -I./lib/talloc -I./lib/tdb/include -I./libaddns -I./librpc -DHAVE_CONFIG_H  -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Iinclude -I./include -I. -I. -I./lib/replace -I./lib/talloc -I./lib/tdb/include -I./libaddns -I./librpc -I./popt -DLDAP_DEPRECATED   -I/usr/include -I/var/tmp/portage/net-fs/samba-3.3.0/work/samba-3.3.0/source/lib -D_SAMBA_BUILD_=3 -o bin/cifs.upcall client/cifs.upcall.o -Wl,--export-dynamic -pie -Wl,-z,relro -Wl,--as-needed,-O1,--hash-style=gnu,--sort-common -L./bin \
                -lkeyutils -lcrypt -lcap -lresolv -lresolv -lnsl -ldl -lrt libsmb/libsmb_cache.o libsmb/libsmb_compat.o libsmb/libsmb_context.o libsmb/libsmb_dir.o libsmb/libsmb_file.o libsmb/libsmb_misc.o libsmb/libsmb_path.o libsmb/libsmb_printjob.o libsmb/libsmb_server.o libsmb/libsmb_stat.o libsmb/libsmb_xattr.o libsmb/libsmb_setget.o dynconfig.o param/loadparm.o param/params.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o registry/reg_api.o registry/reg_dispatcher.o registry/reg_cachehook.o registry/regfio.o registry/reg_objects.o registry/reg_util.o lib/util_reg_api.o lib/util_nttoken.o registry/reg_backend_db.o registry/reg_init_basic.o registry/reg_backend_smbconf.o registry/reg_init_smbconf.o lib/smbconf/smbconf.o lib/smbconf/smbconf_util.o lib/smbconf/smbconf_reg.o lib/smbconf/smbconf_txt.o lib/smbconf/smbconf_init.o lib/privileges_basic.o lib/replace/replace.o lib/replace/snprintf.o lib/replace/getpass.o lib/socket_wrapper/socket_wrapper.o lib/nss_wrapper/nss_wrapper.o lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o lib/interfaces.o lib/rbtree.o lib/memcache.o lib/util_transfer_file.o lib/async_req.o lib/async_sock.o lib/util_tdb.o lib/dbwrap.o lib/dbwrap_tdb.o lib/dbwrap_ctdb.o lib/dbwrap_rbt.o  lib/version.o lib/charcnv.o lib/debug.o lib/fault.o lib/interface.o lib/md4.o lib/pidfile.o lib/signal.o lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o lib/ufc.o lib/genrand.o lib/username.o lib/util_pw.o lib/access.o lib/smbrun.o lib/bitmap.o lib/crc32.o lib/dprintf.o lib/xfile.o lib/wins_srv.o lib/util_reg.o lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o lib/util_unistr.o lib/util_file.o lib/data_blob.o lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o lib/substitute.o lib/fsusage.o lib/dbwrap_util.o lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o lib/adt_tree.o lib/gencache.o lib/module.o lib/events.o lib/ldap_escape.o lib/secdesc.o lib/util_seaccess.o lib/secace.o lib/secacl.o libads/krb5_errs.o lib/system_smbd.o lib/audit.o librpc/ndr/ndr_basic.o librpc/ndr/ndr.o librpc/ndr/ndr_misc.o librpc/gen_ndr/ndr_misc.o librpc/gen_ndr/ndr_security.o librpc/ndr/ndr_sec_helper.o librpc/ndr/ndr_string.o librpc/ndr/sid.o librpc/ndr/uuid.o lib/file_id.o lib/idmap_cache.o lib/dummysmbd.o lib/dummyroot.o libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o libsmb/clikrb5.o libsmb/clispnego.o libsmb/asn1.o libsmb/clirap.o libsmb/clierror.o libsmb/climessage.o libsmb/clireadwrite.o libsmb/clilist.o libsmb/cliprint.o libsmb/clitrans.o libsmb/clisecdesc.o libsmb/clidgram.o libsmb/clistr.o libsmb/cliquota.o libsmb/clifsinfo.o libsmb/clidfs.o libsmb/smberr.o libsmb/credentials.o libsmb/pwd_cache.o libsmb/clioplock.o libsmb/clirap2.o libsmb/smb_seal.o libsmb/async_smb.o libsmb/ntlm_check.o libsmb/ntlmssp.o libsmb/ntlmssp_sign.o libsmb/nterr.o libsmb/doserr.o libsmb/errormap.o libsmb/dcerpc_err.o libsmb/smbdes.o libsmb/smbencrypt.o libsmb/ntlmssp_parse.o rpc_parse/parse_prs.o rpc_parse/parse_misc.o rpc_parse/parse_sec.o passdb/secrets.o passdb/machine_sid.o libsmb/unexpected.o libsmb/namecache.o libsmb/nmblib.o libsmb/namequery.o libsmb/conncache.o libads/dns.o libcli/nbt/nbtname.o libcli/ndr_netlogon.o libcli/netlogon.o librpc/gen_ndr/ndr_nbt.o librpc/gen_ndr/ndr_svcctl.o libads/cldap.o librpc/ndr/ndr_drsuapi.o librpc/ndr/ndr_compression.o librpc/gen_ndr/ndr_drsuapi.o librpc/gen_ndr/ndr_drsblobs.o lib/compression/mszip.o libads/kerberos.o libads/ads_status.o rpc_client/cli_lsarpc.o rpc_client/cli_samr.o rpc_client/cli_netlogon.o rpc_client/cli_reg.o rpc_client/cli_pipe.o rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o rpc_client/cli_svcctl.o rpc_client/init_samr.o librpc/rpc/dcerpc.o librpc/rpc/binding.o librpc/gen_ndr/cli_lsa.o librpc/gen_ndr/cli_dfs.o librpc/gen_ndr/cli_echo.o librpc/gen_ndr/cli_srvsvc.o librpc/gen_ndr/cli_svcctl.o librpc/gen_ndr/cli_winreg.o librpc/gen_ndr/cli_initshutdown.o librpc/gen_ndr/cli_eventlog.o librpc/gen_ndr/cli_wkssvc.o librpc/gen_ndr/cli_netlogon.o librpc/gen_ndr/cli_samr.o librpc/gen_ndr/cli_dssetup.o librpc/gen_ndr/cli_ntsvcs.o librpc/gen_ndr/cli_epmapper.o librpc/gen_ndr/cli_drsuapi.o librpc/gen_ndr/ndr_wkssvc.o librpc/gen_ndr/ndr_samr.o librpc/gen_ndr/ndr_lsa.o librpc/gen_ndr/ndr_dfs.o librpc/gen_ndr/ndr_echo.o librpc/gen_ndr/ndr_winreg.o librpc/gen_ndr/ndr_initshutdown.o librpc/gen_ndr/ndr_srvsvc.o librpc/gen_ndr/ndr_eventlog.o librpc/gen_ndr/ndr_netlogon.o librpc/ndr/ndr_netlogon.o librpc/gen_ndr/ndr_dssetup.o librpc/gen_ndr/ndr_notify.o librpc/gen_ndr/ndr_xattr.o librpc/gen_ndr/ndr_epmapper.o librpc/gen_ndr/ndr_ntsvcs.o rpc_client/ndr.o rpc_parse/parse_rpc.o rpc_client/init_netlogon.o rpc_client/init_lsa.o rpc_client/init_srvsvc.o rpc_parse/parse_spoolss.o rpc_parse/parse_eventlog.o rpc_parse/parse_buffer.o rpc_parse/parse_ntsvcs.o rpc_parse/parse_svcctl.o passdb/pdb_get_set.o passdb/passdb.o passdb/pdb_interface.o passdb/util_wellknown.o passdb/util_builtin.o passdb/pdb_compat.o passdb/util_unixsids.o passdb/lookup_sid.o passdb/login_cache.o  passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_smbpasswd.o passdb/pdb_tdb.o lib/account_pol.o lib/privileges.o lib/util_nscd.o lib/winbind_util.o lib/smbldap.o lib/smbldap_util.o groupdb/mapping.o groupdb/mapping_tdb.o groupdb/mapping_ldb.o lib/ldb/common/ldb.o lib/ldb/common/ldb_ldif.o lib/ldb/common/ldb_parse.o lib/ldb/common/ldb_msg.o lib/ldb/common/ldb_utf8.o lib/ldb/common/ldb_debug.o lib/ldb/common/ldb_modules.o lib/ldb/common/ldb_dn.o lib/ldb/common/ldb_match.o lib/ldb/common/ldb_attributes.o lib/ldb/common/attrib_handlers.o lib/ldb/common/ldb_controls.o lib/ldb/common/qsort.o lib/ldb/ldb_tdb/ldb_tdb.o lib/ldb/ldb_tdb/ldb_pack.o lib/ldb/ldb_tdb/ldb_search.o lib/ldb/ldb_tdb/ldb_index.o lib/ldb/ldb_tdb/ldb_cache.o lib/ldb/ldb_tdb/ldb_tdb_wrap.o  lib/ldb/modules/operational.o lib/ldb/modules/rdn_name.o lib/ldb/modules/objectclass.o lib/ldb/modules/paged_results.o lib/ldb/modules/sort.o lib/ldb/modules/asq.o -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv -ldl \
                -lldap -llber  -lpopt -ltalloc -lwbclient \
                -ltdb
lib/system.o: In function `sys_aio_suspend':
system.c:(.text+0x1ae): undefined reference to `aio_suspend64'
lib/system.o: In function `sys_aio_fsync':
system.c:(.text+0x1d8): undefined reference to `aio_fsync64'
lib/system.o: In function `sys_aio_error':
[and so on...]
============================================================================
Comment 1 pva 2009-02-12 08:09:45 UTC
The following patch fixes the issue:
--- source/Makefile.in  2009-02-12 13:14:35 +0000
+++ source/Makefile.in  2009-02-12 14:03:46 +0000
@@ -1382,7 +1382,7 @@
 bin/cifs.upcall@EXEEXT@: $(BINARY_PREREQS) $(CIFS_UPCALL_OBJ) $(LIBSMBCLIENT_OBJ1) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(CIFS_UPCALL_OBJ) $(DYNEXP) $(LDFLAGS) \
-               -lkeyutils $(LIBS) $(LIBSMBCLIENT_OBJ1) $(KRB5LIBS) \
+               $(LIBSMBCLIENT_OBJ1) -lkeyutils $(LIBS) $(KRB5LIBS) \
                $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(WINBIND_LIBS) \
                $(LIBTDB_LIBS) $(NSCD_LIBS)
Comment 2 Björn Jacke 2009-05-14 13:35:59 UTC
I've never seen those linking errors for cifs.upcall on any Linux machine.

I also can't see how the order of options (which your proposed patch changes) could actually fix something. If this happend still with the latest 3.3 release, can you please post exactly which configure call you run, so that we might try with that?
Comment 3 pva 2009-05-14 15:44:44 UTC
(In reply to comment #2)
> I also can't see how the order of options (which your proposed patch changes)
> could actually fix something.

Please, take a loot at "Importance of linking order" in as-needed guide:
http://www.gentoo.org/proj/en/qa/asneeded.xml

> If this happend still with the latest 3.3
> release, can you please post exactly which configure call you run, so that we
> might try with that?

I have not tested 3.3, probably I'll do later. To reproduce this error you need to export LDFLAGS="-Wl,--as-needed" and configure so that bin/cifs.upcall be built.
Comment 4 Björn Jacke 2009-07-15 10:45:56 UTC
your and another fix is in master now:

2df4550aae1e326511fe4e7e0d2d98be3e578caf
5236b3699da2b5cc55d55310de76e4ab65a8bb46

Distritutors start using --as-needed whenever possible, so we should fix this also in 3.3 and 3.4. Above two fixes can be picked directly to 3.4.

The first one could or should go into 3.3.
Comment 5 Karolin Seeger 2009-07-18 01:16:04 UTC
Michael, could you review the patches, please?

Thanks!
Comment 6 Steffen Hau 2009-08-14 11:36:41 UTC
Hey guys,

would you please backport those as-needed fixes to the 3.2 tree as well? It fails to compile with the same issues.

Thanks a lot,
Steffen
Comment 7 Karolin Seeger 2009-08-17 03:46:49 UTC
(In reply to comment #6)
> Hey guys,
> 
> would you please backport those as-needed fixes to the 3.2 tree as well? It
> fails to compile with the same issues.
> 
> Thanks a lot,
> Steffen

I am sorry, but 3.2 has been turned into security fixes only mode.
But we could provide the patches at http://www.samba.org/samba/patches/
once they are reviewed...
Comment 8 Andreas Schneider 2009-08-26 05:43:35 UTC
5236b3699da2b5cc55d55310de76e4ab65a8bb46 and 2df4550aae1e326511fe4e7e0d2d98be3e578caf look both fine. I've proposed a patch to set the -as-needed flag by default in Samba if available.
Comment 9 Guenther Deschner 2009-09-02 17:44:59 UTC
Bjoern, is this something we still miss for 3.4.1 ?
Comment 10 Björn Jacke 2009-09-04 04:09:22 UTC
Looks like this is not yet in 3.4, yes. I think a review is still needed to get this in.
Comment 11 Guenther Deschner 2009-09-04 05:16:43 UTC
Yes, looks fine.
Comment 12 Guenther Deschner 2009-09-04 05:17:12 UTC
Karolin, please pick for 3.4.1
Comment 13 Karolin Seeger 2009-09-08 02:35:38 UTC
Pushed, patches will be included in 3.4.1.
Closing out bug report.

Thanks!