Problem linking Samba 3.3.1 shared library bin/libnetapi.so.0

John Center john.center at villanova.edu
Thu Mar 5 15:56:04 GMT 2009


Hi,

I did some additional testing & found that the "-z text" flag, which 
enforces relocatable objects are being built from position-independent 
code, is preventing me from linking libnetapi.so.  If I leave out 
ldb_modules.o from libnetapi.so, it links without a problem.  If I 
remove "-z text" from the LDFLAGS, I can link in ldb_modules.o. 
Something about ldb_modules.c is generating position-dependent code, 
even though the -xcode=pic32 is set.  Unfortunately, I don't know enough 
about programming in general & Samba in particular, to determine why 
this is the case.  Maybe someone might want to look at this?  For now, 
I'll just remove the flag & plow ahead...  :-)

HTH

	-John


John Center wrote:
> Hi,
> 
> I'm trying to build Samba 3.3.1 on Solaris 10 with Sun Studio 12 & keep
> getting the following error:
> 
> creating /opt/ws/dists/Services/samba-3.3.1/source/exports/libnetapi.syms
> Linking shared library bin/libnetapi.so.0
> Text relocation remains                         referenced
>      against symbol                  offset      in file
> <unknown>                           0x0         lib/ldb/common/ldb_modules.o
> ld: fatal: relocations remain against allocatable but non-writable sections
> gmake: *** [bin/libnetapi.so.0] Error 1
> 
> I take this to mean that either -KPIC or -xcode=pic32 is missing from
> CFLAGS.  That isn't the case, here are the flags I'm building with:
> 
> Compiling lib/ldb/common/ldb_modules.c
> cc -xc99 -I. -I/opt/ws/dists/Services/samba-3.3.1/source
> -I/opt/heimdal/include -I/opt/openssl/include -g -xs -xtarget=ultraT1
> -xarch=sparcvis2 -m64 -mt -xcode=pic32 -xmemalign=8s -xpagesize=default
> -g -D_SAMBA_BUILD_=3
> -I/opt/ws/dists/Services/samba-3.3.1/source/iniparser/src -Iinclude
> -I./include  -I. -I. -I./lib/replace -I./lib/talloc -I./lib/tdb/include
> -I./libaddns -I./librpc -DHAVE_CONFIG_H  -I/opt/heimdal/include
> -I/opt/openssl/include -I/opt/openssl/include -I/opt/openldap/include
> -I/opt/db/include -I/opt/gnu/include -I/opt/local/include
> -I/usr/sfw/include -D_LARGEFILE_SOURCE -D_REENTRANT
> -D_FILE_OFFSET_BITS=64 -Iinclude -I./include -I. -I. -I./lib/replace
> -I./lib/talloc -I./lib/tdb/include -I./libaddns -I./librpc -I./popt
> -DLDAP_DEPRECATED -DSUNOS5   -I/include
> -I/opt/ws/dists/Services/samba-3.3.1/source/lib -D_SAMBA_BUILD_=3 -KPIC
> -c lib/ldb/common/ldb_modules.c -o lib/ldb/common/ldb_modules.o
> 
> 
> Linking shared library bin/libnetapi.so.0
> cc -xc99 -I/opt/heimdal/include -I/opt/openssl/include -g -xs
> -xtarget=ultraT1 -xarch=sparcvis2 -m64 -mt -xcode=pic32 -xmemalign=8s
> -xpagesize=default -g -D_SAMBA_BUILD_=3 -G -I/opt/heimdal/include
> -I/opt/openssl/include -g -xs -xtarget=ultraT1 -xarch=sparcvis2 -m64 -mt
> -xcode=pic32 -xmemalign=8s -xpagesize=default -g -D_SAMBA_BUILD_=3
> -L/opt/heimdal/lib/sparcv9 -L/opt/db/lib/sparcv9 -R/opt/db/lib/sparcv9
> -L/opt/openssl/lib/sparcv9 -R/opt/openssl/lib/sparcv9
> -L/opt/openldap/lib/sparcv9 -R/opt/openldap/lib/sparcv9
> -L/opt/heimdal/lib/sparcv9 -R/opt/heimdal/lib/sparcv9
> -L/opt/gnu/lib/sparcv9 -R/opt/gnu/lib/sparcv9 -L/opt/local/lib/sparcv9
> -R/opt/local/lib/sparcv9 -L/usr/sfw/lib/sparcv9 -R/usr/sfw/lib/sparcv9
> -L/usr/lib/sparcv9 -R/usr/lib/sparcv9 -Wl,-ztext -lthread -L./bin  -o
> bin/libnetapi.so.0 lib/netapi/netapi.o lib/netapi/cm.o
> librpc/gen_ndr/ndr_libnetapi.o lib/netapi/libnetapi.o
> lib/netapi/joindomain.o lib/netapi/serverinfo.o lib/netapi/getdc.o
> lib/netapi/user.o lib/netapi/group.o lib/netapi/localgroup.o
> lib/netapi/samr.o lib/netapi/sid.o lib/netapi/share.o lib/netapi/file.o
> libnet/libnet_join.o libnet/libnet_keytab.o libnet/libnet_samsync.o
> libnet/libnet_samsync_ldif.o libnet/libnet_samsync_passdb.o
> libnet/libnet_samsync_display.o libnet/libnet_samsync_keytab.o
> libnet/libnet_dssync.o libnet/libnet_dssync_keytab.o
> librpc/gen_ndr/ndr_libnet_join.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 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 dynconfig.o
> param/loadparm.o param/params.o param/util.o lib/sharesec.o
> lib/ldap_debug_handler.o lib/replace/replace.o lib/replace/snprintf.o
> lib/replace/getpass.o lib/replace/strptime.o lib/replace/timegm.o
> lib/replace/getifaddrs.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 libsmb/namequery_dc.o libsmb/trustdom_cache.o
> libsmb/trusts_util.o libsmb/dsgetdcname.o libads/ldap.o
> libads/ldap_printer.o libads/sasl.o libads/sasl_wrapping.o
> libads/krb5_setpw.o libads/ldap_user.o libads/ads_struct.o
> libads/kerberos_keytab.o libads/disp_sec.o libads/ads_utils.o
> libads/ldap_utils.o libads/ldap_schema.o libads/util.olibads/ndr.o
> lib/privileges_basic.o auth/token_util.o \
> -ltalloc -ltdb -lwbclient -lsendfile -lresolv -ldb -lcrypto -lssl -lumem
> -lpthread -lnsl -lsocket -liconv \
> -lldap -llber  -L/opt/heimdal/lib/sparcv9 -L/opt/heimdal/lib/sparcv9
> -lgssapi -lheimntlm -lkrb5 -lhx509 -lcom_err -L/opt/openssl/lib/sparcv9
> -lcrypto -lasn1 -lwind -lroken -ldoor -lresolv -lnsl -lsocket -mt -ldb
> -lcurses -lcrypto -lssl -lumem -lpthread  \
> -h `basename bin/libnetapi.so.0`
> 
> Am I missing something, or is there a problem compiling with Sun Studio?
> 
> Any help would be greatly appreciated.
> 
> Thanks.
> 
>         -John
> 
> --
> John Center
> Villanova University


More information about the samba-technical mailing list