about android 5.0 lazarus / 43-Android ---------------------------------------------------------------------- gtyhn · 2015-11-28 05:29 Create a new empty program, and then write the following code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; uses  Classes; begin  Writeln('hello world');end.   Push to run android 5.0 system: error: only position independent executables (PIE) are supported. can you tell me how to solve? android.mk: LOCAL_CFLAGS += -pie -fPIE LOCAL_LDFLAGS += -pie -fPIE lazuars how? ---------------------------------------------------------------------- jmpessoa · 2015-11-29 13:40 Hello gtyhn! The way to you get an android apk may be somewhat longer.... You need a Lazarus prepared to cross-compile.. for windows there is: Laz4Android: FPC: 3.0.0 "Pestering Peacock" (win32/arm-android/i386-android/jvm- android) Lazarus:1.4.4 Android NDK: r10e (arm-linux-androideabi-4.9 + x86-4.9) ref. http://sourceforge.net/projects/laz4android/files/?source=navbar And then you can install the Lamw/Lazarus Android Module Wizard to get a "Form Designer and Components development model!" ref1. https://github.com/jmpessoa/lazandroidmodulewizard       ref2.http://forum.lazarus.freepascal.org/index.php/topic,21919.0.html ---------------------------------------------------------------------- engkin · 2015-11-30 02:20 It seems that FPC is capable of producing position independent code, according to this: QuoteA position-independent executable is simply an executable that only contains position-independent code and that is linked with the "-pie" linker option. So compiling all code with -Cg (the standard FPC RTL and packages are compiled like that by default on Linux/x86-64) and then linking your application with the -kpie command line option should be enough. I would be interested to know if you (or anyone else) succeed (or fail) in running an executable file produced using this method. I assume it works under Terminal Emulator if it has the right mode (755?) and NOT located on the SD card. ---------------------------------------------------------------------- gtyhn · 2015-11-30 03:56 Thanks for jmpessoa and engkin reply! I have configured cross-compiling, i use CodeTyphon. but I don't know how to join in the lazarus "-pie" compiler options. Android 5.0 native code must be enabled PIE. If using c/c + +. I know the android.mk add: LOCAL_CFLAGS += -pie -fPIE LOCAL_LDFLAGS += -pie -fPIE So I need to know if on lazarus, support open "-PIE" option to compile? ---------------------------------------------------------------------- gtyhn · 2015-11-30 04:51 I use "-kpie" compiler options, the following error: c:\codetyphon\fpc\fpc32\bin\i386-win32\arm-android-ld.exe: cannot find pie: No such file or directory ---------------------------------------------------------------------- Leledumbo · 2015-11-30 09:49 Quote from: gtyhn on November 30, 2015, 05:51:53 amI use "-kpie" compiler options, the following error: c:\codetyphon\fpc\fpc32\bin\i386-win32\arm-android-ld.exe: cannot find pie: No such file or directory if you want to pass option to linker, don't forget the leading dash. i.e.: it should be -k-pie, assuming ld expects -pie ---------------------------------------------------------------------- gtyhn · 2015-12-01 08:58 Thank you Leledumbo. Use "-k-pie" successful compilation, and can be run on android 5.0 success! Thanks for everyone help and reply! ---------------------------------------------------------------------- jmpessoa · 2015-12-01 16:23 Hello gtyhn, Congratulations! What about a "tutorial"? ---------------------------------------------------------------------- gtyhn · 2015-12-02 02:59 This is very simple, only need to configure the android cross- compilation environment well, and then in the project Options "Compiler Options" - > "Compilation and Linking" - > "Linking" - > "Pass Options to would with - k, delimiter isspace" add "-pie" ---------------------------------------------------------------------- jmpessoa · 2015-12-29 19:54 Hello gtyhn! "Lamw" now can produce a "executable".... But, how to run/install it? I try "adb push" to my device [not rooted]  "/data/tmp"  but I got "permission denied" ....  I will need a "terminal emulator"?... some suggestion? Thank you! ---------------------------------------------------------------------- marcov · 2015-12-29 20:05 Quote from: gtyhn on November 28, 2015, 06:29:47 amLOCAL_CFLAGS += -pie -fPIE LOCAL_LDFLAGS += -pie -fPIE Those look like GCC parameters. Try to substitute with FPC commandline parameters like -Cg ---------------------------------------------------------------------- engkin · 2015-12-29 20:51 Quote from: jmpessoa on December 29, 2015, 08:54:36 pmI try "adb push" to my device [not rooted]  "/data/tmp"  but I got "permission denied" ....  The steps are: 1-Copy it to a folder that the OS allows running an executable from within.    ... The folder I used is  /data/local/tmp    ... I don't think you can put anything there without root! 2-Change the mode of the file to 755 to allow everyone to run it. 3-Use adb or Terminal Emulator to run it.    ... If you are comfortable with adb commands then you don't need Terminal Emulator. ---------------------------------------------------------------------- jmpessoa · 2015-12-29 21:11 Quote... I don't think you can put anything there without root!    Thank you! ---------------------------------------------------------------------- jmpessoa · 2015-12-29 22:45 Hello engkin! Yes, now I was able to to confirm [Attachment picture from emulator] ! Lamw now does android console/executable app! I will update github! Thank you and All! P.S. [Edited] here another good ref: http://kevinboone.net/android_native.html ---------------------------------------------------------------------- engkin · 2015-12-30 00:01 Quote from: jmpessoa on December 29, 2015, 11:45:17 pmHello engkin! Yes, now I was able to to confirm [Attachment picture from emulator] ! Lamw now does android console/executable app! I will update github! Thank you and All! P.S. [Edited] here another good ref: http://kevinboone.net/android_native.html Good job! Thanks for the link. A Windows person like me needs a lot of these articles.