Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-01

Building GUI program for RPi1 on RPi2?

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

I have a development system running on a Raspberry Pi2B with fpc 3.0.0 and Lazarus 1.6RC2. It works just fine. :)

Today I am faced with a problem regarding compatibility between RPi1 and RPi2...

I have this Delphi program I wrote some years ago which is used to show a text dialog on a TV for my mother-in-law. She is deaf and bed-bound and to communicate with her I wrote the program so it could display a huge text on an attached TV so she can read what one types in.
Now the XP computer it was running on is dead and I have an old RPi1B with 256M RAM, which I could put in its place.

I used Lazarus conversion tool to bring in the Delphi7 project to my Pi2B and it compiled and ran fine. Success here!

So the question really is if I have to do something in the configuration of the project to create an executable which will run on the RPi1 hardware?
The fpc compiler I have is built using the OPT=-dFPC_ARMHF flag.

Will this cause executables compiled in Lazarus to only be working in an RPi2??

Bo Berglund Developer in Sweden

Reply by email

Michael Ring
to Bo Berglund

You will need to create code for armv6, Pi2B is armv7

The easiest way is most propably to install freepascal on the old RPi1B and to compile the code there. Either use apt-get or search for a fpc 3.0 version that is compiled for this device.

Another alternative could be to build another version of freepascal on your raspi2 that supports armv6.

make all OPT="-dFPC_ARMHF -CpARMV6 -OpARMV6"

You'd have to look up one of the numerous tutorials on building fpc 3.0 on Raspbery Pi if this build does not work out of the box.

Michael

Bo Berglund wrote 26 lines
I have a development system running on a Raspberry Pi2B with fpc 3.0.0 and Lazarus 1.6RC2. It works just fine. :) Today I am faced with a problem regarding compatibility between RPi1 and RPi2... I have this Delphi program I wrote some years ago which is used to show a text dialog on a TV for my mother-in-law. She is deaf and bed-bound and to communicate with her I wrote the program so it could display a huge text on an attached TV so she can read what one types in. Now the XP computer it was running on is dead and I have an old RPi1B with 256M RAM, which I could put in its place. I used Lazarus conversion tool to bring in the Delphi7 project to my Pi2B and it compiled and ran fine. Success here! So the question really is if I have to do something in the configuration of the project to create an executable which will run on the RPi1 hardware? The fpc compiler I have is built using the OPT=-dFPC_ARMHF flag. Will this cause executables compiled in Lazarus to only be working in an RPi2??

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160116/afb01c90/attachment.html>

Reply by email

Mark Morgan Lloyd
to Bo Berglund: I have a development system running on a Raspberry Pi2B with fpc 3.0.0 and Lazarus…
Bo Berglund wrote 24 lines
I have a development system running on a Raspberry Pi2B with fpc 3.0.0 and Lazarus 1.6RC2. It works just fine. :) Today I am faced with a problem regarding compatibility between RPi1 and RPi2... I have this Delphi program I wrote some years ago which is used to show a text dialog on a TV for my mother-in-law. She is deaf and bed-bound and to communicate with her I wrote the program so it could display a huge text on an attached TV so she can read what one types in. Now the XP computer it was running on is dead and I have an old RPi1B with 256M RAM, which I could put in its place. I used Lazarus conversion tool to bring in the Delphi7 project to my Pi2B and it compiled and ran fine. Success here! So the question really is if I have to do something in the configuration of the project to create an executable which will run on the RPi1 hardware? The fpc compiler I have is built using the OPT=-dFPC_ARMHF flag. Will this cause executables compiled in Lazarus to only be working in an RPi2??

I've seen no binary compatibility issues yet.

The one thing I would say is that I put a lot of time late last year into getting an RPi+Raspbian working with a large LCD TV as an HDMI-connected monitor for a colleague with poor sight, and found that support of higher resolutions etc. was vastly improved with the RPi2. The one thing that didn't work properly was the protocol that simulated a remote control, but I've not checked that recently.

So in my opinion using an older RPi is a false economy here.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Bo Berglund
to Michael Ring: You will need to create code for armv6, Pi2B is armv7 The easiest way is most propably to…
Michael Ring wrote
You will need to create code for armv6, Pi2B is armv7

I tried by copying the program file to my new RaspbianJessie on the RPi1B and running it, but it threw exceptions...

So I have installed the seed fpc compiler 2.6.4 on the Pi1B now and am checking out the sources for Lazarus 1.4.4 now.

Will build lazarus 1.4.4 using the seed compiler and then build the program itself. It is just one form with an edit area to write text. Hopefully this will work without fpc 3.0.0

(Provided I can build Lazarus 1.4.4 of course, since I don't know how to build a GUI application using just fpc.)

Bo Berglund Developer in Sweden

Reply by email

Mehmet Erol Sanliturk
to Bo Berglund
Bo Berglund wrote 26 lines
On Sat, 16 Jan 2016 12:14:05 +0100, Michael Ring wrote: >You will need to create code for armv6, Pi2B is armv7 > I tried by copying the program file to my new RaspbianJessie on the RPi1B and running it, but it threw exceptions... So I have installed the seed fpc compiler 2.6.4 on the Pi1B now and am checking out the sources for Lazarus 1.4.4 now. Will build lazarus 1.4.4 using the seed compiler and then build the program itself. It is just one form with an edit area to write text. Hopefully this will work without fpc 3.0.0 (Provided I can build Lazarus 1.4.4 of course, since I don't know how to build a GUI application using just fpc.) -- Bo Berglund Developer in Sweden --

In your compilation directory , in fpc.cfg , include all necessary LCL unit and related include directories .
If you compile a *.lpr with fpc , it will produce a GUI program .

Mehmet Erol Sanliturk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160116/a627b3f4/attachment.html>

Reply by email

Bo Berglund
to Mehmet Erol Sanliturk
Mehmet Erol Sanliturk wrote 15 lines
> So I have installed the seed fpc compiler 2.6.4 on the Pi1B now and am > checking out the sources for Lazarus 1.4.4 now. > > Will build lazarus 1.4.4 using the seed compiler and then build the > program itself. It is just one form with an edit area to write text. > Hopefully this will work without fpc 3.0.0 > > (Provided I can build Lazarus 1.4.4 of course, since I don't know how > to build a GUI application using just fpc.) In your compilation directory , in fpc.cfg , include all necessary LCL unit and related include directories . If you compile a *.lpr with fpc , it will produce a GUI program .

Thanks for your suggestion.
Meanwhile I have tried to build Lazarus 1.4.4 using the seed compiler 2.6.4 but it always quits with a link error.
I also tried to repeat the method I used on the RPi2 to compile fpc 3.0.0 but the same thing happens after about 7 minutes.

So I would like to compile my program without lazarus as you suggest can be done.

But you say that I should edit the fpc.conf file in the compilation directory, I assume you mean my project directory, right?

The problem is that there is no such file in my project dir on the RPi2 and I also do not know what to put into the file if I create one from scratch...

Could you give an example on how such a file would look? This is probably my last chance of getting this done.....

(I have never compiled anything manually from the command line)

Bo Berglund Developer in Sweden

Reply by email

Mehmet Erol Sanliturk
to Bo Berglund
Bo Berglund wrote 50 lines
On Sat, 16 Jan 2016 12:17:59 -0800, Mehmet Erol Sanliturk wrote: >> So I have installed the seed fpc compiler 2.6.4 on the Pi1B now and am >> checking out the sources for Lazarus 1.4.4 now. >> >> Will build lazarus 1.4.4 using the seed compiler and then build the >> program itself. It is just one form with an edit area to write text. >> Hopefully this will work without fpc 3.0.0 >> >> (Provided I can build Lazarus 1.4.4 of course, since I don't know how >> to build a GUI application using just fpc.) > >In your compilation directory , in fpc.cfg , include all necessary LCL unit >and related include directories . >If you compile a *.lpr with fpc , it will produce a GUI program . > > Thanks for your suggestion. Meanwhile I have tried to build Lazarus 1.4.4 using the seed compiler 2.6.4 but it always quits with a link error. I also tried to repeat the method I used on the RPi2 to compile fpc 3.0.0 but the same thing happens after about 7 minutes. So I would like to compile my program without lazarus as you suggest can be done. But you say that I should edit the fpc.conf file in the compilation directory, I assume you mean my project directory, right? The problem is that there is no such file in my project dir on the RPi2 and I also do not know what to put into the file if I create one from scratch... Could you give an example on how such a file would look? This is probably my last chance of getting this done..... (I have never compiled anything manually from the command line) -- Bo Berglund Developer in Sweden -- _______________________________________________

The following is a sample fpc.cfg to compile a GUI program with fpc ( used in Windows ) :

-------------------------------------------------------------------

#
# Config file generated by fpcmkcfg on 12/5/2009 - 0:37:50 # 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 #

-dNORMAL
-uDEBUG
-uRELEASE

-dDELPHI
; -dVER130
; -dVER2_2

# 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
-glh
-Crtoi
#WRITE Compiling Debug Version
#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> compiler stops after the <x> errors (default is 1) # -Sg allow LABEL and GOTO
# -Sh Use ansistrings
# -Si support C++ styled INLINE
# -SI<x> set interface style to <x>
# -SIcomCOM compatible interface (default) # -SIcorbaCORBA 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) # -St allow static keyword in objects
#
# 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 for i386 compiler
# -Os generate smaller code
# -O1 level 1 optimizations (quick optimizations) # -O2 level 2 optimizations (-O1 + slower optimizations) # -O3 level 3 optimizations (same as -O2u)
# -Oa=N set alignment to N
# -OoX switch on optimalization X.
# -OoNOX switch off optimalization X.
# X is one of REGVAR UNCERTAIN STACKFRAME PEEPHOLE ASMCSE LOOPUNROLL
# -OpCPU set target processor.
# CPU is one of 386, PENTIUM, PENTIUM2, PENTIUM3, PENTIUM4, PENTIUMM

# -----------------------
# 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
#-FrC:/lazarus/fpc/2.6.2/msg/errore.msg
#-FrC:/lazarus/fpc/2.6.2/msg/errorn.msg
#-FrC:/lazarus/fpc/2.6.2/msg/errores.msg
#-FrC:/lazarus/fpc/2.6.2/msg/errord.msg
#-FrC:/lazarus/fpc/2.6.2/msg/errorr.msg

# path to the gcclib

# searchpath for includefiles
#-Fi/pp/inc;/pp/rtl/inc

# searchpath for includefiles
# release them only if you know what you do
# because this could cause a rebuild of the runtime library # if you tell them compiler/ide to build the project (FK) #-FiC:/lazarus/fpc/2.6.2/source/rtl/inc;C:/lazarus/fpc/2.6.2/source/rtl/i386

# searchpath for objectfiles
#-FoC:/lazarus/fpc/2.6.2/source/rtl/inc;C:/lazarus/fpc/2.6.2/source/rtl/i386

# Instead of Lazarus Windows directories , use your operating system Lazarus directories .....
# For example :
# -Fu/usr/lib64/lazarus/lcl/units/x86_64-linux/

#IFDEF FPCAPACHE_1_13
-FuC:/lazarus/fpc/2.6.2/units/$FPCTARGET/httpd-1.3/ #ELSE
#IFDEF FPCAPACHE_2_0
-FuC:/lazarus/fpc/2.6.2/units/$FPCTARGET/httpd-2.0 #ELSE
-FuC:/lazarus/fpc/2.6.2/units/$FPCTARGET/httpd-2.2 #ENDIF
#ENDIF

# searchpath for units and other system dependent things

-FuC:/lazarus/fpc/2.6.2/units/$FPCTARGET/
-FuC:/lazarus/fpc/2.6.2/units/$FPCTARGET/*
-FuC:/lazarus/fpc/2.6.2/units/$FPCTARGET/rtl

-dLCL

-dWin32
-FuC:\LAZARUS\components\lazutils\lib\i386-win32\
-FuC:\LAZARUS\lcl\units\i386-win32\win32\
-FuC:\LAZARUS\lcl\units\i386-win32\

# searchpath for libraries

#-Fl/lib;/usr/lib

# searchpath for tools
-FDC:/lazarus/fpc/2.6.2/bin/$FPCTARGET

# binutils prefix for cross compiling
#IFDEF FPC_CROSSCOMPILING
-XP$FPCTARGET-
#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 m : Show_ defined_ macros # i : Show_ general info p : Show_ compiled_ procedures_ # l : Show_ line_ numbers_ c : Show_ conditionals_ # a : Show_ everything 0 : Show_ nothing ( except errors_ )
# b : Show_ all procedures_ r : Rhide/GCC compatibility mode_ # declarations if an error x : Executable info (Win32 only) # occurs
#
# Display Info, Warnings, Notes and Hints

-viwnqb

# If you don't want so much verbosity use
#-vw

#IFDEF NORMAL

-TWin32
-Sg
-Si
-Se1048576
# -Mfpc
# -Mobjfpc
-Mdelphi

-Ooregvar
-O1
-Os
-OpPENTIUM
-Rintel
; -dNORMAL
; -dDELPHI
; -dVER130
# -gl

-g-
-p-
-b-

-uCONSOLE

; -uLIST_INCLUDED_FILES

#ENDIF

#IFDEF DEBUG
-TWin32
-Sg
-Si
-Sa
-Se10000
# -Mobjfpc
-Mdelphi
-Cr
-Ci
-Co
-CR
-Os
-OpPENTIUM
-Rintel
-gl
-p-
-b-
#ENDIF

#IFDEF RELEASE
-TWin32
-Sg
-Si
# -Mobjfpc
-Mdelphi
-CX
-Ooregvar
-O2
-Os
-OpPENTIUM
-Rintel
-XX
-Xs
-g-
-p-
-b-
#ENDIF

# Here , put your

# -Fi .....

# and

# -Fu .....
# -FU .....

# directories for your program *.lpr .....

-------------------------------------------------------------------

Copy /etc/fpc.cfg to your compilation directory to start from it .

If you do not use fpc from Lazarus installation , during compile , it may attempt to compile Lazarus units . In that case , install Lazarus into your home directory and , instead of using root installed Lazarus ( system-wide ) directories , use your local Lazarus directories to allow compilation of Lazarus units .

OR use fpc from Lazarus installation .

By using trial and error , you will be able to compile your *.lpr .

To write fpc command line compilation parameters , it may be sufficient to use

fpc -help

or

Read

http://www.freepascal.org/docs-html/prog/prog.html http://www.freepascal.org/docs-html/user/user.html

Mehmet Erol Sanliturk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160116/c6b71956/attachment-0001.html>

Reply by email

Bo Berglund
to Mark Morgan Lloyd: I've seen no binary compatibility issues yet. The one thing I would say is that I put a…
Mark Morgan Lloyd wrote
So in my opinion using an older RPi is a false economy here.

You are absolutely correct!

I bit the bullet today and bought an RPi2B instead and within short I was in business with the already compiled program running well and I could concentrate on the fine details like disabling the screen saver and such.
Now we are heading out to the care home where my mother-in-law spends her last time with a working text communication device. No more Windows....

Bo Berglund Developer in Sweden

Reply by email