Recent

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

rnfpc

  • Full Member
  • ***
  • Posts: 101
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: 6090
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..
The only true wisdom is knowing you know nothing

lucamar

  • Hero Member
  • *****
  • Posts: 4219
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/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.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • 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

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
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: 5275
    • 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

 

TinyPortal © 2005-2018