Recent

Author Topic: FPCUp cleanup & minimal build  (Read 4050 times)

Warfley

  • Hero Member
  • *****
  • Posts: 1499
FPCUp cleanup & minimal build
« on: July 14, 2020, 09:20:37 pm »
Hey, so I am using FPCUp to build FPC+Crosscompilers and Lazarus for a docker image. Now it works pretty well, but I run into another problem, the installation gets huge:

Code: Bash  [Select][+][-]
  1. root@4907722d13a2:/# du -hs root/development/*
  2. 68K     root/development/config_lazarus
  3. 827M    root/development/fpc
  4. 3.2M    root/development/fpcbootstrap
  5. 969M    root/development/lazarus
  6. 4.0K    root/development/projects
This is just after the base installation without any cross compilers and it already takes up 1.8 GB. With the cross compilers for Win32 and Win64, another 400mb is added, resulting in a stagaring 3GB Docker image.

There must be a way to reduce that size. When I download the OpenSuse RPM package for Lazarus and FPC they are in sum around 100 mb large, so I'm off by a factor of 18.
That said, I don't even need complete lazarus, I only need the LCL and lazbuild, but I am to stupid to find out how to tell fpcup this.

Another thing I thought is, after compiling there sure are compilation artifacts I don't need anymore, as well as the the (fpc) source, is also unessecary (as it is for docker, I don't need lazarus completion feature and stuff so I don't need these sources).

Does anyone of you know how I can clean up the Lazbuild installation, and/or minimize it?

This is the script that installs Lazarus and FPC, pretty naive and uses only very few arguments for FPCUp
Code: Bash  [Select][+][-]
  1. function build() {
  2.     fpcup --noconfirm --fpcURL=$FPC --lazURL=$LAZ $@
  3. }
  4. function buildCross() {
  5.     cpu="$1"
  6.     shift
  7.     os="$1"
  8.     shift
  9.     build --only=FPCBuildOnly --cputarget=$cpu --ostarget=$os $@
  10. }
  11.  
  12. # Install fpc and lazars for linux x86_64
  13. build
  14. # Install cross-compiler for Win32
  15. buildCross i386 win32
  16. # Install cross-compiler for win64
  17. buildCross x86_64 win64

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: FPCUp cleanup & minimal build
« Reply #1 on: July 14, 2020, 10:24:13 pm »
Interesting question.
Part of your quest can already be done by fpcup, with the correct settings.
But not all. Will look into this.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: FPCUp cleanup & minimal build
« Reply #2 on: July 14, 2020, 11:04:01 pm »
Deleting units/$fpctarget/googleapi  saves 100M per target.

These are auto generated headers for google apis.

Warfley

  • Hero Member
  • *****
  • Posts: 1499
Re: FPCUp cleanup & minimal build
« Reply #3 on: July 15, 2020, 03:16:40 pm »
Deleting units/$fpctarget/googleapi  saves 100M per target.
Not quite 100 MB, for 3 targets it saved around 200 mb. That said, 200M less :)

Interesting question.
Part of your quest can already be done by fpcup, with the correct settings.
But not all. Will look into this.
Any suggestions for the options to use? I am to stupid for fpcup. I tried --only=FPCBuildOnly,lazbuild but it then I get:
Quote
fpclazup: info: FPCNativeInstaller (BuildModule: FPC): Building module FPC...
fpclazup: ERROR: FPCNativeInstaller (BuildModule: FPC): /root/development/fpc/Makefile not found. Severe error. Should not happen. Aborting.
So I am missing something and I don't know what. So I thought I go the other route with --skip=bigide but now I still have too much, as this doesnt save much (not even 100 m)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: FPCUp cleanup & minimal build
« Reply #4 on: July 15, 2020, 03:34:51 pm »
Quote
--only=FPCBuildOnly,lazbuild
This should work. But does not work (not implemented yet). So, needs some fpcup-changes !

Summary.
You need to build FPC and Lazarus from sources (by running make) and let the Makefile install the result in some other directory.
However. Due to your question and me trying to solve, this was needed.
https://bugs.freepascal.org/view.php?id=37356
As the Lazarus devs are very very helpful, this was solved in mere moments !

More changes are needed. But, at the moment, I am trying to solve this through fpcup.

 

TinyPortal © 2005-2018