Recent

Author Topic: Configuration  (Read 1369 times)

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Configuration
« on: July 05, 2022, 08:53:28 am »
I made two Git repositories and (think) I succeeded in compiling both fpc and Lazarus. Lazarus is easy. But I have multiple installs and I couldn't get it to work (ie. it used all the files from a previous install). After deleting them, Lazarus couldn't find System.ppu. Yes, that was a fpc.cfg that was copied from a previous install as well. And there's no notion that I could find where the Lazarus config files reside, or how they're called. Or what relates to the bootstrap compiler and tools, what goes with the sources and what should go into the location you want the new install.

So, it took me about a day, by googling and trying (pieces of) examples without a definition of what it all does. And I still don't know, I just deleted all the old stuff I could find and tried to come up with a batch file that does the right things in the right sequence. Which takes about 15 minutes each time.

So, where is the documentation I missed that explains it all?

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Configuration
« Reply #1 on: July 05, 2022, 11:22:59 am »
How do I enable debugging the fpc packages and how do I include FPDebug?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Configuration
« Reply #2 on: July 05, 2022, 01:18:49 pm »
Linux? Windows?

You can build fpc with
Code: Bash  [Select][+][-]
  1. make  OPT="-gw -godwarsets"
or
Code: Bash  [Select][+][-]
  1. make  OPT="-gw3"

Mind, I have encountered some issues, when linking my code against a dwarf-3 (gw3) build of the rtl....
=> However, on Linux the dwarf version of the rtl will affect your overall debugging.
E.g. with Dwarf-2 AnsiStrings are indistinguishable from PChar. And if the rtl is dwarf-2 then that goes for the entire project.


Obviously you don't want to keep rebuilding fpc, so you need individual installs.

On Windows that is easy => each install keeps entirely to its own directory

On Linux
Either use FpcUpDeluxe.... The should have some way, but I am not sure how exactly to use more than one install of fpcupdeluxe.... Research it before you do...
Or...

1) Make sure you have no global fpc.cfg => not in /etc/  - not in your home folder.
You can check  "fpc -va dummy.pas" will show you where it searches for an fpc.cfg

2) The below works for me. It's a bit of a hack though....
I use the "def" for no-options-of-my-own / Then for a -gw build I use "gw" ..
So I get a folder structure
~/fpc/3.2.2/def
~/fpc/3.2.2/gw
~/fpc/3.2.2/o4
~/fpc/3.3.1/gw
...

You can make INSTPATH and INSTVERS the same, but INSTVERS must be in the given format, and match the version.

Code: Bash  [Select][+][-]
  1. INSTPATH=rel_3_2_2
  2. INSTVERS=3.2.2
  3. make all
  4. make install INSTALL_PREFIX=/home/m/fpc/$INSTPATH/def
  5.  
  6. mkdir -p /home/m/fpc/$INSTPATH/def/lib/fpc/etc
  7. mkdir -p /home/m/fpc/$INSTPATH/def/etc
  8.  
  9. cd /home/m/fpc/$INSTPATH
  10. def/bin/fpcmkcfg -d basepath=/home/m/fpc/$INSTPATH/def/lib/fpc/$INSTVERS > def/lib/fpc/etc/fpc.cfg
  11. def/bin/fpcmkcfg -d basepath=/home/m/fpc/$INSTPATH/def/lib/fpc/$INSTVERS > def/etc/fpc.cfg
  12.  
  13. ln -s /home/m/fpc/$INSTPATH/def/lib/fpc/$INSTVERS/ppcx64 /home/m/fpc/$INSTPATH/def/bin/ppcx64
  14.  

In the IDE you must specify fpc as  (replace INSTPATH since the IDE does not know)
 /home/m/fpc/$INSTPATH/def/lib/fpc/$INSTVERS/ppcx64 /home/m/fpc/$INSTPATH/def/bin/ppcx64

That way (at least for me) it will find it's own config, and therefore use the correct unit dirs....




Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: Configuration
« Reply #3 on: July 05, 2022, 01:20:04 pm »
How do I enable debugging the fpc packages and how do I include FPDebug?
What you mean?
You build them with dwarf, as in my above post...

But what means "How do I include FpDebug"?
That is part of the IDE.

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Configuration
« Reply #4 on: July 06, 2022, 11:07:28 am »
Ok. Some explanation.

I was debugging a small dashboard app, that reads some dbf files and communicates with some REST services. After a while, I noticed that the active line during debugging was not the line that was actually executed. After rebuilding the IDE the problem became worse. And after checking the options, FPdebug was not available anymore, while I'm sure that's what I have been using. Time for a new version.

In the past, I tried a few times to check out the source code and build it, but I couldn't get it to work. So, generally I use fpcupdeluxe to get a trunk install. That only works well if I do everything right the first time. Rebuilding often fails. So that's not optimal if I have made my own changes. I generally change the configuration in fpcupdeluxe and when rebuilding fails I do "make all" in the fpc directory.

Building Lazarus only works well from within the IDE, so it has to start, which can be a problem.

This time I made repositories on Gitlab. After some trial and error, I now have two forks here.

On my Windows 10 PC, I have a bootstrap install in:

C:\Apps\FPC\3.2.2

and the repositories in:

C:\Data\Projecten\fpc
and
C:\Data\Projecten\lazarus

I made the following build file:

Code: [Select]
rem PP= and DATA2INC= refer to an existing FPC 3.2.2 install! Download if needed!
make distclean all PP=C:\Apps\FPC\3.2.2\bin\i386-win32\ppc386.exe DATA2INC=C:\Apps\FPC\3.2.2\bin\i386-win32\data2inc.exe
make all PREFIX=C:\Data\Projecten\fpc PP=C:\Apps\FPC\3.2.2\bin\i386-win32\ppc386.exe OPT="-gw -godwarsets" DATA2INC=C:\Apps\FPC\3.2.2\bin\i386-win32\data2inc.exe
make install PREFIX=C:\Data\Projecten\fpc PP=C:\Apps\FPC\3.2.2\bin\i386-win32\ppc386.exe DATA2INC=C:\Apps\FPC\3.2.2\bin\i386-win32\data2inc.exe
make all OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=C:\Data\Projecten\fpc OPT="-gw -godwarsets" PP=C:\Apps\FPC\3.2.2\bin\i386-win32\ppc386.exe DATA2INC=C:\Apps\FPC\3.2.2\bin\i386-win32\data2inc.exe
make crossinstall OS_TARGET=win64 CPU_TARGET=x86_64 INSTALL_PREFIX=C:\Data\Projecten\fpc PP=C:\apps\FPC\3.2.2\bin\i386-win32\ppc386.exe DATA2INC=C:\apps\FPC\3.2.2\bin\i386\win32\data2inc.exe

That should generate the directory:

C:\Data\Projecten\fpc\bin\i386-win32\ppcrossx64

with the x86_64 compiler, according to the wiki, but it doesn't. There is a

C:\Data\Projecten\fpc\compiler\ppcrossx64.exe
and
C:\Data\Projecten\fpc\bin\i386-win32\ppcrossx64.exe


To install Lazarus, according to the wiki, I need to do:

set path=c:\freepascal\bin\x86_64-win64 <- my location to the x86_64 compiler, which should be:

C:\Data\Projecten\fpc\bin\x86_64-win64

but that directory doesn't contain any binaries.

At first, I just copied stuff around and edited config files until I could build Lazarus and it started. But FPdebug wasn't available and it kept ignoring my changes. Those repositories are now overwritten by the freshly forked ones, and I'm trying to do it right this time. But so far without success.

And when I have gotten it compiled, I have to get the configuration right, which I couldn't figure out the first time.


Oh, and it has to be a debug build, because I was trying to debug TFPHTTPClient.
« Last Edit: July 06, 2022, 11:10:22 am by SymbolicFrank »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Configuration
« Reply #5 on: July 06, 2022, 01:17:43 pm »
That should generate the directory:

C:\Data\Projecten\fpc\bin\i386-win32\ppcrossx64

with the x86_64 compiler, according to the wiki, but it doesn't. There is a

C:\Data\Projecten\fpc\compiler\ppcrossx64.exe
and
C:\Data\Projecten\fpc\bin\i386-win32\ppcrossx64.exe

The wiki seems to be a bit unclear in that regard, so the last one is the correct one.

To install Lazarus, according to the wiki, I need to do:

set path=c:\freepascal\bin\x86_64-win64 <- my location to the x86_64 compiler, which should be:

C:\Data\Projecten\fpc\bin\x86_64-win64

but that directory doesn't contain any binaries.

The wiki assumes that you have a native compiler, but what you created is a cross compiler (ppcrossx64) and the cross compiler resides in the directory of the host architecture which in your case is i386-win32, so you need to use that path instead of the x86_64-win64 one.

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Configuration
« Reply #6 on: July 06, 2022, 03:18:31 pm »
How can I build a native x86_64 compiler?

Nvm, I figured it out.
« Last Edit: July 06, 2022, 03:55:55 pm by SymbolicFrank »

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Configuration
« Reply #7 on: July 06, 2022, 04:14:31 pm »
Ok, fpc seems to be ok. But building Lazarus is a problem.

I removed everything in AppData/local/lazarus (it's not: "c:\users\<your_name>\appdata\lazarus", as the wiki says). I put "C:\Data\Projecten\fpc\bin\x86_64-win64" in the path. But I always get this error:

Code: [Select]
Free Pascal Compiler version 3.2.3 [2022/07/06] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
(1002) Target OS: Win64 for x64
(3104) Compiling fcllaz.pas
Fatal: (10022) Can't find unit system used by fcllaz
Fatal: (1018) Compilation aborted
make[1]: *** [fcllaz.ppu] Error 1

Searching didn't give a solution.

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Configuration
« Reply #8 on: July 06, 2022, 04:50:54 pm »
Ah, you need fpcmkcfg to make a configuration, instead of fpmkcfg as the wiki says.

At this point, I'm going to ignore the wiki altogether.

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Configuration
« Reply #9 on: July 08, 2022, 01:39:52 pm »
How can I make a debug build of the fpc packages from the command line, so I can debug them? That was the reason I'm doing all this in the first place. FPDebug has no source code or line number, so it shows the assembler window. "make all debug" doesn't do the trick. Adding 'OPT="-gw -godwarsets"' doesn't work either. Or "Clean up and build"

Help?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5444
  • Compiler Developer
Re: Configuration
« Reply #10 on: July 08, 2022, 05:47:28 pm »
How can I make a debug build of the fpc packages from the command line, so I can debug them? That was the reason I'm doing all this in the first place. FPDebug has no source code or line number, so it shows the assembler window. "make all debug" doesn't do the trick. Adding 'OPT="-gw -godwarsets"' doesn't work either. Or "Clean up and build"

I usually do make all OPT=-glw2. Don't forget to do a make install as well otherwise the installed units won't be replaced.

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
Re: Configuration
« Reply #11 on: July 11, 2022, 10:07:26 am »
Thanks! That did the trick!

And for some reason the FPHTTPClient doesn't give the strange error anymore :)

 

TinyPortal © 2005-2018