[Samba] Cross-compile and directory locations

Martin Herrman martin at herrman.nl
Tue Aug 9 13:27:05 MDT 2011


Yes:

# http://lists.samba.org/archive/samba/2005-November/113506.html
# http://samba.2283325.n4.nabble.com/Tough-question-errors-while-cross-compiling-to-MIPS-td2469448.html
export samba_cv_CC_NEGATIVE_ENUM_VALUES="yes"

./configure cannot execute a compiled binary for one of its tests
(because the binary is compiled for a different architecture - you're
cross-compiling).

I am crosscompiling for the EM7075, using the 'sourcery' toolchain.
For crosscompilation I have created the following script. I don't use
autogen.sh.

martin at martindesktop ~/EM7075 $ cat
compile_scripts/samba-3.5.10/compile_samba-3.5.10.sh
#!/bin/sh

# Set variables
export CFLAGS="-EL -O2"
export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc -O2"
export PATH=/opt/Sourcery_G++_Lite/bin:$PATH
export LDFLAGS=" -EL -s
-L/opt/Sourcery_G++_Lite/lib/gcc/mips-linux-gnu/4.3.3/el"
export STRIP="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-strip"
export LD="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-ld"

# Samba specific cross compile instructions for ./configure
# http://lists.samba.org/archive/samba/2005-November/113506.html
# http://samba.2283325.n4.nabble.com/Tough-question-errors-while-cross-compiling-to-MIPS-td2469448.html
export samba_cv_CC_NEGATIVE_ENUM_VALUES="yes"

# Cleanup previous compilations
rm -rf /home/martin/EM7075/result/samba-3.5.10
rm -rf /home/martin/EM7075/work/samba*

# Download source and configure, compile, install
cd /home/martin/EM7075/work
#wget http://samba.org/samba/ftp/stable/samba-3.5.10.tar.gz
cp /home/martin/EM7075/compile_scripts/samba-3.5.10/samba-3.5.10.tar.gz
/home/martin/EM7075/work
tar -zxvf samba-3.5.10.tar.gz
cd samba-3.5.10/source3
#./configure --prefix=/home/martin/EM7075/result/samba-3.5.10 \

./configure --prefix=/opt --host=i686-pc-linux-gnu
--target=mipsel-linux-gnu --build=mipsel-linux-gnu \
--enable-largefile --disable-swat --disable-cups --disable-fam
--disable-gnutls \
--without-ldap --without-ads --without-syslog --without-quotas --without-utmp \
--without-cluster-support --without-acl-support --with-included-popt \
--without-sqlite3 --enable-shared-libs --disable-external-libtalloc \
--disable-external-libtdb \
--with-included-iniparser  \
--disable-socket-wrapper --disable-nss-wrapper \
--disable-iprint --disable-pie --disable-relro \
--disable-dnssd --disable-avahi --disable-pthreadpool \
--disable-merged-build --disable-netapi --disable-dmalloc \
--without-fhs --without-profiling-data --without-readline --without-libaddns \
--without-dmapi --without-afs --without-fake-kaserver \
--without-vfs-afsacl --without-krb5 \
--without-dnsupdate --without-automount --with-cifsmount --with-cifsumount \
--without-cifsupcall --without-pam --without-pam_smbpass \
--without-sys-quotas \
--without-aio-support \
--without-sendfile-support --without-wbclient --without-winbind \
--without-pthreads \
--without-setproctitle --without-libtalloc --with-libtdb \
--without-libnetapi --with-libsmbclient --without-libsmbsharemodes
--without-libaddns \
--with-libiconv=/tmp
# --without-syslog-facility --with-ctdb=DIR --without-nisplug-home
--without-dce-dfs
cp /home/martin/EM7075/compile_scripts/samba-3.5.10/Makefile
/home/martin/EM7075/work/samba-3.5.10/source3/
make
make install
#--with-privatedir=/opt/etc/samba/private --with-rootsbindir=/opt/sbin
--with-lockdir=/opt/var/locks \
#--with-statedir=/opt/var/locks --with-cachedir=/opt/var/locks
--with-piddir=/opt/var/locks \
#--with-ncalrpcdir=/opt/var/ncalrpc --with-swatdir=/opt/var/www/swat
--with-configdir=/opt/etc/samba \
#--with-logfilebase=/opt/var/log/samba --with-modulesdir=/opt/lib
--with-pammodulesdir=/opt/lib/security \
#--with-mandir=/opt/share/man --with-localedir=/opt/share/locale
--with-codepagedir=/opt/lib/samba \

Also note that I have adapted the following lines in the Makefile to
get the locations right:

prefix=/opt
DESTDIR=/home/martin/EM7075/result/samba-3.5.10
BASEDIR= /opt

You must adapt it after running ./configure.

HTH,

Martin

2011/8/9 Gilles <gilles.ganault at free.fr>:
> On Tue, 09 Aug 2011 00:32:24 +0200, Gilles <gilles.ganault at free.fr>
> wrote:
>>I untarred the tarball. What parameters should I pass to autogen.sh
>>before calling configure so that cross-compiling works OK?
>
> I went ahead and used the following commands to run autogen.sh and
> configure:
> ===========
> /usr/src/samba-3.5.11/source3# CC=bfin-linux-uclibc-gcc
> CFLAGS="-I/usr/src/uClinux-dist-2010R1-RC5/linux-2.6.x/include"
> ./autogen.sh --build=i686-pc-linux --host=bfin-linux-uclibc
>
> ./autogen.sh: running script/mkversion.sh
> ./script/mkversion.sh: 'include/version.h' created for Samba("3.5.11")
> ./autogen.sh: running autoheader -Im4 -I../m4 -I../lib/replace
> -I../source4
> samba4.m4:6: warning: file `../m4/check_python.m4' included several
> times
> samba4.m4:83: warning: file `../lib/tdb/libtdb.m4' included several
> times
> ../source4/build/m4/public.m4:70: SMB_EXT_LIB_FROM_PKGCONFIG is
> expanded from...
> samba4.m4:83: the top level
> ../lib/tevent/samba.m4:3: warning: file `../lib/tevent/libtevent.m4'
> included several times
> ../lib/tevent/samba.m4:3: the top level
> ./autogen.sh: running autoconf -Im4 -I../m4 -I../lib/replace
> -I../source4
> samba4.m4:6: warning: file `../m4/check_python.m4' included several
> times
> samba4.m4:83: warning: file `../lib/tdb/libtdb.m4' included several
> times
> ../source4/build/m4/public.m4:70: SMB_EXT_LIB_FROM_PKGCONFIG is
> expanded from...
> samba4.m4:83: the top level
> ../lib/tevent/samba.m4:3: warning: file `../lib/tevent/libtevent.m4'
> included several times
> ../lib/tevent/samba.m4:3: the top level
> Now run ./configure (or ./configure.developer) and then make.
> ===========
> /usr/src/samba-3.5.11/source3# CC=bfin-linux-uclibc-gcc
> CFLAGS="-I/usr/src/uClinux-dist-2010R1-RC5/linux-2.6.x/include
> -I./include" ./configure --build=i686-pc-linux
> --host=bfin-linux-uclibc
>
> ...
>
> checking that the C compiler understands negative enum values...
> configure: error: in `/usr/src/samba-3.5.11/source3':
> configure: error: cannot run test program while cross compiling
> See `config.log' for more details
> ===========
>
> Any idea what is causing "configure" to fail?
>
> Thank you.
>
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
>


More information about the samba mailing list