Recent

Author Topic: Android export on linux  (Read 11219 times)

jjur

  • New Member
  • *
  • Posts: 14
    • PAKRAPOT
Android export on linux
« on: January 04, 2015, 04:52:38 pm »
Hi,
last days I'm trying to build and configure android export in lazarus. 
I tried this tutorials in wiki:
1. http://wiki.freepascal.org/Custom_Drawn_Interface/Android   // i created apk, but it crashed after run in my mobile, also tried to change api from 8 to 18  :(
2. http://wiki.freepascal.org/Android_Programming
3. http://wiki.lazarus.freepascal.org/Android    // Completed, what next?

I need to install it on linux (Ubuntu 14.10)
Testing on mobile Doogee DG550 (Android 4.4.2)

I need new and working tutorial.
Please, where i can find good, working tutorial? Or can you tell me, what i have to do?
Thanks

georgebou

  • New Member
  • *
  • Posts: 45
Re: Android export on linux
« Reply #1 on: January 04, 2015, 05:05:26 pm »

jjur

  • New Member
  • *
  • Posts: 14
    • PAKRAPOT
Re: Android export on linux
« Reply #2 on: January 04, 2015, 06:41:30 pm »
in step 3
after
Code: [Select]
make crossinstall FPC=/home/ntb-10/lazarus/fpc/2.6.4/fpc OS_TARGET=android CPU_TARGET=arm OPT="-dFPC_ARMEL" CROSSOPT="-CpARMv7a -OoFASTMATH -CfVFPv3" CROSSBINDIR=/home/ntb-10/Android/ndk10/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin INSTALL_PREFIX=/home/ntb-10/lazarus/fpc/2.7.1/it end with error:
Code: [Select]
 
....
make[4]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1/rtl/android'
make[3]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1/rtl'
make[2]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1'
make packages_clean FPC=/home/ntb-10/lazarus/fpc/2.7.1/compiler/ppcrossarm
make[2]: Entering directory '/home/ntb-10/lazarus/fpc/2.7.1'
make -C packages clean
make[3]: Entering directory '/home/ntb-10/lazarus/fpc/2.7.1/packages'
make -C fpmkunit clean_bootstrap
make[4]: Entering directory '/home/ntb-10/lazarus/fpc/2.7.1/packages/fpmkunit'
/bin/rm -rf units_bs
make[4]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1/packages/fpmkunit'
make[3]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1/packages'
make[2]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1'
make rtl_all FPC=/home/ntb-10/lazarus/fpc/2.7.1/compiler/ppcrossarm FPCFPMAKE=/home/ntb-10/lazarus/fpc/2.7.1/compiler/ppc RELEASE=1 'OPT=-dFPC_ARMEL'
make[2]: Entering directory '/home/ntb-10/lazarus/fpc/2.7.1'
make -C rtl all
make[3]: Entering directory '/home/ntb-10/lazarus/fpc/2.7.1/rtl'
make -C android all
make[4]: Entering directory '/home/ntb-10/lazarus/fpc/2.7.1/rtl/android'
/bin/mkdir -p /home/ntb-10/lazarus/fpc/2.7.1/rtl/units/arm-android
/home/ntb-10/Android/ndk10/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/as  -o /home/ntb-10/lazarus/fpc/2.7.1/rtl/units/arm-android/prt0.o arm/prt0.as
/home/ntb-10/Android/ndk10/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/as  -o /home/ntb-10/lazarus/fpc/2.7.1/rtl/units/arm-android/dllprt0.o arm/dllprt0.as
/home/ntb-10/lazarus/fpc/2.7.1/compiler/ppcrossarm -Ur -Tandroid -Parm -Ur -Xs -O2 -n -Fi../inc -Fi../arm -Fi../unix -Fiarm -Fi../linux -Fi../linux/arm -FD/home/ntb-10/Android/ndk10/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin -FE. -FU/home/ntb-10/lazarus/fpc/2.7.1/rtl/units/arm-android -dFPC_ARMEL -darm -dRELEASE -CpARMv7a -OoFASTMATH -CfVFPv3 -Us -Sg ../linux/system.pp
system.inc(1821,8) Warning: Implicit string type conversion from "RawByteString" to "UnicodeString"
system.pp(375) Error: Assembler arm-linux-androideabi-as not found, switching to external assembling
system.pp(375) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Makefile:3415: recipe for target 'system.ppu' failed
make[4]: *** [system.ppu] Error 1
make[4]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1/rtl/android'
Makefile:2720: recipe for target 'android_all' failed
make[3]: *** [android_all] Error 2
make[3]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1/rtl'
Makefile:2505: recipe for target 'rtl_all' failed
make[2]: *** [rtl_all] Error 2
make[2]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1'
Makefile:2795: recipe for target 'build-stamp.arm-android' failed
make[1]: *** [build-stamp.arm-android] Error 2
make[1]: Leaving directory '/home/ntb-10/lazarus/fpc/2.7.1'
Makefile:2863: recipe for target 'crossinstall' failed
make: *** [crossinstall] Error 2

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11387
  • FPC developer.
Re: Android export on linux
« Reply #3 on: January 04, 2015, 07:10:42 pm »
Quote
system.pp(375) Error: Assembler arm-linux-androideabi-as not found, switching to external assembling

It can't find the proper binutils.

 Either because
  • They are not  installed
  • they are installed but the path is not added to the search path (simon says step2-3)
  • they are installed but differently named (not starting with arm-linux-androideabi- but a slightly different naming

jjur

  • New Member
  • *
  • Posts: 14
    • PAKRAPOT
Re: Android export on linux
« Reply #4 on: January 04, 2015, 09:46:15 pm »
Thanks, it was number 3. In path i used was only shortcut as to orginal file with expected name.

Next step
Quote
Step 4.  Copy to Compiler & Units
copy c:\lazarus\fpc\2.7.1\bin\x86_64-win64\ppcrossarm.exe   ->  c:\lazarus\fpc\2.6.2\bin\x86_64-win64\
              copy c:\lazarus\fpc\2.7.1\units\arm-android\                                ->  c:\lazarus\fpc\2.6.2\units\arm-android\
But bin folder is empty and folder units not exist.
screenshot: http://oi59.tinypic.com/sd1fgk.jpg
screenshot: http://oi57.tinypic.com/2hcg5s3.jpg

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android export on linux
« Reply #5 on: January 05, 2015, 01:28:58 am »
Next step
Quote
Step 4.  Copy to Compiler & Units
copy c:\lazarus\fpc\2.7.1\bin\x86_64-win64\ppcrossarm.exe   ->  c:\lazarus\fpc\2.6.2\bin\x86_64-win64\
              copy c:\lazarus\fpc\2.7.1\units\arm-android\                                ->  c:\lazarus\fpc\2.6.2\units\arm-android\
But bin folder is empty and folder units not exist.
screenshot: http://oi59.tinypic.com/sd1fgk.jpg
screenshot: http://oi57.tinypic.com/2hcg5s3.jpg
FPC default installation layout on *nix is different than windows. In *nix, it's:
<install prefix dir>
- bin
- lib/fpc/<fpcversion>

jjur

  • New Member
  • *
  • Posts: 14
    • PAKRAPOT
Re: Android export on linux
« Reply #6 on: January 05, 2015, 01:21:49 pm »
Thanks, i think fpc is ready. But when i try build example project, at start it show message http://oi57.tinypic.com/9sxh1k.jpg ( Package fpcunitide is installed but not found .lpk file. Fictional package was created.)
and when i try to build it, it end with error http://oi58.tinypic.com/iyzcs1.jpg (main.pas(0,0) Fatal: Can not find unit system used by main.) Where is problem now?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android export on linux
« Reply #7 on: January 05, 2015, 04:44:08 pm »
Thanks, i think fpc is ready. But when i try build example project, at start it show message http://oi57.tinypic.com/9sxh1k.jpg ( Package fpcunitide is installed but not found .lpk file. Fictional package was created.)
Just uninstall if you don't need the package, or reinstall if you do (the package is shipped with lazarus, probably the IDE just misses the path link).
and when i try to build it, it end with error http://oi58.tinypic.com/iyzcs1.jpg (main.pas(0,0) Fatal: Can not find unit system used by main.) Where is problem now?
Biggest guess: fpc.cfg doesn't contain -Fu pointing to correct units directory (perhaps it's hardcoded to your stable fpc version)

Right click and select copy all and hidden messages (or something like that) to reveal the actual error message.

jjur

  • New Member
  • *
  • Posts: 14
    • PAKRAPOT
Re: Android export on linux
« Reply #8 on: January 05, 2015, 08:48:56 pm »
Thanks, now it works, apk works.

And what i have to do if i want create a new project for android?
Can i use with small modifications this http://wiki.freepascal.org/Custom_Drawn_Interface/Android#How_to_create_an_LCL_Android_Application ?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android export on linux
« Reply #9 on: January 06, 2015, 06:53:47 am »
Thanks, now it works, apk works.

And what i have to do if i want create a new project for android?
Can i use with small modifications this http://wiki.freepascal.org/Custom_Drawn_Interface/Android#How_to_create_an_LCL_Android_Application ?
There are at least three ways if you use the arm-android compiler (and another one using jvm-android compiler):
  • LCL Custom Drawn
  • LazAndroidModuleWizard
  • Native Activity
Pick anyone you like. Personally I prefer 2 due to its native look and feel with half-RAD style, despite incompatible code with LCL.

jjur

  • New Member
  • *
  • Posts: 14
    • PAKRAPOT
Re: Android export on linux
« Reply #10 on: January 06, 2015, 01:05:19 pm »
Which one is most similar to classic lazarus programming for pc?

I would like to try LCL Custom Drawn

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android export on linux
« Reply #11 on: January 06, 2015, 03:46:27 pm »
Which one is most similar to classic lazarus programming for pc?

I would like to try LCL Custom Drawn
Custom Drawn, but it doesn't have many controls implemented yet. Usable enough for many common applications. Size overhead is the same as desktop LCL app.

jjur

  • New Member
  • *
  • Posts: 14
    • PAKRAPOT
Re: Android export on linux
« Reply #12 on: January 06, 2015, 05:01:43 pm »
When i try build Androidlcl project from lazarus examples directory, it retry show error with system.ppu. But file is really in
/usr/lib64/fpc/2.6.4/units/arm-android/rtl/system.ppu and example project  from http://blog.naver.com/simonsayz/120198362100 don't shows this error.
Code: [Select]
androidlcltest.lpr(0,0) Fatal: Can not find system used by androidlcltest, ppu=/usr/lib64/fpc/2.6.4/units/arm-android/rtl/system.ppu
Where can be problem now?

And how create project with LazAndroidModuleWizard?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Android export on linux
« Reply #13 on: January 06, 2015, 06:20:57 pm »
Where can be problem now?
Reveal the complete error message again.
And how create project with LazAndroidModuleWizard?
Read the Readme (doh)

jjur

  • New Member
  • *
  • Posts: 14
    • PAKRAPOT
Re: Android export on linux
« Reply #14 on: January 06, 2015, 07:42:50 pm »
Full:
Code: [Select]
Options changed, recompiling clean with -B
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 3.1.1 [2015/01/05] for arm
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Android for ARMEL
Compiling androidlcltest.lpr
PPU Loading /usr/lib64/fpc/2.6.4/units/arm-android/rtl/system.ppu
Trying to use a unit which was compiled with a different FPU mode
androidlcltest.lpr(0,0) Fatal: Can not find system used by androidlcltest, ppu=/usr/lib64/fpc/2.6.4/units/arm-android/rtl/system.ppu
fpc.cfg
Code: [Select]
#
# Config file generated by fpcmkcfg on 5-1-15 - 11:19:15
# Example fpc.cfg for Free Pascal Compiler
#

# ----------------------
# Defines (preprocessor)
# ----------------------

#
# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
#
# -d is the same as #DEFINE
# -u is the same as #UNDEF
#

#
# Some examples (for switches see below, and the -? helppages)
#
# Try compiling with the -dRELEASE or -dDEBUG on the commandline
#

# For a release compile with optimizes and strip debuginfo
#IFDEF RELEASE
  -O2
  -Xs
  #WRITE Compiling Release Version
#ENDIF

# For a debug version compile with debuginfo and all codegeneration checks on
#IFDEF DEBUG
  -gl
  -Crtoi
  #WRITE Compiling Debug Version
#ENDIF

# assembling
#ifdef darwin
# use pipes instead of temporary files for assembling
-ap
# path to Xcode 4.3+ utilities (no problem if it doesn't exist)
-FD/Applications/Xcode.app/Contents/Developer/usr/bin
#endif

# ----------------
# Parsing switches
# ----------------

# Pascal language mode
#      -Mfpc      free pascal dialect (default)
#      -Mobjfpc   switch some Delphi 2 extensions on
#      -Mdelphi   tries to be Delphi compatible
#      -Mtp       tries to be TP/BP 7.0 compatible
#      -Mgpc      tries to be gpc compatible
#      -Mmacpas   tries to be compatible to the macintosh pascal dialects
#
# Turn on Object Pascal extensions by default
#-Mobjfpc

# Assembler reader mode
#      -Rdefault  use default assembler
#      -Ratt      read AT&T style assembler
#      -Rintel    read Intel style assembler
#
# All assembler blocks are AT&T styled by default
#-Ratt

# Semantic checking
#      -S2        same as -Mobjfpc
#      -Sc        supports operators like C (*=,+=,/= and -=)
#      -Sa        include assertion code.
#      -Sd        same as -Mdelphi
#      -Se<x>     error options. <x> is a combination of the following:
#         <n> : compiler stops after <n> errors (default is 1)
#         w   : compiler stops also after warnings
#         n   : compiler stops also after notes
#         h   : compiler stops also after hints
#      -Sg        allow LABEL and GOTO
#      -Sh        Use ansistrings
#      -Si        support C++ styled INLINE
#      -Sk        load fpcylix unit
#      -SI<x>     set interface style to <x>
#         -SIcom    COM compatible interface (default)
#         -SIcorba  CORBA compatible interface
#      -Sm        support macros like C (global)
#      -So        same as -Mtp
#      -Sp        same as -Mgpc
#      -Ss        constructor name must be init (destructor must be done)
#      -Sx        enable exception keywords (default in Delphi/ObjFPC modes)
#
# Allow goto, inline, C-operators, C-vars
-Sgic

# ---------------
# Code generation
# ---------------

# Uncomment the next line if you always want static/dynamic units by default
# (can be overruled with -CD, -CS at the commandline)
#-CS
#-CD

# Set the default heapsize to 8Mb
#-Ch8000000

# Set default codegeneration checks (iocheck, overflow, range, stack)
#-Ci
#-Co
#-Cr
#-Ct

# Optimizer switches
# -Os        generate smaller code
# -Oa=N      set alignment to N
# -O1        level 1 optimizations (quick optimizations, debuggable)
# -O2        level 2 optimizations (-O1 + optimizations which make debugging more difficult)
# -O3        level 3 optimizations (-O2 + optimizations which also may make the program slower rather than faster)
# -Oo<x>     switch on optimalization x. See fpc -i for possible values
# -OoNO<x>   switch off optimalization x. See fpc -i for possible values
# -Op<x>     set target cpu for optimizing, see fpc -i for possible values

#ifdef darwin
#ifdef cpui386
-Cppentiumm
-Oppentiumm
#endif
#endif

# -----------------------
# Set Filenames and Paths
# -----------------------

# Both slashes and backslashes are allowed in paths

# path to the messagefile, not necessary anymore but can be used to override
# the default language
#-Fr/usr/lib64/fpc/$fpcversion/msg/errore.msg
#-Fr/usr/lib64/fpc/$fpcversion/msg/errorn.msg
#-Fr/usr/lib64/fpc/$fpcversion/msg/errores.msg
#-Fr/usr/lib64/fpc/$fpcversion/msg/errord.msg
#-Fr/usr/lib64/fpc/$fpcversion/msg/errorr.msg

# searchpath for units and other system dependent things
-Fu/usr/lib64/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib64/fpc/$fpcversion/units/$fpctarget/*
-Fu/usr/lib64/fpc/$fpcversion/units/$fpctarget/rtl
-Fu/usr/lib64/fpc/2.6.4/units/arm-android/*
-Fu/usr/lib64/fpc/2.6.4/units/arm-android/rtl
-Fu/usr/lib64/fpc/2.6.4/units/arm-android/rtl/*
-Fu/usr/lib64/fpc/2.6.4/units/arm-android/rtl/system.ppu

#IFDEF FPCAPACHE_1_3
-Fu/usr/lib64/fpc/$fpcversion/units/$fpctarget/httpd13/
#ELSE
#IFDEF FPCAPACHE_2_0
-Fu/usr/lib64/fpc/$fpcversion/units/$fpctarget/httpd20
#ELSE
-Fu/usr/lib64/fpc/$fpcversion/units/$fpctarget/httpd22
#ENDIF
#ENDIF

# searchpath for fppkg user-specific packages
-Fu~/.fppkg/lib/fpc/$fpcversion/units/$FPCTARGET/*

# path to the gcclib
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/4.9
#endif
#ifdef cpux86_64
-Fl/usr/lib/gcc/x86_64-linux-gnu/4.9
#endif

# searchpath for libraries
#-Fl/usr/lib64/fpc/$fpcversion/lib
#-Fl/lib;/usr/lib
-Fl/usr/lib64/fpc/$fpcversion/lib/$FPCTARGET

# searchpath for tools
-FD/usr/lib64/fpc/$fpcversion/bin/$FPCTARGET

#IFNDEF CPUI386
#IFNDEF CPUAMD64
#DEFINE NEEDCROSSBINUTILS
#ENDIF
#ENDIF

#IFNDEF Linux
#DEFINE NEEDCROSSBINUTILS
#ENDIF

# binutils prefix for cross compiling
#IFDEF FPC_CROSSCOMPILING
#IFDEF NEEDCROSSBINUTILS
  -XP$FPCTARGET-
#ENDIF
#ENDIF


# -------------
# Linking
# -------------

# generate always debugging information for GDB (slows down the compiling
# process)
#      -gc        generate checks for pointers
#      -gd        use dbx
#      -gg        use gsym
#      -gh        use heap trace unit (for memory leak debugging)
#      -gl        use line info unit to show more info for backtraces
#      -gv        generates programs tracable with valgrind
#      -gw        generate dwarf debugging info
#
# Enable debuginfo and use the line info unit by default
#-gl

# always pass an option to the linker
#-k-s

# Always strip debuginfo from the executable
-Xs


# -------------
# Miscellaneous
# -------------

# Write always a nice FPC logo ;)
-l

# Verbosity
#      e : Show errors (default)       d : Show debug info
#      w : Show warnings               u : Show unit info
#      n : Show notes                  t : Show tried/used files
#      h : Show hints                  s : Show time stamps
#      i : Show general info           q : Show message numbers
#      l : Show linenumbers            c : Show conditionals
#      a : Show everything             0 : Show nothing (except errors)
#      b : Write file names messages   r : Rhide/GCC compatibility mode
#          with full path              x : Executable info (Win32 only)
#      v : write fpcdebug.txt with     p : Write tree.log with parse tree
#          lots of debugging info
#
# Display Info, Warnings and Notes
-viwn
# If you don't want so much verbosity use
#-vw
« Last Edit: January 06, 2015, 07:46:55 pm by jjur »

 

TinyPortal © 2005-2018