Samba/Compiling Samba from Source

Cross compile Samba

edit

If you want to compile Samba e.g. for an embedded system you need to cross compile Samba on your host PC.

After you have downloaded the Samba sources from Samba.org, unpack these sources and enter the samba-<version>/source/ directory. Then you need to set the CC environment:

# export LD_LIBRARY_PATH=/<path_to_compiler>/lib
# export LDFLAGS=-L/<path_to_compiler>/lib
# export CPPFLAGS=-I/<path_to_compiler>/include
# export CC=<path_to_compiler>/bin/<your_compiler>

as an example see the following for a mips compiler:

# export LD_LIBRARY_PATH=~/home/me/my_prj/linux/mips_compiler/lib
# export LDFLAGS=-L/~/home/me/my_prj/linux/mips_compiler/lib
# export CPPFLAGS=-I/~/home/me/my_prj/linux/mips_compiler/include
# export CC=~/home/me/my_prj/linux/mips_compiler/bin/mips-linux-uclib-gcc

Note: CPPFLAGS are not flags for a C++ compiler! CPPFLAGS means C-PreProcessor, thus CPPFLAGS are the options for the C-preprocessor.

Now entering the samba-<version>/source/ directory and run 'configure':

# ./configure --host=i686 --target=mips-linux-uclibc

After the configure script has ended, run make in samba-<version>/source/

# make