Lazarus is a cross-platform IDE for Free Pascal. On Gentoo, the clean approach is to install Free Pascal, enable the proper Lazarus widgetset, and then rebuild if necessary for GTK or Qt depending on your desktop.
Since you are likely using a modern desktop such as KDE Plasma, the Qt widgetset often gives the most native look. GTK is also a perfectly valid choice.
Installing Lazarus on Gentoo typically pulls in the following core pieces:
Set your USE flags before emerging. This reduces rebuild churn and makes the initial install cleaner.
For a GTK build:
sudo mkdir -p /etc/portage/package.use printf "dev-lang/fpc source\n" | sudo tee -a /etc/portage/package.use/lazarus printf "dev-pascal/lazarus gtk\n" | sudo tee -a /etc/portage/package.use/lazarus
For a Qt build:
sudo mkdir -p /etc/portage/package.use printf "dev-lang/fpc source\n" | sudo tee -a /etc/portage/package.use/lazarus printf "dev-pascal/lazarus qt5\n" | sudo tee -a /etc/portage/package.use/lazarus
If your overlay/profile exposes qt6 for Lazarus and your system is already aligned for it,
you can replace qt5 with qt6. If it fails, go back to qt5.
Once the USE flags are in place, sync and install:
sudo emerge --sync sudo emerge --ask dev-lang/fpc dev-lang/fpc-source dev-pascal/lazarus
If you already have FPC installed, Portage will only add what is missing or rebuild what changed.
If emerge tells you that files in /etc/portage need updating, process them:
sudo etc-update
or, if you prefer:
sudo dispatch-conf
This matters because stale package.use, make.conf, or repository configuration can cause confusing follow-up errors.
After installation completes, start the IDE:
lazarus
You can also verify the command path:
which lazarus which lazbuild fpc -iV
On first launch, Lazarus may build some packages or ask about compiler paths. In most cases, the defaults are fine when installed through Portage.
If you are using KDE Plasma, rebuild Lazarus against Qt:
printf "dev-pascal/lazarus qt5 -gtk\n" | sudo tee /etc/portage/package.use/lazarus sudo emerge --ask --newuse dev-pascal/lazarus
If your system supports Qt6 for this package and you want to try it:
printf "dev-pascal/lazarus qt6 -gtk\n" | sudo tee /etc/portage/package.use/lazarus sudo emerge --ask --newuse dev-pascal/lazarus
If one widgetset fails, do not fight it for an hour. Switch to the other one and rebuild cleanly.
sudo emerge --ask dev-lang/fpc-source
Rebuild Lazarus after adjusting USE flags. Example for GTK:
printf "dev-pascal/lazarus gtk -qt5 -qt6\n" | sudo tee /etc/portage/package.use/lazarus sudo emerge --ask --newuse dev-pascal/lazarus
sudo emerge --ask --depclean sudo emerge --ask @world sudo emerge --ask dev-lang/fpc dev-lang/fpc-source dev-pascal/lazarus
Check these directly:
lazbuild --version fpc -i echo $PATH
Confirm your Gentoo profile, accepted keywords, and overlays are sane before chasing Lazarus-specific ghosts.
Run these checks:
lazarus --version || true lazbuild --version fpc -iV equery list dev-pascal/lazarus
If lazbuild and fpc both respond cleanly, the toolchain is generally in good shape.
Here is the straight-through install sequence:
sudo mkdir -p /etc/portage/package.use # GTK build printf "dev-lang/fpc source\n" | sudo tee -a /etc/portage/package.use/lazarus printf "dev-pascal/lazarus gtk\n" | sudo tee -a /etc/portage/package.use/lazarus # OR use Qt on Plasma # printf "dev-lang/fpc source\n" | sudo tee -a /etc/portage/package.use/lazarus # printf "dev-pascal/lazarus qt5\n" | sudo tee -a /etc/portage/package.use/lazarus sudo emerge --sync sudo emerge --ask dev-lang/fpc dev-lang/fpc-source dev-pascal/lazarus sudo etc-update which lazarus which lazbuild fpc -iV lazarus