[Samba] compile on solaris 64bit, static winbind

Eric Boehm boehm at nortel.com
Thu Oct 8 06:26:22 MDT 2009


On Thu, Oct 08, 2009 at 07:13:40AM +0200, Dirk Jakobsmeier wrote:
>>>>> "Dirk" == Dirk Jakobsmeier <dirk.jakobsmeier at wige.com> writes:

    Dirk> Hello Eric, yes me again,

    >> because several CFLAGS where missing in Makefile like:
    >>
    >> bin/smbd: $(BINARY_PREREQS) $(SMBD_OBJ) bin/libtalloc.so
    >> bin/libtdb.so bin/libwbclient.so @echo Linking $@ @$(CC) -o $@
    >> $(SMBD_OBJ) $(LDFLAGS) $(LDAP_LIBS) \ $(KRB5LIBS) $(DYNEXP)
    >> $(PRINT_LIBS) $(AUTH_LIBS) \ $(ACL_LIBS) $(PASSDB_LIBS) $(LIBS)
    >> $(DNSSD_LIBS) >
    Dirk> $(AVAHI_LIBS)
    >> \ $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
    >> $(LIBWBCLIENT_LIBS) $(ZLIB_LIBS)
    >>
    >> No CFLAGS where set. So after adding them to every single line
    >> in Makefile i just added CFLAGS to LDFLAGS (they are used in
    >> every CC line). Then after copying libtalloc and libtdb
    >> manually to destination direcotry and trying smbstatus i got:
    >>
    >> ld.so.1: smbstatus: fatal: relocation error: R_AMD64_PC32: file
    >> /usr/local/samba/lib/libtalloc.so: symbol main: value
    >> 0x2800148234f does not fit
    >>
    >> This error is with all shared libraries i use when i compiled
    >> 64bit >
    Dirk> binaries.
    >> So I have to use static version of samba. Or do you have any
    >> tip how to work around this problem. The solaris 64bit
    >> installation has got both, 32bit and 64bit libraries. Perhaps
    >> this is the problem.


    Dirk> i've found the problem after concentrating me on the
    Dirk> relocation problem. I've found an article related on gcc and
    Dirk> solaris ld and shared libraries. The option -G (shared libs
    Dirk> using gcc) does not tell the solaris (/usr/ccs/bin/ld)
    Dirk> linker to use share libraries. I have to change this options
    Dirk> in the Makefile to -fPIC -shared and then samba compiles
    Dirk> using shared libs. So now i will go on with my tests and
    Dirk> will tell the list if everythink works.

    Dirk> Thank you for opening my mind to search for the problem with
    Dirk> the shared libraries.

Another hint I can give you when you are building a 64 bit Samba is to
specify the necessary CFLAGS, LDFLAGS when  you run configure.

Here's how I run configure when building with the gcc compiler.

I create a small shell script called 'myconfigure'

cat myconfigure
CC='gcc' CXX=g++ \
CPPFLAGS='-D__EXTENSIONS__ -I/usr/local/include -I/usr/local/openldap/include -I/usr/local/sasl/include -I/usr/local/kerberos/include -I/usr/local/BerkeleyDB/include -I/usr/local/openssl/include' \
CFLAGS='-g -m64' \
LDFLAGS='-L/opt/corp/local/samba/lib -R/opt/corp/local/samba/lib -R\$$ORIGIN/../lib' \
../source/configure \
--prefix=/opt/corp/local/samba \
--with-libiconv=/usr/local \
--with-readline=/usr/local \
--with-ldap \
--with-krb5=/usr/local/kerberos \
--with-ads \
--with-automount \
--with-libsmbclient \
--with-acl-support \
--with-winbind 

You will obviously need to adapt this for your own environment, but I
think you get the idea. You can remove the -R\$$ORIGIN/../lib. I put
all the shared libraries I need in the samba lib directory. That's
there in case I want to run samba from another location.

If you are using the Sun Studio compiler, here's a slightly different
configuration of samba. The relevant changes are for CC and CFLAGS

CC='cc' CXX=CC \
CFLAGS='-g -xarch=v9a' \

CC='cc' CXX=CC \
CPPFLAGS='-D__EXTENSIONS__ -I/usr/local/include' \
CFLAGS='-g -xarch=v9a' \
LDFLAGS='-L/opt/corp/local/samba/lib -R/opt/corp/local/samba/lib -L/usr/local/lib/sparcv9 -R/usr/local/lib/sparcv9 -L/usr/local/lib -R/usr/local/lib' \
../source/configure \
--with-libiconv=/usr/local \
--with-readline=/usr/local \
--enable-debug \
--prefix=/opt/corp/local/samba

One important point is that you need to make sure that the -L and -R
switches are pointing to locations that have 64bit instead of 32bit
libraries.

Good luck.

-- 
Eric M. Boehm                  /"\  ASCII Ribbon Campaign
boehm at nortel.com               \ /  No HTML or RTF in mail
                                X   No proprietary word-processing
Respect Open Standards         / \  files in mail


More information about the samba mailing list