CodeSourceryCompiler + sqlite3autoconfig

Alex
Hello!

I need to compile sqlite3 for ARM arch. and then compile .cpp linking the
library.
I am using arm-none-linux-gnueabi from CodeSourcery IA32 GNU/Linux TAR file
on 32x Ubuntu. 
After setting command ./configure --host=arm-none-linux-gnueabi
--target=arm-none-linux-gnueabi --prefix="PATH" and executing make and make
install I get libsqlite3.so.0.8.6 dynamically linked library and 'file'
command shows it's based on Interl arch. 

If anybody had experience or knows the decision, post a message!

davef
--prefix=="PATH"

What does "PATH" mean?  And where do set the PATH?

Are you typing these commands or running a script?

davef
oops --prefix="PATH", do you mean =/path/to/the/cross-compiler/bin

Juergen Beisert
You should tell configure you want to cross compile:

--host=arm-none-linux-gnueabi --build=i686-host-linux-gnu

replace "i686-host-linux-gnu" with the string of your development host. Do
not forget to add the cross compiler path to your $PATH variable.

alexsvk
Juergen,

I understand that 'host' is a machine on which code must be compiled and
'target' is a machine for which code must be compiled. In 'build' there is
set a type of a machine the package will run on. If 'host' is set then it
declares that compiler will be built for different type of machine than
it's used on at the moment. But what does 'target' stand for then?
after execution of 'uname -a' there is 
Linux razvoj-linux-virtual 2.6.32-38-generic #83-Ubuntu SMP Wed Jan 4
11:13:04 UTC 2012 i686 GNU/Linux on the screen. 
As I understand, I should set --built==i686-razvoj-linux-virtual-linux-gnu
?

alexsvk
I set 
./configure --host=arm-none-linux-gnueabi --build=i686-spica-linux-gnu
--prefix='PATH_TO_DIR'
But file command on library still shows Intel arch.
When ./configure started, there are lines copied here below, there is
checking on arm-none-linux-gnueabi-gcc with 'no', that should be a mistake.
I set PATH variable and checked compiler on workability.


checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for arm-none-linux-gnueabi-strip... no
checking for strip... strip
configure: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet.  If you think this
configuration is useful to you, please write to autoconf@gnu.org.
checking for style of include used by make... GNU
checking for arm-none-linux-gnueabi-gcc... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for arm-none-linux-gnueabi-gcc... gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking for arm-none-linux-gnueabi-ranlib... no
checking for ranlib... ranlib
checking build system type... i686-spica-linux-gnu
checking host system type... arm-none-linux-gnueabi
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... nm
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for arm-none-linux-gnueabi-g++... no
checking for arm-none-linux-gnueabi-c++... no
checking for arm-none-linux-gnueabi-gpp... no
checking for arm-none-linux-gnueabi-aCC... no
checking for arm-none-linux-gnueabi-CC... no
checking for arm-none-linux-gnueabi-cxx... no
checking for arm-none-linux-gnueabi-cc++... no
checking for arm-none-linux-gnueabi-cl.exe... no
checking for arm-none-linux-gnueabi-FCC... no
checking for arm-none-linux-gnueabi-KCC... no
checking for arm-none-linux-gnueabi-RCC... no
checking for arm-none-linux-gnueabi-xlC_r... no
checking for arm-none-linux-gnueabi-xlC... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for arm-none-linux-gnueabi-g77... no
checking for arm-none-linux-gnueabi-xlf... no
checking for arm-none-linux-gnueabi-f77... no
checking for arm-none-linux-gnueabi-frt... no
checking for arm-none-linux-gnueabi-pgf77... no
checking for arm-none-linux-gnueabi-cf77... no
checking for arm-none-linux-gnueabi-fort77... no
checking for arm-none-linux-gnueabi-fl32... no
checking for arm-none-linux-gnueabi-af77... no
checking for arm-none-linux-gnueabi-xlf90... no
checking for arm-none-linux-gnueabi-f90... no
checking for arm-none-linux-gnueabi-pgf90... no
checking for arm-none-linux-gnueabi-pghpf... no
checking for arm-none-linux-gnueabi-epcf90... no
checking for arm-none-linux-gnueabi-gfortran... no
checking for arm-none-linux-gnueabi-g95... no
checking for arm-none-linux-gnueabi-xlf95... no
checking for arm-none-linux-gnueabi-f95... no
checking for arm-none-linux-gnueabi-fort... no
checking for arm-none-linux-gnueabi-ifort... no
checking for arm-none-linux-gnueabi-ifc... no
checking for arm-none-linux-gnueabi-efc... no
checking for arm-none-linux-gnueabi-pgf95... no
checking for arm-none-linux-gnueabi-lf95... no
checking for arm-none-linux-gnueabi-ftn... no
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse nm output from gcc object... ok
checking for objdir... .libs
checking for arm-none-linux-gnueabi-ar... no
checking for ar... ar
checking for arm-none-linux-gnueabi-ranlib... ranlib
checking for arm-none-linux-gnueabi-strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries...
yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries...
yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries...
yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for fdatasync... yes
checking for usleep... yes
checking for fullfsync... no
checking for localtime_r... yes
checking for gmtime_r... yes
checking for library containing tgetent... -lcurses
checking for library containing readline... no
checking for readline... no
checking for library containing pthread_create... -lpthread
checking for library containing dlopen... -ldl
checking for whether to support dynamic extensions... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sqlite3.pc
config.status: executing depfiles commands

Juergen Beisert
'configure' cannot find your cross-compiler, that's all:

[...]
checking for arm-none-linux-gnueabi-strip... no
[...]
checking for arm-none-linux-gnueabi-gcc... no
[...]

And due to this it falls back to native compile:
[...]
checking for gcc... gcc
[...]

Let 'configure' find your compiler and it will do the correct things.

alexsvk
When I ask 
which arm-none-linux-gnueabi-g++ or arm-none-linux-gnueabi-gcc
it shows a right path and I compiled a programm on it.
But what is the reason that configure cannot find it?

Juergen Beisert
Here it looks different. Please compare with your run:

[jb@isonoe]> tar xf sqlite-3.6.11.tar.gz
[jb@isonoe]> cd sqlite-3.6.11
[jb@isonoe]> export PATH=$PATH:/opt/FriendlyARM/toolschain/4.4.3/bin
[jb@isonoe]> which arm-none-linux-gnueabi-gcc
/opt/FriendlyARM/toolschain/4.4.3/bin/arm-none-linux-gnueabi-gcc
[jb@isonoe]> ./configure -host=arm-none-linux-gnueabi
--build=i686-host-linux-gnu --prefix=/usr
checking build system type... i686-host-linux-gnu
checking host system type... arm-none-linux-gnueabi
checking for arm-none-linux-gnueabi-gcc... arm-none-linux-gnueabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-none-linux-gnueabi-gcc accepts -g... yes
checking for arm-none-linux-gnueabi-gcc option to accept ISO C89... none
needed
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by arm-none-linux-gnueabi-gcc...
/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld
checking if the linker
(/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld) is GNU
ld... yes
checking for BSD- or MS-compatible name lister (nm)...
/opt/FriendlyARM/toolschain/4.4.3/bin/arm-none-linux-gnueabi-nm -B
checking the name lister
(/opt/FriendlyARM/toolschain/4.4.3/bin/arm-none-linux-gnueabi-nm -B)
interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for
/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld option to
reload object files... -r
checking for arm-none-linux-gnueabi-objdump...
arm-none-linux-gnueabi-objdump
checking how to recognize dependent libraries... pass_all
checking for arm-none-linux-gnueabi-ar... arm-none-linux-gnueabi-ar
checking for arm-none-linux-gnueabi-strip... arm-none-linux-gnueabi-strip
checking for arm-none-linux-gnueabi-ranlib... arm-none-linux-gnueabi-ranlib
checking command to parse
/opt/FriendlyARM/toolschain/4.4.3/bin/arm-none-linux-gnueabi-nm -B output
from arm-none-linux-gnueabi-gcc object... ok
checking how to run the C preprocessor... arm-none-linux-gnueabi-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if arm-none-linux-gnueabi-gcc supports -fno-rtti
-fno-exceptions... no
checking for arm-none-linux-gnueabi-gcc option to produce PIC... -fPIC
-DPIC
checking if arm-none-linux-gnueabi-gcc PIC flag -fPIC -DPIC works... yes
checking if arm-none-linux-gnueabi-gcc static flag -static works... yes
checking if arm-none-linux-gnueabi-gcc supports -c -o file.o... yes
checking if arm-none-linux-gnueabi-gcc supports -c -o file.o... (cached)
yes
checking whether the arm-none-linux-gnueabi-gcc linker
(/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi/bin/ld) supports
shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for intptr_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uintptr_t... yes
checking for sys/types.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for stdint.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for usleep... yes
checking for fdatasync... yes
checking for localtime_r... yes
checking for gmtime_r... yes
checking for localtime_s... no
checking for tclsh8.4... no
checking for tclsh... tclsh
configure: Version set to 3.6
configure: Release set to 3.6.11
configure: Version number set to 3006011
checking for gcc... gcc
checking whether to support threadsafe operation... yes
checking for library containing pthread_create... -lpthread
checking whether to allow connections to be shared across threads... no
checking whether threads can override each others locks... no
checking whether to support shared library linked as release mode or not...
no
checking whether to use an in-ram database for temporary tables... no
checking if executables have the .exe suffix... unknown
checking host system type... (cached) arm-none-linux-gnueabi
checking for Tcl configuration... found /usr/lib/tclConfig.sh
checking for existence of /usr/lib/tclConfig.sh... loading
checking for library containing tgetent... no
checking for readline in -lreadline... no
checking readline.h usability... no
checking readline.h presence... no
checking for readline.h... no
checking for library containing fdatasync... none required
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sqlite3.pc
config.status: creating config.h
config.status: executing libtool commands

Happy hacking

alexsvk
I just downloaded earlier version of sqlite (3.3.6) and it worked. 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for arm-none-linux-gnueabi-strip... arm-none-linux-gnueabi-strip
checking for style of include used by make... GNU
checking for arm-none-linux-gnueabi-gcc... arm-none-linux-gnueabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-none-linux-gnueabi-gcc accepts -g... yes
checking for arm-none-linux-gnueabi-gcc option to accept ISO C89... none
needed
checking dependency style of arm-none-linux-gnueabi-gcc... gcc3
But after make command I get the next output

if /bin/sh ./libtool --tag=CC --mode=compile arm-none-linux-gnueabi-gcc
-DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\"
-DPACKAGE_VERSION=\"3.6.11\" -DPACKAGE_STRING=\"sqlite\ 3.6.11\"
-DPACKAGE_BUGREPORT=\"http://www.sqlite.org\"; -DPACKAGE=\"sqlite\"
-DVERSION=\"3.6.11\" -D_FILE_OFFSET_BITS=64 -DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1
-DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -I. -I.   
-DSQLITE_THREADSAFE=1  -g -O2 -MT sqlite3.lo -MD -MP -MF
".deps/sqlite3.Tpo" -c -o sqlite3.lo sqlite3.c; \
  then mv -f ".deps/sqlite3.Tpo" ".deps/sqlite3.Plo"; else rm -f
".deps/sqlite3.Tpo"; exit 1; fi
mkdir .libs
 arm-none-linux-gnueabi-gcc -DPACKAGE_NAME=\"sqlite\"
-DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.6.11\"
"-DPACKAGE_STRING=\"sqlite 3.6.11\""
-DPACKAGE_BUGREPORT=\"http://www.sqlite.org\"; -DPACKAGE=\"sqlite\"
-DVERSION=\"3.6.11\" -D_FILE_OFFSET_BITS=64 -DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FDATASYNC=1
-DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -I. -I.
-DSQLITE_THREADSAFE=1 -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo
-c sqlite3.c  -fPIC -DPIC -o .libs/sqlite3.o
./libtool: line 1311: arm-none-linux-gnueabi-gcc: command not found
make: *** [sqlite3.lo] Error 1

It was not able to find compilator. Show me your make output if this is
possible.

Juergen Beisert
[jb@isonoe]> cd sqlite-3.6.11
[jb@isonoe]> export PATH=$PATH:/opt/FriendlyARM/toolschain/4.4.3/bin
[jb@isonoe]> which arm-none-linux-gnueabi-gcc
/opt/FriendlyARM/toolschain/4.4.3/bin/arm-none-linux-gnueabi-gcc
[jb@isonoe]> make
[...]very long time later[...]
/bin/ld: cannot find -ltclstub8.5
collect2: ld returned 1 exit status
make: *** [libtclsqlite3.la] Fehler 1

After re-starting with:
[jb@isonoe]> make clean
[jb@isonoe]> ./configure -host=arm-none-linux-gnueabi
--build=i686-host-linux-gnu --prefix=/usr --disable-tcl
[jb@isonoe]> make
[...]very long time later[...]
[jb@isonoe] file .libs/libsqlite3.so.0.8.6
.libs/libsqlite3.so.0.8.6: ELF 32-bit LSB shared object, ARM, version 1
(SYSV), dynamically linked, not stripped

alexsvk
How can I build statically linked library?

Juergen Beisert
run "configure --help" for more options

alexsvk
It should start without sudo prepended command before configuration as well
as before make and make install. 
./libtool has PATH modifications in its script.
I suppose that this is the reason why I could not perfrom make command.
For static librarie it's used --enable-static=yes(by default also) and
--enable-shared=no.

configure --help :)