Issue #79 new

Compile for ARM

David Irving
created an issue

Hi,

Could someone please tell me how to cross compile the SQLite-JDBC for the arm processor. I have Ubuntu set up with the toolchain, I just need to know what commants to pass, or what to modify in the makefile?

Thank you very much for any assistance.

Comments (15)

  1. David Irving reporter

    Thanks for your reply. I am still having issues. Here is my notes

    1) install openjdk-6-jdk 2) install all cross-compile tools 3) install maven (found out later) 4) set JAVA_HOME to JDK path (DPKG -L openjdk-6-jdk and look for the base path before the

    /include directory (where jni.h header file is included) 5) Updating Makefile and Makefile.common 6) I've observed CROSS_PREFIX=arm-linux-gnueabi- set in Makefile. Lets make sure that those compilers are installed and the binary references are correct

    arm-linux-gnueabi-g++ arm-linux-gnueabi-g++: fatal error: no input files compilation terminated.

    yep it is!

     --info                        List object formats & architectures
    

    supported -o <file> Place stripped output into <file> arm-linux-gnueabi-strip: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big

    plugin srec symbolsrec verilog tekhex binary ihex

    arm-linux-gnueabi-strip is also installed

    check the cflags used for Arm compilation http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html remove non supported

    silence the deprecated conversion from string contstat to char* http://stackoverflow.com/questions/59670/how-to-get-rid-of-deprecated-conversion-from-string-

    constant-to-char-warnin

    I am stuck.

  2. David Irving reporter

    Hi. Yes. I compiled it on a Raspberry Pi. It worked perfectly. I originally wanted to cross-compile from my main intel machine, I added some of the arm target stuff but I still couldn't get it to work as I wrote above. Compiling on the Pi was a quicker way out.

  3. dev1_thegame

    David,

    how did you manage to compile on the Pi? I tried to compile on Raspbian with OpenJDK 6, but had no susccess. I get UnsatifiedLinkErrors during the testing stage of the build process.

  4. Matthew Piggott

    I had to do the following to cross compile for ARM (oops, think my diff is the wrong way around):

    sudo apt-get install curl openjdk-7-jdk maven

    make sure $PATH is set to point to your ARM toolchain.

    export the path to your openJDK... in my case: export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386/"

    Add the following lines to the main Makefile, making sure to set your compiler prefix as required: --- Makefile 2015-05-04 15:32:48.388514876 +1200 +++ xerial-sqlite-jdbc-cb3185b14872/Makefile 2014-10-08 21:24:13.000000000 +1300 @@ -91,11 +91,6 @@ linux32: $(MAKE) native OS_NAME=Linux OS_ARCH=i386

    -linux-arm: - $(MAKE) native CROSS_PREFIX=arm-linux-gnueabihf- OS_NAME=Linux OS_ARCH=arm - -linux-armhf: - $(MAKE) native CROSS_PREFIX=arm-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armhf

    sparcv9: $(MAKE) native OS_NAME=SunOS OS_ARCH=sparcv9

    Add the following changes to Makefile.common: --- Makefile.common 2015-05-04 15:35:57.728512999 +1200 +++ xerial-sqlite-jdbc-cb3185b14872/Makefile.common 2014-10-08 21:24:13.000000000 +1300 @@ -40,53 +40,36 @@

    # os=Default is meant to be generic unix/linux

    -known_targets := Linux-arm Linux-armhf Linux-i386 Linux-amd64 Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64 SunOS-sparcv9 +known_targets := Linux-i386 Linux-amd64 Mac-i386 Mac-x86_64 Windows-x86 Windows-amd64 SunOS-sparcv9 target := $(OS_NAME)-$(OS_ARCH)

    ifeq (,$(findstring $(strip $(target)),$(known_targets))) target := Default endif

    -# cross-compilation toolchain prefix (e.g. "arm-linux-gnueabi-") -CROSS_PREFIX := - -Default_CXX := $(CROSS_PREFIX)gcc -Default_STRIP := $(CROSS_PREFIX)strip +Default_CC := gcc +Default_STRIP := strip Default_CFLAGS := -I$(JAVA_HOME)/include -Isqlitejdbc/lib/inc_linux -Os -fPIC -fvisibility=hidden Default_LINKFLAGS := -shared Default_LIBNAME := libsqlitejdbc.so Default_SQLITE_FLAGS :=

    -Linux-arm_CC := $(CROSS_PREFIX)gcc -Linux-arm_STRIP := $(CROSS_PREFIX)strip -Linux-arm_CFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -fvisibility=hidden -mfloat-abi=softfp -Linux-arm_LINKFLAGS := -shared -static-libgcc -Linux-arm_LIBNAME := libsqlitejdbc.so -Linux-arm_SQLITE_FLAGS:= - -Linux-armhf_CC := $(CROSS_PREFIX)gcc -Linux-armhf_STRIP := $(CROSS_PREFIX)strip -Linux-armhf_CFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -fvisibility=hidden -mfloat-abi=hard -Linux-armhf_LINKFLAGS := -shared -static-libgcc -Linux-armhf_LIBNAME := libsqlitejdbc.so -Linux-armhf_SQLITE_FLAGS:= - -Linux-i386_CC := $(CROSS_PREFIX)gcc -Linux-i386_STRIP := $(CROSS_PREFIX)strip +Linux-i386_CC := gcc +Linux-i386_STRIP := strip Linux-i386_CFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -m32 -fvisibility=hidden Linux-i386_LINKFLAGS := -shared -static-libgcc Linux-i386_LIBNAME := libsqlitejdbc.so Linux-i386_SQLITE_FLAGS :=

    -Linux-amd64_CC := $(CROSS_PREFIX)gcc -Linux-amd64_STRIP := $(CROSS_PREFIX)strip +Linux-amd64_CC := gcc +Linux-amd64_STRIP := strip Linux-amd64_CFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -m64 -fvisibility=hidden Linux-amd64_LINKFLAGS := -shared -static-libgcc Linux-amd64_LIBNAME := libsqlitejdbc.so Linux-amd64_SQLITE_FLAGS :=

    -SunOS-sparcv9_CC := $(CROSS_PREFIX)gcc -SunOS-sparcv9_STRIP := $(CROSS_PREFIX)strip +SunOS-sparcv9_CC := gcc +SunOS-sparcv9_STRIP := strip SunOS-sparcv9_CFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_linux -O2 -fPIC -m64 -fvisibility=hidden SunOS-sparcv9_LINKFLAGS := -shared -static-libgcc SunOS-sparcv9_LIBNAME := libsqlitejdbc.so

    Then to build simply run: make linux-arm OR make linux-armhf depending on your needs.

    Thanks to Taro L. Saito for the advice above.

  5. Log in to comment