Trying to get it to work correctly:

BUILD_CC is correctly determined, but BUILD_EXEEXT is not (unless you have a Cygwin system). On closer examination, the system is in fact natively building lemon and mksourceid but because the extension is wrong, you get an error like:


   make: *** No rule to make target 'lemon', needed by 'fts5parse.c'. Stop.

Simply calculating BUILD_EXEEXT correctly should make this bit work, and cross-compilation would be nice to have. I have now spent way way too long, while being paid to do other stuff, looking at this. Sorry I can't do more.

Also TARGET_EXEEXT is calculated correctly. In fact because you are not building a compiler this value is not needed - simple substitute EXEEXT everywhere you use TARGET_EXEEXT. E.g. change:

   if test x"$cross_compiling" = xno; then
      TARGET_EXEEXT=$BUILD_EXEEXT
   else
      TARGET_EXEEXT=$config_TARGET_EXEEXT
   fi
   if test "$TARGET_EXEEXT" = ".exe"; then
      SQLITE_OS_UNIX=0
      SQLITE_OS_WIN=1
      CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
   else
      SQLITE_OS_UNIX=1
      SQLITE_OS_WIN=0
      CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
   fi

to:

   if test "$EXEEXT" = ".exe"; then
      SQLITE_OS_UNIX=0
      SQLITE_OS_WIN=1
      CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
   else
      SQLITE_OS_UNIX=1
      SQLITE_OS_WIN=0
      CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
   fi

And in Makefile.in change @TARGET_EXEEXT@ to @EXEEXT@. These changes are untested (no time).



Trying to remove cross-compilation:

At the top of configure.ac is the following text that I recommend you edit for starters:

# The build process allows for using a cross-compiler.  But the default
# action is to target the same platform that we are running on.  The
# configure script needs to discover the following properties of the
# build and target systems:


Search the configure.ac for "cross_compiling". Change everything that needs changing, or remove it. I notice that there is code there to distinguish the build executable extension from the host one, but it doesn't work. I spent a while that I should have spent on paid work trying to figure out how to get that to work and in conclusion, it doesn't.

As far as the autoconf stuff goes, from the configure options it looks like you have AC_CANONICAL_HOST used, but I only see it in aclocal.m4. I don't know enough about autoconf to help here - I don't really know what aclocal.m4 is used for, what it does.


Having re-examined sqlite3.c I think you are right that we can compile it separately. I think the information needs to be put in a README somewhere. It will need instructions on which defines and flags need to be set. Normally configure sets that all up for you.



The way I built it in the end was as follows:

   mkdir sqlite_linux
   cd sqlite_linux
   ../sqlite/configure
   Interrupt the build early, once lemon and mksourceid have been built
   cd ..
   mkdir sqlite_mingw32
   cd sqlite_mingw32
   Edit ../sqlite/configure around line 270 to replace:

       if test x"$cross_compiling" = xno; then
          TARGET_EXEEXT=$BUILD_EXEEXT
       else
          TARGET_EXEEXT=$config_TARGET_EXEEXT
       fi

   with something like:

       TARGET_EXEEXT=$EXEEXT

   $config_TARGET_EXEEXT is not set.

   ../sqlite/configure --host=i686-w64-mingw32
   cp ../sqlite_linux/lemon .
   cp ../sqlite_linux/mksourceid .
   make

However it does look like all I really needed to do was to create a symlink or something from lemon to lemon.exe and the same for mksourceid, plus of course fixing the calculation of TARGET_EXEEXT which just needs to be the same as EXEEXT, or even better just use EXEEXT and not TARGET_EXEEXT.


Senior Software Engineer
H Scientific Ltd
023 9226 7607
www.h-scientific.co.uk

On 06/12/2017 08:24, Richard Hipp wrote:
On 12/6/17, Alastair Growcott <agrowc...@h-scientific.co.uk> wrote:
To avoid confusion I recommend that you remove the option to
cross-compile
I'm cool with that approach.  Can you suggest a specific edit to the
configure.ac file that will accomplish what you describe?

Also, I am not sure your suggestion of generating sqlite3.c natively and
then cross-compiling it separately will work. The generated sqlite3.c
has some platform dependent stuff (selective header inclusion as per
above) in it.

The generated sqlite3.c file should be byte-for-byte identical on all
host platforms.  We test for that.  And we publish the SHA3 hash of
the generated sqlite3.c file in our release notes.  If you find a pair
of host platforms that build different "sqlite3.c" files from the same
sources, then that is a bug.  Please report it.



---
This email has been checked for viruses by AVG.
http://www.avg.com

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to