Recent

Author Topic: FPC 3.0.4 failed to compile HelloWorld  (Read 3418 times)

OldPascal

  • New Member
  • *
  • Posts: 19
FPC 3.0.4 failed to compile HelloWorld
« on: January 18, 2019, 09:24:35 pm »
Free pascal fpc 3.0.4 failed to compile hello world.   The code is written as:

Code: Pascal  [Select][+][-]
  1.  
  2. program HelloWorld;
  3.  
  4. begin
  5.   writeln('Hello Pascal World');
  6. end.
  7.  
  8.  

Compiled it (opensuse Leap 15) under the command:

Code: Pascal  [Select][+][-]
  1. fpc  -vut "%f"

I've got the error message as follows:

Code: Pascal  [Select][+][-]
  1. fpc  -vut "HelloWorld.pas"  (in directory: /home/adam/projects/GeanyTest1)
  2. Configfile search: /home/adam/.fpc.cfg
  3. Reading options from file /home/adam/.fpc.cfg
  4. Path "/home/adam/fpc-3.0.0/lib/fpc/3.0.4/units/x86_64-linux/" not found
  5. Path "/home/adam/fpc-3.0.0/lib/fpc/3.0.4/units/x86_64-linux/*/" not found
  6. Path "/home/adam/fpc-3.0.0/lib/fpc/3.0.4/units/x86_64-linux/rtl/" not found
  7. Path "/home/adam/fpc-3.0.0/lib/fpc/3.0.4/units/x86_64-linux/httpd22/" not found
  8. Path "/home/adam/.fppkg/lib/fpc/3.0.4/units/x86_64-linux/*/" not found
  9. Path "/usr/lib64/gcc/x86_64-suse-linux/4.8/" not found
  10. Path "/home/adam/fpc-3.0.0/lib/fpc/3.0.4/lib/x86_64-linux/" not found
  11. Free Pascal Compiler version 3.0.4 [2018/05/13] for x86_64
  12. Copyright (c) 1993-2017 by Florian Klaempfl and others
  13. Path "/usr/lib/fpc/3.0.4/units/x86_64-linux/rtl/" not found
  14. Searching file /lib64/ld-linux-x86-64.so.2... found
  15. Path "/usr/X11R6/lib64/" not found
  16. Path "/usr/lib/x86_64-linux-gnu/" not found
  17. Compiler: /usr/lib64/fpc/3.0.4/ppcx64
  18. Target OS: Linux for x86-64
  19. Using executable path: /usr/lib64/fpc/3.0.4/
  20. Using unit path: /usr/lib64/fpc/3.0.4/
  21. Using library path: /lib64/
  22. Using library path: /usr/lib64/
  23. Using library path: /usr/lib64/fpc/3.0.4/
  24. Using object path: /usr/lib64/fpc/3.0.4/
  25. Compiling HelloWorld.pas
  26. Searching file HelloWorld.pas... found
  27. (HELLOWORLD) Registering new unit SYSTEM
  28. (HELLOWORLD) Load from HELLOWORLD (implementation) unit SYSTEM
  29. (SYSTEM)   Loading unit SYSTEM
  30. Unitsearch: system.ppu
  31. Searching file system.ppu... not found
  32. Searching file SYSTEM.PPU... not found
  33. Unitsearch: system.pp
  34. Searching file system.pp... not found
  35. Searching file SYSTEM.PP... not found
  36. Unitsearch: system.pas
  37. Searching file system.pas... not found
  38. Searching file SYSTEM.PAS... not found
  39. Unitsearch: /usr/lib64/fpc/3.0.4/system.ppu
  40. Searching file /usr/lib64/fpc/3.0.4/system.ppu... not found
  41. Searching file /usr/lib64/fpc/3.0.4/SYSTEM.PPU... not found
  42. Unitsearch: /usr/lib64/fpc/3.0.4/system.pp
  43. Searching file /usr/lib64/fpc/3.0.4/system.pp... not found
  44. Searching file /usr/lib64/fpc/3.0.4/SYSTEM.PP... not found
  45. Unitsearch: /usr/lib64/fpc/3.0.4/system.pas
  46. Searching file /usr/lib64/fpc/3.0.4/system.pas... not found
  47. Searching file /usr/lib64/fpc/3.0.4/SYSTEM.PAS... not found
  48. Unitsearch: system.pp
  49. Searching file system.pp... not found
  50. Searching file SYSTEM.PP... not found
  51. Unitsearch: system.pas
  52. Searching file system.pas... not found
  53. Searching file SYSTEM.PAS... not found
  54. Unitsearch: /usr/lib64/fpc/3.0.4/system.pp
  55. Searching file /usr/lib64/fpc/3.0.4/system.pp... not found
  56. Searching file /usr/lib64/fpc/3.0.4/SYSTEM.PP... not found
  57. Unitsearch: /usr/lib64/fpc/3.0.4/system.pas
  58. Searching file /usr/lib64/fpc/3.0.4/system.pas... not found
  59. Searching file /usr/lib64/fpc/3.0.4/SYSTEM.PAS... not found
  60. Fatal: Can't find unit system used by HelloWorld
  61. Fatal: Compilation aborted
  62. Error: /usr/bin/ppcx64 returned an error exitcode
  63. Compilation failed.
  64.  

I search the hard drive for file system.pas and I cannot find it.  My guess is that I need RTL library but I cannot find it either.
Can someone please  enlighted me what I am doing wrong here.  My mind is getting foggy.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11384
  • FPC developer.
Re: FPC 3.0.4 failed to compile HelloWorld
« Reply #1 on: January 18, 2019, 09:58:22 pm »
If 3.0.4 was non-functional, we would have noticed after more than an year.

It is also strange that you have ~/fpc-3.0.0 in your compiler output.

Freepascal generally operates from precompiled sources which are installed together, search for system.ppu.

Typical location  is $PREFIX/fpc/units/$FPCTARGET/* or $PREFIX/fpc/units/$FPCTARGET/rtl*

with $PREFIX being the prefix of the FPC install, and $FPCTARGET automatically substituted with the target (i386-linux or x86_64-linux depending on 32/64-bit).

Check the -Fu line in your fpc.cfg, it should point to the precompiled unit directory

For more background info, check the old but fine buildfaq.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: FPC 3.0.4 failed to compile HelloWorld
« Reply #2 on: January 18, 2019, 10:36:06 pm »
My guess is that your installation is misconfigured. In mine (i386-linux), p.e. the paths are:
Code: [Select]
Compiler:   /usr/lib/fpc/3.0.4/ppc386
Units:      /usr/lib/fpc/3.0.4/units/
system.ppu: /usr/lib/fpc/3.0.4/units/i386-linux/rtl/system.ppu

so in yours it should be something like:
Code: [Select]
Compiler:   /usr/lib64/fpc/3.0.4/ppcx64
Units:      /usr/lib64/fpc/3.0.4/units/
system.ppu: /usr/lib64/fpc/3.0.4/units/x86_64-linux/rtl/system.ppu

As marcov says, check your fpc.cfg and set it right.

Note that unless you installed also the sources you'll not have any of the RTL .pas, .pp, .inc, etc. but you don't really need them. Your compiler is asking for them only because it can't find the already compiled units.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

OldPascal

  • New Member
  • *
  • Posts: 19
Re: FPC 3.0.4 failed to compile HelloWorld
« Reply #3 on: January 19, 2019, 06:31:21 pm »
Thanks for feedback.  I looked into fpc.cfg found in ./etc/ directory and modified accordingly by adding the following lines
Code: Pascal  [Select][+][-]
  1. # added by Adam to make compiler work.
  2. # adding seaarch path for other stuff
  3. -Fu/usr/lib64/fpc/3.0.4/ppcx64
  4. -Fu/usr/lib64/fpc/3.0.4/units/
  5. -Fu/usr/lib64/fpc/3.0.4/units/x86_64-linux/rtl/system.ppu
  6.  

But when running compiler again, I get the same results.  My impression is that compiler is not reading that configuration file but something else.  Where I am doing wrong.  Note that directories are correct and system.ppu is there.

OldPascal

  • New Member
  • *
  • Posts: 19
Re: FPC 3.0.4 failed to compile HelloWorld
« Reply #4 on: January 19, 2019, 06:47:20 pm »
Okay, I fixed it.   Turns out that I have a hidden fpc.cfg file in home/adam.   When compiler did the wild search, it found it first in that directory instead etc directory.  I renamed the hidden file .fpc.cfg into .oldfpc.cfg.   This hidden config file is for 3.0.0 version.   When I compiled hello world again, it compiled but with warning message :
Code: Pascal  [Select][+][-]
  1. /usr/bin/ld: warning: link.res contains output sections; did you forget -T?

I though it is referring to a flag so I did fpc -T but it did not compile.  What is -T ?  :-[

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: FPC 3.0.4 failed to compile HelloWorld
« Reply #5 on: January 19, 2019, 07:35:31 pm »
You can ignore it. As far as I understand it, the compiler uses those sections in a not-quite-standard way and the linker doesn't like the looks of them, but nonetheless it works.

Newer versions of the linker don't produce that warning.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018