Recent

Author Topic: How to use fileutils from fpc  (Read 345 times)

rnfpc

  • Jr. Member
  • **
  • Posts: 91
How to use fileutils from fpc
« on: July 12, 2019, 03:07:04 am »
I am using Free Pascal Compiler version 3.0.0+dfsg-11+deb9u1 [2017/06/10] for x86_64 on Debian Stable Linux with Lazarus.

I find that I am not able to use packages fileutil with fpc for command line applications as in this question: https://forum.lazarus.freepascal.org/index.php/topic,44207.0.html

How can I use fileutil with fpc? I tried using following option with fpc command:
Code: Pascal  [Select]
  1. -Fu/usr/lib/lazarus/1.6.2/components/lazutils
But then fpc starts compiling those files and it cannot since that needs root privileges. Can I copy files from that folder to some folder in my home directory and use them? Will that work? Thanks for your help.




jamie

  • Hero Member
  • *****
  • Posts: 2094
Re: How to use fileutils from fpc
« Reply #1 on: July 12, 2019, 03:59:22 am »
Most coders have full PC at their hands..
Number 1 at blue screen app creations!

lucamar

  • Hero Member
  • *****
  • Posts: 2084
Re: How to use fileutils from fpc
« Reply #2 on: July 12, 2019, 05:37:58 am »
You have to use the full path to where the compiled object files are. In this system*, for example, this works for a small test program using "FindAllFiles":
Code: [Select]
fpc -Fu/usr/share/lazarus/2.0.2/components/lazutils/lib/i386-linux/ test.pas
(*) Lazarus 2.0.2/FPC 3.0.4 on Ubuntu 12.04
« Last Edit: July 12, 2019, 05:39:36 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

Bart

  • Hero Member
  • *****
  • Posts: 3541
    • Bart en Mariska's Webstek
Re: How to use fileutils from fpc
« Reply #3 on: July 12, 2019, 10:51:21 am »
Since you do seem to have Lazarus: open the program in Lazarus (the IDE will suggest to make a projet (.lpi) for it: accept that). Then in Project Inspector simply add a dependency for LazUtils package.

Bart

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7508
Re: How to use fileutils from fpc
« Reply #4 on: July 12, 2019, 10:59:06 am »
Since you do seem to have Lazarus: open the program in Lazarus (the IDE will suggest to make a projet (.lpi) for it: accept that). Then in Project Inspector simply add a dependency for LazUtils package.

But .lpi's can't be used with the commandline compiler. Maybe you can use lazbuild though.

Bart

  • Hero Member
  • *****
  • Posts: 3541
    • Bart en Mariska's Webstek
Re: How to use fileutils from fpc
« Reply #5 on: July 12, 2019, 11:14:11 am »
But .lpi's can't be used with the commandline compiler. Maybe you can use lazbuild though.

Personally I would use Lazarus as IDE and have the advantage of all codetools and build the project in Lazarus IDE.
Another alternative:
Menu->Project-?Project Options->Show Options: this will show you all used paths, you can copy that when you invoke the compiler by hand.

Bart