Recent

Author Topic: Setting the fpc path  (Read 616 times)

cousinp

  • Newbie
  • Posts: 6
Setting the fpc path
« on: August 16, 2024, 08:29:26 pm »
Reading: Getting Started with Lazarus and Free Pascal,  which is several years old. It instructs to set the fpc path as   SET PATH=%PATH%;C:\lazarus\fpc\3.2.2\bin\i386-win32   But when I go to the bin directory it doesn't say i386-win32,    it says x86_64-win64   So what do I enter after the bin\?
Second to set the path in the Environment Variables in the System variables box, when I click on the edit, I get 5 paths and none say 64 as in my bin folder, all say nothing or mention 32. See attachment.
Thanks,
Paul (cousinp)


dbannon

  • Hero Member
  • *****
  • Posts: 2984
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Setting the fpc path
« Reply #1 on: August 17, 2024, 03:23:44 pm »
Paul, you would put the path, as it is on your system. Probably -

Code: Pascal  [Select][+][-]
  1. SET PATH=%PATH%;C:\lazarus\fpc\3.2.2\bin\x86_64-win64

I imagine the docs you are reading assume a 32bit system, yours is obviously 64bit.

As a test, you should be able to type something like -

Code: Pascal  [Select][+][-]
  1. dir  C:\lazarus\fpc\3.2.2\bin\x86_64-win64  <enter>

and see a list of the FPC binary files.  After you have put that PATH statement in place, you should be able to type -

Code: Pascal  [Select][+][-]
  1. fpc -h  <enter>

And see several screens of fpc help.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

cousinp

  • Newbie
  • Posts: 6
Re: Setting the fpc path
« Reply #2 on: August 18, 2024, 08:57:00 pm »
Hi dbannon,
Thank you for your help.
All your instructions worked as you predicted they should, but when I attempt to compile the pas file I get a  message that the file cannot be opened.
I'm running win10 home edition, which is supposed to be 64 bit as my system tells me. see attachments.
Thank you,
cousinp  (Paul)

dbannon

  • Hero Member
  • *****
  • Posts: 2984
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Setting the fpc path
« Reply #3 on: August 19, 2024, 02:14:59 am »
cousinp, firstly, I am not a Windows user ....

But it really looks like there is a problem with your input file, myforstObjPas.pas. Please, from the same place you ran that fpc command, you could type "dir <enter>" so we can see what the file looks like ?  Obviously, it must be present there, readable by you, not zero length.   

You would not get that error message if it contained invalid pascal code, the error would be more explicit.

Just run that dir command, copy and paste the result into a message here.  I am sure all will be revealed then.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

cousinp

  • Newbie
  • Posts: 6
Re: Setting the fpc path
« Reply #4 on: August 19, 2024, 02:49:42 am »
missing before the attached file printout.
C:\>dir
cutoff from the bottom below the '24 files' line:     14 Dir(s)  393,422,475,264 bytes free

Thanks so much for your help
Paul

dbannon

  • Hero Member
  • *****
  • Posts: 2984
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Setting the fpc path
« Reply #5 on: August 19, 2024, 02:55:26 am »
Er, maybe I am missing something here ?  I don't see myfirstObjPas.pas on that list ?   Do you expect it to be there ?

Lots of other files and it does look line you are working in an inappropriate dir but that is your choice.

I'd suggest you should bee starting in a clean, specially made for the purpose, directory, and it should contain myfirstObjPas.pas (and any other pas files your compile might need).

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

TRon

  • Hero Member
  • *****
  • Posts: 3127
Re: Setting the fpc path
« Reply #6 on: August 19, 2024, 06:11:41 am »
Just like dbannon I do not see the source file anywhere in that directory.

On Windows (as a normal restricted user) you are not even allowed to write in the system root directory and If not mistaken then FPC (or one/more of the tools in the toolchain) has issues with root-folders.

A couple of other notes:
Free Pascal and Lazarus both do not need any paths in order to work correctly. You do have to correctly configure both.

To my knowledge the path environment variable on (modern) Windows can only be set as admin and in the registry which is a PITA especially with upgrading.

My suggestion would be to make something like a script directory, add that to your path and create a batch file named fpc.bat (or fpc.cmd) that includes instructions to invoke the actual compiler. You can do that for every fpc related command that you want to run from the command-line (lazbuild, fp, etc.). Takes some time but you never have to meddle with the registry again and as a bonus you can setup things dynamically enough to be able to switch between different compiler versions on the fly.
All software is open source (as long as you can read assembler)

 

TinyPortal © 2005-2018