Saturday, September 17, 2016

Install FPC 3.1.1 + lazarus 1.7 on RASPBERRY PI 3 /RASPBIAN)

How to install latest FPC + LAZARUS on RASPBERRY PI 3 Step by step (thanks to rvk member of lazarus community)

# ======================================================
# Based on clean 2016-05-27-raspbian-jessie.img
# Total install time: 38 minutes (from complete scratch)
# by rvk (v.1.1, 2016-07-08)
# ======================================================

# ======================================================
# first some essentials (5.5 minutes)
# ======================================================
sudo -i
apt-get update
apt-get upgrade -y
apt-get autoremove
apt-get autoclean

# ======================================================
# install remote descktop serveer for rdp session win10
# only neede is headless RPI (1 minute)
# ======================================================
sudo apt-get -y install xrdp
sudo nano /etc/xrdp/xrdp.ini
bitmap_compression: no   # <-- change this line

# ======================================================
# some other essentials (2 minutes)
# ======================================================
sudo apt-get -y install build-essential p7zip-full subversion
sudo apt-get -y install libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev lpango-1.0 libpangox-1.0-dev xorg-dev libatk1.0-dev libgtk2.0-dev

# ======================================================
# we NEED to extend the swapfile (1 minute)
# ======================================================
sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=512   # <-- change this line
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start

# ======================================================
# if you're not on raspbian-jessie this could work too
# ======================================================
# dd if=/dev/zero of=/path/to/swapfile bs=1M count=512 # For 512MB swap file
# mkswap /path/to/swapfile
# swapon /path/to/swapfile

# ======================================================
# install fpc and lazarus trunk (total 28.5 minutes)
# ======================================================
sudo -i

# ------------------------------------------------------
# first fpc
# ------------------------------------------------------
mkdir /usr/local/fpc
cd /usr/local/fpc

# ------------------------------------------------------
# We need a bootstrap compiler fpc 3.0.0 (2.5 minutes)
# There is NONE AVAILABLE so we need to download complete
# fpc-3.0.0.arm-linux-raspberry1wq.tar
# ------------------------------------------------------
tar xvf fpc-3.0.0.arm-linux-raspberry1wq.tar
cd fpc-3.0.0.arm-linux
tar xvf binary.arm-linux.tar
tar zxvf base.arm-linux.tar.gz
cd ..

# ------------------------------------------------------
# checkout fpc trunk (3 minutes)
# ------------------------------------------------------
svn co trunk
svn export --force trunk trunktmp
cd trunktmp

# ------------------------------------------------------
# compile fpc trunk (11 minutes)
# ------------------------------------------------------
make all OPT="-dFPC_ARMHF" PP=/usr/local/fpc/fpc-3.0.0.arm-linux/lib/fpc/3.0.0/ppcarm

# ------------------------------------------------------
# install fpc trunk (2 minutes)
# ------------------------------------------------------
make install OPT="-dFPC_ARMHF" PREFIX=/usr/local PP=/usr/local/fpc/trunktmp/compiler/ppcarm
rm /usr/local/bin/ppcarm
rm /usr/local/bin/sameplecfg
ln -sf /usr/local/lib/fpc/3.1.1/ppcarm /usr/local/bin/ppcarm
ln -sf /usr/local/lib/fpc/3.1.1/samplecfg /usr/local/bin/samplecfg
make install sourceinstall OPT="-dFPC_ARMHF" PREFIX=/usr/local
rm /usr/share/fpcsrc
ln -sf /usr/local/share/src/fpc-3.1.1/fpc /usr/share/fpcsrc

# /usr/local/bin/fpcmkcfg -d basepath=/usr/local/lib/fpc/3.1.1 -o /usr/local/bin/fpc.cfg
# this doesn't seem to work correctly ???

samplecfg /usr/local/lib/fpc/3.1.1 /etc
# Running on linux
# Write permission in /etc.
# Writing sample configuration file to /etc/fpc.cfg
# Writing sample configuration file to /usr/local/lib/fpc/3.1.1/ide/text/fp.cfg
# Writing sample configuration file to /usr/local/lib/fpc/3.1.1/ide/text/fp.ini
# Writing sample configuration file to /etc/fppkg.cfg
# Writing sample configuration file to /etc/fppkg/default

# ------------------------------------------------------
# then Lazarus
# ------------------------------------------------------
mkdir /usr/local/lazarus
cd /usr/local/lazarus

# ------------------------------------------------------
# checkout lazarus trunk (1.5 minutes)
# ------------------------------------------------------
svn co trunk
svn export --force trunk trunktmp
cd trunktmp

# ------------------------------------------------------
# compile lazarus trunk  (6.5 minutes)
# ------------------------------------------------------
make all OPT="-dFPC_ARMHF"

# ------------------------------------------------------
# install lazarus trunk  (2 minutes)
# ------------------------------------------------------
make install OPT="-dFPC_ARMHF" PREFIX=/usr/local

# ------------------------------------------------------
# remove menu-cache to make Lazarus visible in menu
# ------------------------------------------------------
exit  # from sudo
killall lxpanel
find ~/.cache/menus -name '*' -type f -print0 | xargs -0 rm
exit  # from pi

# ------------------------------------------------------
# connect on Windows via Remote Desktop Connecton (mstsc.exe)
# user pi password rapberry
# Menu > Programming > Lazarus
# create small test-project and run
# ------------------------------------------------------

# ======================================================
# note: recompiling lazarus as use pi
# will create a working copy under ~/.lazarus/bin
# ======================================================


Saturday, July 4, 2015

Codetyphon 5.3 and Remobjects 8.3 : installation instructions

While i love to work on delphi side its lack support for some IOTs devices like raspberry PI, Beaglebone, and Linux mainly.

You have two options sit and wait for Embarcadero managers take the decision and release the long waited linux compiler (10 years of wait i think) or get dirty and try Lazarus.

Lazarus/typhon need to link statically all the packages you install and is very *sensitive* . The result a perfect compiled package will produce many times your typhon exe get corrupted and you need to start the process from zero.

Note from Sternas : 'If you try to rebuild experimental IDE, my suggestion is to save bin32/typhon.exe or bin64/typhon.exe first. If the new typhon.exe has problem replace it with backup typhon.exe'. Thanks for this easy tip! :)

After a lot of try and error process, here a guarantee (?)  procedure to install RO 8 on CT 5.3

If you already have a Typhon fide working start over on Codetyphone menu *Remove and Build Typhon BigIDE*.

Then open and compile every RO package ending with _ CodeTyphon   . Don't install!

Some packages reference RO standard packages (no CodeTyphon) just replace with the appropriate Codetyphon package version and compile.

On you need to disable RemObjects_UseEncryption adding a dot at first
or Remojtecs_Core will not compile.

{.$DEFINE RemObjects_UseEncryption}

If you plan to use Pascalscript just download from GITHUB site.

And copy the Add-on folder to


Remember to change missing packages with Codetyphon packages.

One time all is compiled restart the idea and go to Install Packages. Add all the RO/DA packages at one time.

Save and rebuild IDE.

Work done. You have RO/Da working on CT 5.3.


Monday, December 23, 2013

My still not working stable enough, FireMonkey app.

In my previous post i comment about a recent app my company release.

This one is just a simple app in kiosk mode with a few screens, not very impressive if just ask.

The detail is this one have to consume a web services. The web services is implemented with Delphi using RemObjects library.

As i say before, i code and deliver this time using Oxygene because the Firemonkey pair app auto close alone after 2 to 3 hours working. No error, no chance to debug, no way to fix this.

In my last post i advice about have no time to test with XE5 update 2. So, just for the shake i test my FM app with update 2 and sadly, the results are the same. And i must add, now the process to debug seems a little more bad working than before.

I love to ear anybody else experiences with real world app and fire monkey. I see a few videos , one very impressive about capturing video on real time. The main point to me is stability and seems like Embarcadero is working there. Can we cross fingers for the next release?

In any case , in the meantime, i have to start another android project very complex and i believe cannot start with XE5 at this stage. It will be Oxygene 100%. The bad part is the UI design, but, again, Oxygene is a very pleasant tool to code.
I really hope XE6(?) give me the confidence im lost in FireMonkey.

If anybody have another experiences about this, im open.


Wednesday, December 11, 2013

My first real world Android app, coded in pascal.

I want to share my experience building a very simple android app.

My app have  3 screens, main screen, data screen and configuration screen. That just connect to a RO Server build with delphi and working ver well from some like 5 years i think.

I have to make a design decision. What to use? I have an familiar tool with so many minor changes i can do a app in hours, and on the other hand i have Oxygene , a good tool, but requiring a *lot* of knowledge of java and android secrets.

You can easy understand my smart decision was Delphi.

So, i start.

Design the UI was easy, very easy. In a few hours i have all the UI and basic behavior. get some bugs here and there, but my app was working. That was impressive and was very happy to have a android app working without know ANYTHING from Android!

Then i need it to connect to my delphi server. The main problem was the lack of support from RO to delphi mobile.

I must use SOAP for this. After a few problems, solved for RO stuff, i get running.

Ok, time to test! The app start to have some bugs, exit without message, crashed here and there... I can´t get it working more than 2 hours on my tests.

I try everything to simplify even more the app, use threads to be sure is not overload, lets figure, whatever you can imagine. No luck. Always goes out with errors related to canvas, graphics, etc, the most part of the time.

What to do? My app must run in kiosk mode 24x7, i can't release some unstable. Cant find a solution there, always close with signal 11, invalid pointer operation, or canvas error.

Ok, lets try to do some, not at the same quality, i think, but running to test Oxygene stability.

My app was ready on 2 days, and do all the stuff i need. I have running it from years, stress test, and the result was a super stable app, connecting using standard RO channels, reboot if it don't find the server at a stipulated time, and have 150 Kb (vs 15 mb on Delphi)

My  conclusion:

The process of working on Oxygene was amazing. I have a lot of prejudices before start. The need to know java an android by example, but the reality is code completion, gendarme and oxidizer do the most part of the work and all the android related questions where there to be solved with a simple google search.
Same for the UI, i find my working quick and easy to adjust my UI using external editors and adjusting XML by hand when needed. Even at the last time, i don't use editors and add some controls by hand.

Im a delphi lover, i love delphi and i was a delphi lover for years. Everybody here knows it, i even be very contrary to the idea coming from RO to not support delphi mobile, and feel that as a betray.

Now i must say FM is not ready yet , and even when it will be ready if some day happens, is a very different option ( i don't want to say inferior) than that Oxygene offer. Now i understand why mh complains a lot about what FM have to offer and why the better way to go is Oxygene.

I hope not lost my friends of the delphi Community but i always be honest and i don't plan to stop being honest now.

Is great to have bot options and maybe in a next release Delphi will be ready to a cooler experience.


Disclaimer: I can't test XE5 update 2, because it ruins my XE5 install. Im downloading the iso and will try with a fresh install.

Friday, December 6, 2013

Using GExperts to comment code with date, time and author

I am a happy user of GExperts . From my beginnings in Delphi consider it more a part of the IDE , irreplaceable for its flexibility , speed and how many tasks easier to perform daily.

Luckily I have already migrated to Delphi XE5 and despite being in an experimental version I've used without problems since.

One of the virtues of this package is the ability to add date and time code . this time I want to give a little tip that I find to also add an automatic comment that includes better detail the moment of change , the author and let us start writing a detailed after insertion.

First , we access GExperts settings.


Select the option to add date and wrote this


Enclosed in quotation marks I have placed the literal text and want to appear in my code and have added a date format option with hour minutes and seconds.

Then add my initials and finalize an arrow that makes reading the subsequent comments .

Then save the changes and at the press anywhere in the editor Ctrl + Alt + code To get this:


leaving the cursor at the right point to start writing the comment

An important detail is that eventually the line if they return the edited down to the next line but even with activated comment (this is because we put 3 slash /// . Whether they produce this effect is placed just 2 slash // .


Thursday, March 7, 2013

Embarcadero DROPS Anydac support Delphi XE also.

With all that noise on the line, we forget to comment this detail: you can't use FireDac on previous delphi version. The only version supported is Delphi XE3.

Several questions come to my mind.

For wich reason a company drop support not only to others pascal compilers , supossing they are a real competence, but to all delphi customers having previous delphi versions?

How can this not bring money to EMB? Why a Delphi 2010 or Delphi XE2 user CAN'T buy Firedac?

And what STOP THEM to do the same limitation on next versions and force us to buy the latest delphi IDE to continue using Firedac?

EDIT/UPDATE: As all you already knows, EMB put reverse to this and now support previous compiler. Congrats EMB.

Friday, March 1, 2013

Embarcadero DROPS Anydac support for Linux

Embarcadero buy Anydac company and transform to Firedac product. They promise two weeks ago to ENHANCE this libraries, Dmirty Areiev (former anydac developer) also promise that. Great news right?

The bad news are old anydac customers, you lost! Fpc/Lazarus users you lost too! You have a linux server working with anydac? Sorry: Game over!

Sorry folks, I'm really shocked for that. We invested a lot of time on make anydac work for linux and nobody care, and nobody will pay for this.

Edit: You just can work with the old code from any dad, the future releases probably work, probably don't. your mileage can vary.