Android export on linux lazarus / 43-Android ---------------------------------------------------------------------- jjur · 2015-01-04 15:52 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 · 2015-01-04 16:05 Check this. http://blog.naver.com/simonsayz/120198362100 ---------------------------------------------------------------------- jjur · 2015-01-04 17:41 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 · 2015-01-04 18:10 Quotesystem.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  installedthey 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 · 2015-01-04 20:46 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 · 2015-01-05 00:28 Quote from: jjur on January 04, 2015, 09:46:15 pmNext 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: - bin - lib/fpc/ ---------------------------------------------------------------------- jjur · 2015-01-05 12:21 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 · 2015-01-05 15:44 Quote from: jjur on January 05, 2015, 01:21:49 pmThanks, 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). Quote from: jjur on January 05, 2015, 01:21:49 pmand 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 · 2015-01-05 19:48 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/Cus tom_Drawn_Interface/Android#How_to_create_an_LCL_Android_Application ? ---------------------------------------------------------------------- Leledumbo · 2015-01-06 05:53 Quote from: jjur on January 05, 2015, 08:48:56 pmThanks, 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/Cus tom_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 DrawnLazAndroidModuleWizardNative ActivityPick anyone you like. Personally I prefer 2 due to its native look and feel with half- RAD style, despite incompatible code with LCL. ---------------------------------------------------------------------- jjur · 2015-01-06 12:05 Which one is most similar to classic lazarus programming for pc? I would like to try LCL Custom Drawn ---------------------------------------------------------------------- Leledumbo · 2015-01-06 14:46 Quote from: jjur on January 06, 2015, 01:05:19 pmWhich 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 · 2015-01-06 16:01 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 · 2015-01-06 17:20 Quote from: jjur on January 06, 2015, 05:01:43 pmWhere can be problem now? Reveal the complete error message again. Quote from: jjur on January 06, 2015, 05:01:43 pmAnd how create project with LazAndroidModuleWizard? Read the Readme (doh) ---------------------------------------------------------------------- jjur · 2015-01-06 18:42 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     error options. is a combination of the following: #          : compiler stops after 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     set interface style to #         -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     switch on optimalization x. See fpc -i for possible values # -OoNO   switch off optimalization x. See fpc -i for possible values # -Op     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 ---------------------------------------------------------------------- marcov · 2015-01-06 19:17 Try putting -CpARMv7a -OoFASTMATH -CfVFPv3 to the fpc.cfg ---------------------------------------------------------------------- jjur · 2015-01-06 19:41 Added Now it shows: 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 androidlcltest.lpr(6,3) Fatal: Can not find unit customdrawnint used by androidlcltest. Check if package LCL is in the dependencies. Code: [Select] uses   customdrawnint, Interfaces, Forms, mainform, secondform, sqlitejniandroid,   customdrawn_android, customdrawndrawers, sqliteform; ---------------------------------------------------------------------- marcov · 2015-01-06 21:52 Sorry, don't know much about customdrawn. ---------------------------------------------------------------------- jjur · 2015-01-06 23:03 It can't find any of this units. When i delete missing unit, it show missing next unit. ---------------------------------------------------------------------- Leledumbo · 2015-01-07 04:05 Quote from: marcov on January 06, 2015, 08:17:08 pmTry putting -CpARMv7a -OoFASTMATH -CfVFPv3 to the fpc.cfg Better surrounded with: Code: [Select]#ifdef cpuarm #ifdef android and Code: [Select]#endif #endif Quote from: jjur on January 07, 2015, 12:03:33 amIt can't find any of this units. When i delete missing unit, it show missing next unit. the unit is part of lcl (see attached screenshot), open your lcl.lpk and check whether lcl's lib directory produce .ppu and .o for the unit.