[fpc-pascal] How to handle fpc.cfg on Ubuntu with 3.0.4 and 3.2.0 co-existing?

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Sat Feb 6 02:15:46 CET 2021


On 05/02/2021 11:18 pm, Bo Berglund via fpc-pascal wrote:
> Can they share the same fpc.cfg file (or rather .fpc.cfg)?

Yes, I've been doing so for probably the last 10 years. I have
7 different FPC versions installed on my system - all working together.

The trick is to have paths as follows in you ~/.fpc.cfg file:

=====================
# searchpath for units and other system dependent things
-Fu/data/devel/fpc-$fpcversion/$fpctarget/lib/fpc/$fpcversion/units/$fpctarget
-Fu/data/devel/fpc-$fpcversion/$fpctarget/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/data/devel/fpc-$fpcversion/$fpctarget/lib/fpc/$fpcversion/units/$fpctarget/rtl

# searchpath for fppkg user-specific packages
-Fu~/.fppkg/lib/fpc/$fpcversion/units/$FPCTARGET/*

# searchpath for libraries
-Fl/data/devel/fpc-$fpcversion/$fpctarget/lib/fpc/$fpcversion/units/$fpctarget
-Fl/lib;/usr/lib;/usr/local/lib

# Path to fpc utility applications like fpcres
-FD/data/devel/fpc-$fpcversion/$fpctarget/bin/
=====================

I'm happy to send you a full copy of my ~/.fpc.cfg file if that will help.

And as you can see from my paths above, all my FPC version are all installed
under the /data/devel/* path and looks like this:

=====================
/data/devel/fpc-2.6.4
            ├── src/
            ├── x86_64-freebsd/
            └── x86_64-linux/
/data/devel/fpc-3.0.0
            ├── go.sh*
            ├── src/
            ├── x86_64-freebsd/
            └── x86_64-linux/
/data/devel/fpc-3.0.2
            ├── go.sh*
            ├── src/
            ├── x86_64-freebsd/
            └── x86_64-linux/
/data/devel/fpc-3.0.4
            ├── go.sh*
            ├── src/
            ├── x86_64-freebsd/
            └── x86_64-linux/
/data/devel/fpc-3.2.0
            ├── go.sh*
            ├── src/
            ├── x86_64-freebsd/
            └── x86_64-linux/
/data/devel/fpc-3.2.1
            ├── go.sh*
            ├── src/
            └── x86_64-linux/
/data/devel/fpc-3.3.1
            ├── go-arduino.sh*
            ├── go-freebsd.sh*
            ├── go.sh*
            ├── src/
            └── x86_64-linux/

=====================


The "go.sh" files you see are to compile the desired FPC version with the
previous stable FPC version, and install it into the correct location.

=============[ example go.sh ]===============
#!/bin/sh

TARGET_VER=3.2.0
TARGET=x86_64-linux
COMPILER=/data/devel/fpc-3.0.4/$TARGET/bin/ppcx64

cd src

make clean
make all FPC=$COMPILER OPT="-Fl/usr/local/lib"
make install INSTALL_PREFIX=/data/devel/fpc-$TARGET_VER/$TARGET FPC=/data/devel/fpc-$TARGET_VER/src/compiler/ppcx64
=============================================

I use this same setup in my Windows VMs too, when I need to support multiple
FPC versions.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


More information about the fpc-pascal mailing list