SQLITE cross compilation

Sumeet
I am trying to cross compile sqlite for micro2440 SDK with processor
S3C2440. Cross compiling runs ok but while executing make command a error
occurs. Following is the command that I have entered for cross compiling:

./configure --host=arm-linux --prefix=/opt/sqlitedbms
--exec-prefix=/opt/sqlitedbms CFLAGS="-march=armv4t -mtune=arm920t -Os
-lpthread -lrt" LDFLAGS=${LDFLAGS}


The error that occurs after executing make file is as follows:

arm-none-linux-gnueabi-gcc: 3.7.0": No such file or directory
<command-line>: warning: missing terminating " character
make: *** [sqlite3.lo] Error 1

Can any one tell what exactly is going wrong.

Following is tar file that I am using
sqlite-amalgamation-3.7.0.tar

Should I extract the tar file to specific location

davef
Don't know about "exactly", but it appears to me that the compiler is not
found.

After you have EXPORTed the PATH to your compiler and you do:

arm-none-linux-gnueabi-gcc --version

What do you get?

Sumeet
After entering the command that you suggested I get the following output:


[root@plg sqlite-3.7.0]# arm-none-linux-gnueabi-gcc --version

arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2008q3-72) 4.3.2

Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

santosh
it seems u hv arm-none-linux-gnueabi-gcc of higher version what your sqlite
support..

Sumeet
I am not having any idea of my sqlite supports. 

For your info when I run ./configure script as follows:

./configure target=arm-linux

then the make file runs without any error. Also make install runs
successfully. But when I copy the respective installation files on board
the sqlite does not run.

davef
For Cherokee I had to:

--host=arm-linux \

I think it wasn't necessary or required to do:

--target=arm-linux \

If you are going to continue commands over more than one line is not a \
required?  (Continuation)

For example:

./configure --host=arm-linux --prefix=/opt/sqlitedbms \
--exec-prefix=/opt/sqlitedbms CFLAGS="-march=armv4t -mtune=arm920t -Os \
-lpthread -lrt" LDFLAGS=${LDFLAGS}

Sumeet
Hello Dave thanks for your reply. I dint understand your suggested
solution. Can you please elaborate

Sumeet
arm-none-linux-gnueabi-gcc: 3.7.0": No such file or directory
<command-line>: warning: missing terminating " character
make: *** [sqlite3.lo] Error 1


what could be the solution for this

davef
At the end of each line there is a \

Copy the three lines in my post and see if it works differently.

Here is another example:

./configure --localstatedir=/var \
            --prefix=/cherokee \
            --with-wwwroot=/var/www \
            --enable-static-module=all \
            --enable-shared=no \
            --enable-static \
            --disable-pam \
            --disable-ipv6 \
            --disable-tls \
            --disable-largefile \
            --build=i686-linux \
            --host=arm-linux \
            --target=arm-linux \

Sumeet
Hello Dave

Thanks for the elaboration. 
I executed the following script without execute-prefix But still same
error: 


./configure --host=arm-linux --prefix=/opt/sqlitedbms \
CFLAGS="-march=armv4t -mtune=arm920t -Os -lpthread -lrt"LDFLAGS=${LDFLAGS} 


arm-none-linux-gnueabi-gcc: 3.7.0": No such file or directory
<command-line>: warning: missing terminating " character
make: *** [sqlite3.lo] Error 1

Sumeet
Again I executed the script as you suggested in your post with following
script but the same error again:



./configure --host=arm-linux --prefix=/opt/sqlitedbms \
--exec-prefix=/opt/sqlitedbms CFLAGS="-march=armv4t -mtune=arm920t -Os \
-lpthread -lrt" LDFLAGS=${LDFLAGS}

arm-none-linux-gnueabi-gcc: 3.7.0": No such file or directory
<command-line>: warning: missing terminating " character
make: *** [sqlite3.lo] Error 1

davef
Try running:

./configure --help

and verify that it has all the switches that you are trying to use.

Also, put your export path to the compiler in print.

<arm-none-linux-gnueabi-gcc: 3.7.0>

I am not sure what this is actually trying to say, as santosh mentioned
above.  Seems an odd combination of your compiler and the version of
sqlite.

Sumeet
Hello davef

As you said I ran the script ./configure --help it has all the switches i.e
is host,prefix,exec-prefix,CFLAG. 

I am using this sqlite-amalgamation-3.7.0.tar. 

I am not having any idea of how to export path to the compiler in print.
Can you please tell me how to do it.

davef
Somewhere you have either put into your .profile OR bashrc file OR run a
script before you do any cross-compilation to tell the host machine where
your actual compiler is. You would have to copy and paste that line into
your next posting. Sorry, "print" was a confusing word to use.

Previously:
***
[root@plg sqlite-3.7.0]# arm-none-linux-gnueabi-gcc --version
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2008q3-72) 4.3.2
***
gave the right answer.

However, something isn't working properly and I am struggling to work out
what is wrong.   

An example:

export PATH=/home/user/mini2440-bootstrap/arm-2008q3/bin:$PATH

Maybe, if you tell us what you have done before this.

Sometimes, you have to put <sudo> in front of make commands.  I think it
depends on where you have placed your compiler.  If it is in /usr/local
then you might need to use <sudo>.

Sumeet
Yes Davef Previously I had set the path for compiler by editing the .bashrc
file and appended the line as export PATH=$PATH:/usr/local/arm/4.3.2/bin I
have done this before and the compiler path is also set.

Yes my compiler is placed in usr/local/arm......
And for your information I have extracted the tar file
sqlite-amalgamation-3.7.0.tar in usr directory. i.e after extracting it
resides in usr/sqlite-3.7.0.

So according to you I should use <sudo>. Can you just give me an example of
how to use <sudo> with make command in my case. And can you please tell me
what actually this <sudo> does.

davef
If you are doing all your compilation work while in the /usr directory AND
you have not set any login passwords THEN you do not need to use <sudo>.

I am assuming you are using Ubuntu, I think <su> is an alternative.

<sudo> http://en.wikipedia.org/wiki/Sudo

says it better than I could.  It allows users to access stuff in your root
directory with a password.  If you place all your arm linux stuff in your
Home directory then you do not need to use <sudo>.

What I have found is that some utility program like make or mkfs is in
/usr/local and I am working away in my Home directory then when you want to
run those programs you have to:

sudo mkfs.jffs2 . . . to get it to work.

If your compiler is in /usr/local/  and you didn't need to use <sudo> to
see what version it is, I guess you have not restricted users accessing
root.

Here is someone else having a similar problem:

http://blog.chinaunix.net/u3/104065/showart_2051697.html

Too bad I can't read Chinese.

davef
Have you read this posting?

http://www.friendlyarm.net/forum/topic/978

davef
Maybe a bit out of date:

http://www.crosscompile.org/static/pages/SQLite.html

Sumeet
I am using linux operating system that comes default with the micro2440 sdk
board. 

yes I had gone through this posting previously but it confused me a lot.
http://www.friendlyarm.net/forum/topic/978


For the link(http://blog.chinaunix.net/u3/104065/showart_2051697.html)
which you had provided which is in chinese, I will go through it and try to
make changes in my compilation. and let you know what happans.

davef
But, what are using for the host machine?

Sumeet
host machine is also linux

davef
Running which distro?

Have you managed to cross-compile any other applications before?

Sumeet
Fedora 9.0 from this link http://www.arm9down.cn/linux/fedora9.iso

Its given in MINI2440_LINUX_MANUAL.pdf

No I have not cross compiled anything before. But all the tools which I am
using is referred in the MINI2440_LINUX_MANUAL.pdf , So I dont think so
that there could be any problem on this issue.

davef
Well, cross-compiling stuff is not really one of the easier tasks.

For some background you could search for <Cherokee> on this forum and see
how long it took to get something working (?).  The guy that was trying to
do this and get SQLITE to run on his platform is still working on it. 
Certainly there has been no useful tutorial to come out of the work.  

Even following tutorials, written by people who have successfully
cross-compiled some application, do not proceed without problems.

Look at some of the long threads about QT4.6.2

After my problems with Cherokee a Linux gurus at work told me that I should
be using OpenEmbedded and don't try to cross-compile anything that hasn't
already been done there.  So much for a learning experience!

Does OpenEmbedded have SQLITE in their list of goodies?

Then using OpenEmbedded will be another learning experience.

Good luck.

BTW, a good book is:

http://www.kerneltravel.net/downloads/Building.Embedded.Linux.Systems.pdf

Sumeet
Davef atlast some success. The chinese link which you had given helped me.
I made changes according to that in make file and the make script ran
without error along with make install

Thanks a lot davef for the chinese link. Now I will check whether the cross
compiled sqlite runs on the micro2440 board or and let you know.

Sumeet
Hello Dave

I successfully tested sqlite on my micro2440 SDK board and it works well.
Thanks for your support. Without yourhelp it would have been imposible for
me to cross compile. Thanks for the chinese link

davef
Well congratulations!

Now to complete the job . . . write down the steps you took to solve the
problem.  The steps that the Chinese site suggested.  Then other people
will benefit from this long discussion.

Cross-compiling is maybe not that difficult after all :)

Sumeet
yes surely I will write it and post it

Sumeet
Steps to cross compile the sqlite-3.7.0
1) Download the sqlite-amalgamation-3.7.0.tar file using tar command.
2) Extract the tar file to usr directory
3) Cross compiler is located in usr/local/
4) CD to the exrtracted sqlite-3.7.0
5) Enter the following command 
./configure --host=arm-linux \
CFLAGS="-march=armv4t -mtune=arm920t -Os -lpthread -lrt" LDFLAGS=${LDFLAGS}

6) Enter make
   At first it will give an error. To remove this error edit the make file 
and find the string -DPACKAGE_STRING. It will be assigned to \ sqlite \
3.7.0. i.e(-DPACKAGE_STRING = \ sqlite \ 3.7.0. \ ) changed it to
-DPACKAGE_STRING = \ sqlite-3.7.0 \  and save the make file


7) Type make
8) make install DESTDIR={path to the destination directory}
9)Copy the cross compiled file in DESTDIR to required directories in board
10)SQLITE will run

davef
Excellent.

Now, if someone could write a tutorial for Qt4.6.2 or .3 with WebKit and
end it with the words:

10)Qt4.6.3 will run . . . on your 64M board 

I would be even more impressed!

Regards,
Dave

davef
Sumeet,

Actually, there is one more thing to do.

Where did you get the original script from?  Perhaps, some feedback to the
source will get that corrected and then other people that haven't read this
thread will benefit from the change.

Cheers,
Dave

Amin
Thanks a lot !
The cross-compilation will be done with Sumeet steps.

Regards,
Amin