Recent

Author Topic: Cannot find unit system used by fcllaz of package FC - questions  (Read 5692 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
This problem has come to bite me again. It has been around for too many years, far too long, and by now there should be clear cut method for the end user to diagnose it and fix it. The trial and error method is simply unprofessional, if that is the appropriate term to use.

I need to ask some questions about the whole process.

1. Is there a clear cut relationship between the location of the fpc executable used by Lazarus, the contents of the fpc.cfg and the location of the system.ppu that should allow the setting of the contents of the fpc.cfg?

2. If the wrong system.ppu is being used, does it mean that system.ppu of the fpc used by Lazarus is not the one which compiled the trouble package or what, ie does the fpc know which system.ppu it needs, ie is its own correct system.ppu  placed at a fixed location relative to its own path, or does it get it from the fpc.cfg?

3. If on opening Lazarus, Lazarus agrees that the fpc is right, and that it is the same fpc which was used to compile it, and the system.ppu is located at a fixed location relative to the fpc itself, and that can be added to the fpc.cfg, then why is this problem so hard to fix?

4. Can the  actual fpc version, as well as the location where it is stored at the time of the compilation  be stored in the fpc executable, as well as in the Lazarus executeable, so that if you compile Lazarus and fpc yourself you know what system.ppu is involved?

5. Is there some verbose setting which  can output wwhat directories are being searched, as well as indicate the directories where the correct system.ppu and other critical files were expected to be in case they were not?

6. Is there an fpc build script that does the same thing as the IDE, which can be run from the command line with enough verbose settings to check the problem?

Your sincerely,

Frustrated Frank
Lazarus 3.0/FPC 3.2.2

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Cannot find unit system used by fcllaz of package FC - questions
« Reply #1 on: March 02, 2015, 08:33:22 pm »
1. Is there a clear cut relationship between the location of the fpc executable used by Lazarus, the contents of the fpc.cfg and the location of the system.ppu that should allow the setting of the contents of the fpc.cfg?

Yes. A fpc invocation which doesn't get the path to a specific fpc.cfg on the commandline will search for it in certain OS dependent paths. Then the -Fu line from the .cfg will be used to find the ppu.

Quote
2. If the wrong system.ppu is being used, does it mean that system.ppu of the fpc used by Lazarus is not the one which compiled the trouble package or what, ie does the fpc know which system.ppu it needs, ie is its own correct system.ppu  placed at a fixed location relative to its own path, or does it get it from the fpc.cfg?

That case is not predictable. It depends on the exact differences between the FPC version of the "wrong" ppu and the "right" ppu.

Quote
3. If on opening Lazarus, Lazarus agrees that the fpc is right, and that it is the same fpc which was used to compile it, and the system.ppu is located at a fixed location relative to the fpc itself, and that can be added to the fpc.cfg, then why is this problem so hard to fix?

If you find out, please submit a patch. Preferably one that is hardened for cases where people don't clean out old versions, and click willy-nilly on "configuration reuse" dialogs.

Quote
4. Can the  actual fpc version, as well as the location where it is stored at the time of the compilation  be stored in the fpc executable, as well as in the Lazarus executeable, so that if you compile Lazarus and fpc yourself you know what system.ppu is involved?

Maybe, but is simpler to simply clean out the wrong ppus. The complications of multiple versions of .ppu's in the compiler search path increase exponentially with the number of units that use them.

Quote
5. Is there some verbose setting which  can output wwhat directories are being searched,

-vt or -va

Quote
as well as indicate the directories where the correct system.ppu and other critical files were expected to be in case they were not?

No. Passing the correct PPU is your responsibility. If you want to simplify it, simply make sure that there are no other versions on the system.

Quote
6. Is there an fpc build script that does the same thing as the IDE, which can be run from the command line with enough verbose settings to check the problem?

Any commandline with sufficient -v<x> parameters will do, in IDE, in the make OPT= parameter or passed directly to the compiler.

In cases of doubt, read the buildfaq.
« Last Edit: March 03, 2015, 03:48:33 pm by marcov »

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Cannot find unit system used by fcllaz of package FC - questions
« Reply #2 on: March 03, 2015, 02:32:56 pm »
1. Is there a clear cut relationship between the location of the fpc executable used by Lazarus, the contents of the fpc.cfg and the location of the system.ppu that should allow the setting of the contents of the fpc.cfg?

Yes. A fpc invocation which doesn't get the path to a specific fpc.cfg on the commandline will search for it in certain OS dependent paths. Then the -Fu line from the .ppu will be used to find the ppu.

Hi Marco, I have posted all the configuration details relating to my installation which was built via fpcup. It has been bloated by the comments in the fpc.cfg, but that is where the breaking stuff mignt be, and I have also included the locations of necessary system.pp related files. I forgot the contents of the xml files in --pcp directory, but I will post them if you consider them relevant. Can you look through these and see if something may be amiss here. In the meantime I will check the contents of the --pcp directory and rebuild the system again and probably just compile only new projects without adding any of my existing libraries to it. It could be something in my existing libraries or projects.

Thanks.




Code: [Select]
# >>>>>>>>>>>>>>>>>>>>>
# START = contents of script for start Lazarus
{LAZARUSDIR}/lazarus/lazarus --pcp="{LAZARUSCONFIGDIR}"  # the --pcp is unique for every separate build the svn tags of lazarus and fpc

# END = contents of script for start Lazarus
# <<<<<<<<<<<<<<<<<<<<<

# >>>>>>>>>>>>>>>>>>>>>
# START = Lazarus IDE Options dialog (top of Environment Tree)

# Lazarus directory (default for all projects)
{LAZARUSDIR}/lazarus/

# Compile executable (e.g. fpc)
{LAZARUSDIR}/fpc/bin/x86_64-linux/fpc.sh

# FPC Source Directory
{LAZARUSDIR}/fpc

# END = Lazarus IDE Options dialog (top of Environment Tree)
# <<<<<<<<<<<<<<<<<<<<<

# >>>>>>>>>>>>>>>>>>>>>
# START = Content of fpc.sh command script (generated by fpcup)

#!/bin/sh
# This script starts the fpc compiler installed by fpcup
# and ignores any system-wide fpc.cfg files
# Note: maintained by fpcup; do not edit directly, your edits will be lost.
{LAZARUSDIR}/fpc/bin/x86_64-linux/fpc  -n @{LAZARUSDIR}/fpc/bin/x86_64-linux/fpc.cfg "$@"

# END = Content of fpc.sh command script (generated by fpcup)
# <<<<<<<<<<<<<<<<<<<<<

# >>>>>>>>>>>>>>>>>>>>>
# START = Content of fpc.cfg file used by  fpc.sh (above)

#
# Config file generated by fpcmkcfg on 2-3-15 - 13:17:57
# Example fpc.cfg for Free Pascal Compiler
#

# ----------------------
# Defines (preprocessor)
# ----------------------

#
# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
#
# -d is the same as #DEFINE
# -u is the same as #UNDEF
#

#
# Some examples (for switches see below, and the -? helppages)
#
# Try compiling with the -dRELEASE or -dDEBUG on the commandline
#

# For a release compile with optimizes and strip debuginfo
#IFDEF RELEASE
  -O2
  -Xs
  #WRITE Compiling Release Version
#ENDIF

# For a debug version compile with debuginfo and all codegeneration checks on
#IFDEF DEBUG
  -gl
  -Crtoi
  #WRITE Compiling Debug Version
#ENDIF

# assembling
#ifdef darwin
# use pipes instead of temporary files for assembling
-ap
# path to Xcode 4.3+ utilities (no problem if it doesn't exist)
-FD/Applications/Xcode.app/Contents/Developer/usr/bin
#endif

# ----------------
# Parsing switches
# ----------------

# Pascal language mode
#      -Mfpc      free pascal dialect (default)
#      -Mobjfpc   switch some Delphi 2 extensions on
#      -Mdelphi   tries to be Delphi compatible
#      -Mtp       tries to be TP/BP 7.0 compatible
#      -Mgpc      tries to be gpc compatible
#      -Mmacpas   tries to be compatible to the macintosh pascal dialects
#
# Turn on Object Pascal extensions by default
#-Mobjfpc

# Assembler reader mode
#      -Rdefault  use default assembler
#      -Ratt      read AT&T style assembler
#      -Rintel    read Intel style assembler
#
# All assembler blocks are AT&T styled by default
#-Ratt

# Semantic checking
#      -S2        same as -Mobjfpc
#      -Sc        supports operators like C (*=,+=,/= and -=)
#      -Sa        include assertion code.
#      -Sd        same as -Mdelphi
#      -Se<x>     error options. <x> is a combination of the following:
#         <n> : compiler stops after <n> errors (default is 1)
#         w   : compiler stops also after warnings
#         n   : compiler stops also after notes
#         h   : compiler stops also after hints
#      -Sg        allow LABEL and GOTO
#      -Sh        Use ansistrings
#      -Si        support C++ styled INLINE
#      -Sk        load fpcylix unit
#      -SI<x>     set interface style to <x>
#         -SIcom    COM compatible interface (default)
#         -SIcorba  CORBA compatible interface
#      -Sm        support macros like C (global)
#      -So        same as -Mtp
#      -Sp        same as -Mgpc
#      -Ss        constructor name must be init (destructor must be done)
#      -Sx        enable exception keywords (default in Delphi/ObjFPC modes)
#
# Allow goto, inline, C-operators, C-vars
-Sgic

# ---------------
# Code generation
# ---------------

# Uncomment the next line if you always want static/dynamic units by default
# (can be overruled with -CD, -CS at the commandline)
#-CS
#-CD

# Set the default heapsize to 8Mb
#-Ch8000000

# Set default codegeneration checks (iocheck, overflow, range, stack)
#-Ci
#-Co
#-Cr
#-Ct

# Optimizer switches
# -Os        generate smaller code
# -Oa=N      set alignment to N
# -O1        level 1 optimizations (quick optimizations, debuggable)
# -O2        level 2 optimizations (-O1 + optimizations which make debugging more difficult)
# -O3        level 3 optimizations (-O2 + optimizations which also may make the program slower rather than faster)
# -Oo<x>     switch on optimalization x. See fpc -i for possible values
# -OoNO<x>   switch off optimalization x. See fpc -i for possible values
# -Op<x>     set target cpu for optimizing, see fpc -i for possible values

#ifdef darwin
#ifdef cpui386
-Cppentiumm
-Oppentiumm
#endif
#endif

# -----------------------
# Set Filenames and Paths
# -----------------------

# Both slashes and backslashes are allowed in paths

# path to the messagefile, not necessary anymore but can be used to override
# the default language
#-Fr{LAZARUSDIR}/fpc/msg/errore.msg
#-Fr{LAZARUSDIR}/fpc/msg/errorn.msg
#-Fr{LAZARUSDIR}/fpc/msg/errores.msg
#-Fr{LAZARUSDIR}/fpc/msg/errord.msg
#-Fr{LAZARUSDIR}/fpc/msg/errorr.msg

# search path for unicode binary files
-FM/unicode/

# searchpath for units and other system dependent things
-Fu{LAZARUSDIR}/fpc/units/$fpctarget
-Fu{LAZARUSDIR}/fpc/units/$fpctarget/*
-Fu{LAZARUSDIR}/fpc/units/$fpctarget/rtl

#ifdef cpui8086
-Fu{LAZARUSDIR}/fpc/units/$fpctarget/$fpcsubarch-$fpcmemorymodel
-Fu{LAZARUSDIR}/fpc/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/*
-Fu{LAZARUSDIR}/fpc/units/$fpctarget/$fpcsubarch-$fpcmemorymodel/rtl
#endif

#IFDEF FPCAPACHE_1_3
-Fu{LAZARUSDIR}/fpc/units/$fpctarget/httpd13/
#ELSE
#IFDEF FPCAPACHE_2_0
-Fu{LAZARUSDIR}/fpc/units/$fpctarget/httpd20
#ELSE
-Fu{LAZARUSDIR}/fpc/units/$fpctarget/httpd22
#ENDIF
#ENDIF

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

# path to the gcclib
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/4.8
#endif
#ifdef cpux86_64
-Fl/usr/lib/gcc/x86_64-linux-gnu/4.8
#endif

# searchpath for libraries
#-Fl{LAZARUSDIR}/fpc/lib
#-Fl/lib;/usr/lib
-Fl{LAZARUSDIR}/fpc/lib/$FPCTARGET

# searchpath for tools
-FD{LAZARUSDIR}/fpc/bin/$FPCTARGET

#IFNDEF CPUI386
#IFNDEF CPUAMD64
#DEFINE NEEDCROSSBINUTILS
#ENDIF
#ENDIF

#IFNDEF Linux
#DEFINE NEEDCROSSBINUTILS
#ENDIF

# never need cross-prefix when targeting the JVM
# (no native compiler, always cross-compiling)
#ifdef cpujvm
#undef NEEDCROSSBINUTILS
#endif

# for android cross-prefix is set by compiler
#ifdef android
#undef NEEDCROSSBINUTILS
#endif

# never need cross-prefix when targeting the i8086
# (no native compiler, always cross-compiling)
#ifdef cpui8086
#undef NEEDCROSSBINUTILS
#endif

# binutils prefix for cross compiling
#IFDEF FPC_CROSSCOMPILING
#IFDEF NEEDCROSSBINUTILS
  -XP$FPCTARGET-
#ENDIF
#ENDIF


# -------------
# Linking
# -------------

# generate always debugging information for GDB (slows down the compiling
# process)
#      -gc        generate checks for pointers
#      -gd        use dbx
#      -gg        use gsym
#      -gh        use heap trace unit (for memory leak debugging)
#      -gl        use line info unit to show more info for backtraces
#      -gv        generates programs tracable with valgrind
#      -gw        generate dwarf debugging info
#
# Enable debuginfo and use the line info unit by default
#-gl

# always pass an option to the linker
#-k-s

# Always strip debuginfo from the executable
-Xs

# Always use smartlinking on i8086, because the system unit exceeds the 64kb
# code limit
#ifdef cpui8086
-CX
-XX
#endif


# -------------
# Miscellaneous
# -------------

# Write always a nice FPC logo ;)
-l

# Verbosity
#      e : Show errors (default)       d : Show debug info
#      w : Show warnings               u : Show unit info
#      n : Show notes                  t : Show tried/used files
#      h : Show hints                  s : Show time stamps
#      i : Show general info           q : Show message numbers
#      l : Show linenumbers            c : Show conditionals
#      a : Show everything             0 : Show nothing (except errors)
#      b : Write file names messages   r : Rhide/GCC compatibility mode
#          with full path              x : Executable info (Win32 only)
#      v : write fpcdebug.txt with     p : Write tree.log with parse tree
#          lots of debugging info
#
# Display Info, Warnings and Notes
-viwn
# If you don't want so much verbosity use
#-vw
# fpcup:
# Adding binary tools paths to
# plain bin dir and architecture bin dir so
# fpc 2.7+ fpcres etc can be found.
-FD{LAZARUSDIR}/fpc/bin/x86_64-linux/;{LAZARUSDIR}/fpc/bin/


# END = Content of fpc.cfg file used by  fpc.sh (above)
# >>>>>>>>>>>>>>>>>>>>>

# >>>>>>>>>>>>>>>>>>>>>
# START = list of system.ppu files in Lazarus program directory
{LAZARUSDIR}/fpc/lib/fpc/3.1.1/units/x86_64-linux/rtl/system.ppu
{LAZARUSDIR}/fpc/rtl/units/x86_64-linux/system.ppu

# END = list of system.ppu files in Lazarus program directory
# >>>>>>>>>>>>>>>>>>>>>

# >>>>>>>>>>>>>>>>>>>>>
# START = list of system* files in Lazarus program directory (includes the two above)
{LAZARUSDIR}/fpc/packages/syslog/units/x86_64-linux/systemlog.o
{LAZARUSDIR}/fpc/packages/syslog/units/x86_64-linux/systemlog.ppu
{LAZARUSDIR}/fpc/lib/fpc/3.1.1/units/x86_64-linux/rtl/system.o
{LAZARUSDIR}/fpc/lib/fpc/3.1.1/units/x86_64-linux/rtl/system.ppu
{LAZARUSDIR}/fpc/lib/fpc/3.1.1/units/x86_64-linux/syslog/systemlog.o
{LAZARUSDIR}/fpc/lib/fpc/3.1.1/units/x86_64-linux/syslog/systemlog.ppu
{LAZARUSDIR}/fpc/rtl/units/x86_64-linux/system.o
{LAZARUSDIR}/fpc/rtl/units/x86_64-linux/system.ppu
{LAZARUSDIR}/fpc/rtl/linux/system.pp
{LAZARUSDIR}/fpc/compiler/x86_64/units/x86_64-linux/systems.o
{LAZARUSDIR}/fpc/compiler/x86_64/units/x86_64-linux/systems.ppu
{LAZARUSDIR}/fpc/compiler/utils/units/x86_64-linux/systems.o
{LAZARUSDIR}/fpc/compiler/utils/units/x86_64-linux/systems.ppu
{LAZARUSDIR}/fpc/ide/units/x86_64-linux/systems.o
{LAZARUSDIR}/fpc/ide/units/x86_64-linux/systems.ppu
# END = list of system* files in Lazarus program directory
# >>>>>>>>>>>>>>>>>>>>>
Lazarus 3.0/FPC 3.2.2

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Cannot find unit system used by fcllaz of package FC - questions
« Reply #3 on: March 03, 2015, 03:50:30 pm »
The -Fu lines looks good, but checking how you started is no good. Something (a symlink to an old version, a bad lazarus config or whatever) mixes versions.

The best way to find it is to search for it. Search for all copies of fpc.cfg, search for multiple FPC "units" paths, and before building lazarus clean it thoroughly.

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Cannot find unit system used by fcllaz of package FC - questions
« Reply #4 on: March 03, 2015, 04:22:13 pm »
The -Fu lines looks good, but checking how you started is no good. Something (a symlink to an old version, a bad lazarus config or whatever) mixes versions.

The best way to find it is to search for it. Search for all copies of fpc.cfg, search for multiple FPC "units" paths, and before building lazarus clean it thoroughly.

I tried compiling example projects and new simple projects and it worked and even rebuilt the IDE and it all worked. It turned out the project I was compiling contained hard coded target to  the i386 architecture which wasn't very obvious until I tried to do a Clean and Build All. That dialog showed that the content of an i386-linux directory  needed to be built. I had tried setting it earlier but the dialog probably didn't take and I failed to notice it.

This bring me to one of the points  mentioned earlier. Is there a way the compile command to output to the screen, a file or both every step it executes in the build process, with warnings, etc?
Something like this would have made me see the problem much earlier.

I intend to try a cross compilation build later, to help avoid such problems in the future. Is using build modes the way to target different architectures using the same project files?
Lazarus 3.0/FPC 3.2.2

 

TinyPortal © 2005-2018