Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Samba] Cross-compile and directory locations

177 views
Skip to first unread message

Martin Herrman

unread,
Aug 4, 2011, 4:10:01 PM8/4/11
to
All,

I have cross-compiled 3.5.10 succesfully. The smbd binary can be executed,
e.g. ./smbd -b works fine. The smbd binary also allows me to override
directory locations, e.g. --libdir=/opt/lib. Unfortunately, other binaries
(like smbpasswd) cannot find their libraries because they are looking in the
wrong directory (/home/martin/result/.../lib), which only exist on the host
on which I compiled the source.

When I use e.g. --with-privatedir=/opt/var/samba/private during ./configure,
the binary is ok, but 'make install' fails. 'make install' wants to create
/opt/var/samba/private on the host, instead of using the prefix as well
(e.g. /home/martin/result/opt/var/samba/private).

Is there any already available solution to this?

Thanks in advance,

Martin
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba

Martin Herrman

unread,
Aug 4, 2011, 4:40:02 PM8/4/11
to
Oops! I apologize for posting in HTML..

maybe I found the answer:

./configure --prefix=/home/martin/result/
--exec-prefix=/home/martin/result/ --sbindir=/sbin
--with-rootsbindir=/opt/sbin

does the job? (sbindir defines the install directory, rootsbindir
defines the location where the binaries will search)

Trying this tomorrow..

2011/8/4 Martin Herrman <mar...@herrman.nl>

Gilles

unread,
Aug 8, 2011, 6:40:02 PM8/8/11
to
On Thu, 4 Aug 2011 22:33:14 +0200, Martin Herrman <mar...@herrman.nl>
wrote:

>maybe I found the answer:
>
>./configure --prefix=/home/martin/result/
>--exec-prefix=/home/martin/result/ --sbindir=/sbin
>--with-rootsbindir=/opt/sbin
>
>does the job? (sbindir defines the install directory, rootsbindir
>defines the location where the binaries will search)

I'm also interested in tips about cross-compiling Samba (3, for a
non-MMU CPU).

I untarred the tarball. What parameters should I pass to autogen.sh
before calling configure so that cross-compiling works OK?

Thank you.

Gilles

unread,
Aug 9, 2011, 6:10:02 AM8/9/11
to
On Tue, 09 Aug 2011 00:32:24 +0200, Gilles <gilles....@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?

Martin Herrman

unread,
Aug 9, 2011, 3:30:02 PM8/9/11
to
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@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....@free.fr>:

0 new messages