ARM crosscompiling lazarus / 3-General ---------------------------------------------------------------------- djdjdjole · 2012-08-24 08:08 Hello I prepared Lazarus for crosscompiling as stated here: http://wiki.freepascal.org/Setup_Cross_Compile_For_ARM. First I built Linux (using Buildroot) with GTK2 support on my ARM board. GTK examples work on target, when compiled using C compiler (generated by Buildroot). Examples intended for FPC - also with direct GTK functions calls (no use of Lazarus designer), work when built in Lazarus, until the moment when unit sysutils become included in uses section. Then I receive mutliple acces violation erros. After little investigation I found the first problem started at the StrToInt(argv) insturction. All programs work OK when built for i386 (Ubuntu 10.04). My FPC is 2.7.1; Lazarus is 1.1; ARM board- mini2440 Any help ? Regards ---------------------------------------------------------------------- Leledumbo · 2012-08-24 14:12 Try making a simple program that demonstrates this behavior. I only have my android phone as ARM device and AndroidLCL example (which uses SysUtils) works fine there (it doesn't use FPC 2.7.1 though, but a modified 2.5.1 maintained here as AFAIK 2.7.1 has quite some problems on android). ---------------------------------------------------------------------- Laksen · 2012-08-24 14:44 Also make sure that you are compiling to ARMv4T and not anything higher. The SC32440 is a fairly old processor. What ABI is the kernel running? ---------------------------------------------------------------------- djdjdjole · 2012-08-24 20:45 Thank's Leledumbo for reply. I also think that problem is not in sysutils, but it is the place where some other problem reveals. The board is on my job, so I'll try what Leledumbo proposed, next week and see results. I am very new in embedded linux world and hope I understood correctly Laksen's questions Regarding ABI question - the options that were default in kernel config, (and that I didn't change) are: -  Use ARM EABI to compile the kernel and -  Allow old ABI binaries to run with this kernel (EXPERIMENTAL) However, I don't know where in Lazarus IDE, I choose compiling to ARMv4T. One more question, when compiling binutils (in the process of preparing Lazarus for crosscompilation), I used assembler option "-meabi=5", but not sure if there should be some other number?  How can I find that ? Regards ---------------------------------------------------------------------- djdjdjole · 2012-08-27 12:39 You were right Leledumbo. It is about 2.7.1 version. 2.5.1 compiles and program I described with direct gtk calls -works on target. Link you gave me is precompiled 2.5.1 for arm, so I renamed directory /usr/lib/fpc/2.7.1/units/arm-linux and copy arm-linux directory from precompiled 2.5.1. (and also ppccrossarm file) to /usr/lib/fpc/2.7.1/units directory. Compiled - worked OK. However, when generate project (what I described was program only), with no code and try to compile it says :PPU invalid version 146 Rebuild needed of unit interaces used by ....../interfaces.ppu Before I did above described changes, project compiled OK. Does it mean that I must compile first 2.5.1 (can I do it with 2.6.0 which is on my Ubuntu) from sources, then do "make crossinstall" and make clean all lazarus ? Or what ? Regards ---------------------------------------------------------------------- Leledumbo · 2012-08-27 15:27 Quoteso I renamed directory /usr/lib/fpc/2.7.1/units/arm-linux and copy arm-linux directory from precompiled 2.5.1. (and also ppccrossarm file) to /usr/lib/fpc/2.7.1/units directory. Compiled - worked OKThis is not the expected way, do not cross copy the compiler and units of different version. Use each as one. QuoteHowever, when generate project (what I described was program only), with no code and try to compile it says :PPU invalid version 146 Rebuild needed of unit interaces used by ....../interfaces.ppuPPU format changes quite often, especially in development snapshots, and all used PPU for the same project must be compatible. Hence the error you get where the compiler is trying to recompile the unit. QuoteDoes it mean that I must compile first 2.5.1 (can I do it with 2.6.0 which is on my Ubuntu) from sources, then do "make crossinstall" and make clean all lazarus ? Or what ?Simply use the 2.5.1 as a whole (compiler and units) then recompile lcl using it. ---------------------------------------------------------------------- djdjdjole · 2012-08-27 18:50 Strangely, but didn't succeed to find fpc.zip for 2.5.1. Is it some kind of error or my missunderstanding, but in ftp://ftp.freepascal.org/fpc/snapshot/v25/source/ I've got fpc.zip, inside which when looking at Makefile- I read  2.7.1 !!! What I only find is precompiled 2.5.1 for i386, but I doubt it is good to use two precompiled version for i386 and for arm even if they are 2.5.1 - also I think I need unit sources. Regards ---------------------------------------------------------------------- djdjdjole · 2012-08-27 19:12 And, yes, one more thing - do I have to compile 2.x.y sources with release version of compiler < 2.x.y  or it could be even higher version ? In first case, it means almost complete installation of fpc and Lazarus, only to change from 2.7.1 to 2.5.1 (eg). Cheers ---------------------------------------------------------------------- Leledumbo · 2012-08-28 15:03 QuoteStrangely, but didn't succeed to find fpc.zip for 2.5.1. Is it some kind of error or my missunderstanding, but in ftp://ftp.freepascal.org/fpc/snapshot/v25/source/ I've got fpc.zip, inside which when looking at Makefile- I read  2.7.1 !!!The date is newer than the release date of 2.6.0, probably it's already 2.7.1 but the new folder for v27 wasn't created yet at that time. Could you just try with 2.6.0? QuoteAnd, yes, one more thing - do I have to compile 2.x.y sources with release version of compiler < 2.x.y  or it could be even higher version ?Typically, for development version, compile with the latest release prior to that development version (this is a guaranteed-to- work operation). So it's 2.4.0 / 2.4.2 for 2.5.1. You can compile with 2.5.1 as well but the only supported revision is the one you're going to compile (same revision compiling itself). Backward compatibility (compiling older version with newer one) seems not supported. ---------------------------------------------------------------------- djdjdjole · 2012-08-28 17:58 Funny situation: 2.4.0 RPM package doesn't compile 2.6.0 sources (- I need sources for Lazarus) - it's some syntax error. However it does compile 2.5.1 sources (that I found somewhere !). Later, when I switch to 2.5.1 fpc compiler and try to compile Lazarus 1.1 sources -it fails (I think some error of missing property or so). On the other hand, precompiled 2.5.1 version (i386) downloaded from ftp.freepascal.org  does commpile Lazarus 1.1. I'll try few more combination, but seems there is no light at sight. Regards ---------------------------------------------------------------------- Leledumbo · 2012-08-29 07:55 2.4.0 should compile 2.4.2, 2.4.2 should compile 2.6.0. If you skip over a version, it's not guaranteed then. For Lazarus, it's another different beast. Lazarus and FPC are developed by two different teams, and Lazarus can't guarantee that it can be compiled with versions other than the suggested (bundled) one. Even Lazarus and FPC revisions taken at the same time might not be compatible (like the one that's just happened around a week ago until solved this monday). ---------------------------------------------------------------------- djdjdjole · 2012-08-29 10:24 At last success. RPM 2.4.0 compiled 2.5.1 sources. But Lazarus sources, I changed to 09.30.4 version. 2.5.1 compiled Lazarus OK. I made simple project in Lazarus  (-GTK compiled) to change the color of form, when (the only) button is pressed. Compiled and work on target. What confuses me is binary size of 15.8MB, although I unchecked option for including debugg info. I can do some experimenting now. Thanks a lot Leledumbo and the others. I am almost sure there will be some more problems, so I will ask for further help. Regards ---------------------------------------------------------------------- Leledumbo · 2012-08-29 12:53 QuoteWhat confuses me is binary size of 15.8MB, although I unchecked option for including debugg info.Broken ld or options get overriden. Try manual stripping. ---------------------------------------------------------------------- djdjdjole · 2012-08-29 13:07 Didn't know for manual stripping - what command, but I will Google for it. First impression regarding Lazarus I installed is that is more, more unstable then Lazarus 1.1 (that I already had). Espetially related to designer and also to editor. Also some source code regarding class methods manipulation didn't work (in Delphi it does work). Maybe I'll try with Lazarus 1.0 if fpc 2.5.1 would compile it. Regards ---------------------------------------------------------------------- Leledumbo · 2012-08-29 15:02 QuoteDidn't know for manual stripping - what commandstrip -s (don't do on shared libs, for this you only need strip --strip-unneeded). ---------------------------------------------------------------------- djdjdjole · 2012-08-30 06:34 Command strip -s , when called from shell, says: Unable to recognize the format of the input file . Probably, because is not in the format for current distribution, but crosscompiled binary. Still, this file works on target. Files that I compiled with Lazarus1.1 were around 2.5Mb of size. ---------------------------------------------------------------------- Leledumbo · 2012-08-30 12:28 QuoteCommand strip -s , when called from shell, says: Unable to recognize the format of the input file . Probably, because is not in the format for current distribution, but crosscompiled binary.Ah yes, sorry. I forgot about that If you have arm-linux-strip you can use that ---------------------------------------------------------------------- djdjdjole · 2012-08-30 17:22 Many congratulations to you Leledumbo. I have arm-linux-strip that was generated during process of building root file system and it did the job. Now, executables are 2.5MB. Meanwhile I tried few more combinations (speaking of software versions) related to building Lazarus for crosscompilation process and later for building applications for ARM boards. What I described, earlier was the only combination that worked for me. I don't know if there exists some classification what combinations of compileres and Lazarus version can be used, and also to give satisfactory binaries for target ARM boards. However I doubt, because there are for example few different 2.5.1 source versions (different file sizes). ---------------------------------------------------------------------- djdjdjole · 2012-09-06 09:50 For those interested, a better combination that works OK iz 2.4.2 RPM package for starting FPC, then it compile FPC 2.6.0  sources and with it, Lazarus 1.0 can be compiled and later, generate valid ARM application. That was GTK, but regarding Qt, I have a question. After successful building of Qt application (i386) in Lazarus I intend to build linux root file system for my ARM board that will include Qt support. However, I don't know if I have to build root file system with X11 support also, in orther to create Qt applications, that intend to be build in Lazarus. I was told that there is no need for that and what is needed is to start Qt application with "-qws" option. It sounds strange to me, because in that case program shoud have to analyze what option is entered. My opinion is that such statement is valid only if I compile with QtCreator. Any help ? Regards ---------------------------------------------------------------------- zeljko · 2012-10-01 12:44 for embedded qtlcl you must use -dQTOPIA afair, but on my Nokia N9 I'm using qt as it is , since it have an X11 server running. ---------------------------------------------------------------------- djdjdjole · 2012-10-01 16:25 Thanks Zeljko, but as I don't know about dQTOPIA, can you point me at some articles/sites, where I can learn more. Once more, does it mean that I don't need X server in that case if I want to use Lazarus for programing ? Regards