litaboss
Posts: 4
Joined: Fri Feb 02, 2018 6:20 pm

How to execute installed program

Fri Feb 02, 2018 6:28 pm

Hello, I just installed Free Pascal on my first-day Stretch and have some problems with finding Pascal folder and the way to execute it.
I used this command:

Code: Select all

sudo apt-get install fpc
I had no problems with a downloading or installing.
Please, can you tell me how to find and execute this program (actually, I was looking for something like *.exe in Win because it is my first day in Linux at all). I was looking through the forums but nobody even dont ask such a stupid questions. Thanks anyway

User avatar
rpdom
Posts: 12810
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: How to execute installed program

Fri Feb 02, 2018 7:03 pm

Just type fpc and some options on the command line. You don't need to find the file to run it, it just has to be in your PATH.

To find out what options are required you can look at the man page (man fpc)

litaboss
Posts: 4
Joined: Fri Feb 02, 2018 6:20 pm

Re: How to execute installed program

Fri Feb 02, 2018 7:24 pm

rpdom wrote:
Fri Feb 02, 2018 7:03 pm
Just type fpc and some options on the command line. You don't need to find the file to run it, it just has to be in your PATH.

To find out what options are required you can look at the man page (man fpc)
Okay, thanks, I read this article, but It didnt solve my problem. In spite of knowledge of these commands I still cant start Pascal interface as, for example, on this screenshot: https://elinux.org/images/3/3e/Free_Pas ... rry_Pi.png

hippy
Posts: 3786
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to execute installed program

Fri Feb 02, 2018 7:44 pm

litaboss wrote:
Fri Feb 02, 2018 7:24 pm
I still cant start Pascal interface as, for example, on this screenshot: https://elinux.org/images/3/3e/Free_Pas ... rry_Pi.png
I'm not familiar with FPC on the Pi, but is that the Lazarus IDE rather than FPC ? My understanding is FPC is just the compiler, Lazarus is the IDE.

There might be a better forum section to ask in.

litaboss
Posts: 4
Joined: Fri Feb 02, 2018 6:20 pm

Re: How to execute installed program

Fri Feb 02, 2018 8:09 pm

hippy wrote:
Fri Feb 02, 2018 7:44 pm
litaboss wrote:
Fri Feb 02, 2018 7:24 pm
I still cant start Pascal interface as, for example, on this screenshot: https://elinux.org/images/3/3e/Free_Pas ... rry_Pi.png
I'm not familiar with FPC on the Pi, but is that the Lazarus IDE rather than FPC ? My understanding is FPC is just the compiler, Lazarus is the IDE.

There might be a better forum section to ask in.
I do need Pascal anyway, even if it is only the complier. Okay, I will try to ask this question in another section, but till there would be somebody to help I will stay there.
Lets forget about Pascal and focus on a random program. How do I execute it and how can I create a shrtcut on the desktop (dont think I am stupid, but this question is really difficult for Winman, because in Win we have a choice between to create shortcut or not to create)?
Thanks.

ghans
Posts: 7793
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: How to execute installed program

Fri Feb 02, 2018 9:33 pm

Package management is fundamental to Linux distros. Downloading precompiled binaries
from project pages is the exception not the rule. Installers are therefore not necessary in the general case.

Please use "Synaptic" or "Add/remove software" to search for Lazarus and to install it. You should neither run nor install software in random places but let package management handle it all for you.


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

litaboss
Posts: 4
Joined: Fri Feb 02, 2018 6:20 pm

Re: How to execute installed program

Sat Feb 03, 2018 11:36 am

ghans wrote:
Fri Feb 02, 2018 9:33 pm
Package management is fundamental to Linux distros. Downloading precompiled binaries
from project pages is the exception not the rule. Installers are therefore not necessary in the general case.

Please use "Synaptic" or "Add/remove software" to search for Lazarus and to install it. You should neither run nor install software in random places but let package management handle it all for you.


ghans
The thing is that I have no problem with installing or downloading packages. I have a problem where to find this programs and how to execute it. In other articles the people does see this programs in the menu after downloading and unpacking. I checked via "Add/remove software" utility that Pascal is already installed (because I did it using the command line). But how can I find Pascal and its shortcut on my computer?

User avatar
DougieLawson
Posts: 33816
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: How to execute installed program

Sat Feb 03, 2018 11:39 am

Use the which programnamegoeshere command to find things that or on your PATH.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

ghans
Posts: 7793
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: How to execute installed program

Sat Feb 03, 2018 1:44 pm

The Free Pascal Compiler is a pure commandline program. Lazarus is a graphical IDE and
installing Lazarus via package management will add a shortcut to the "Start" menu.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Heater
Posts: 9836
Joined: Tue Jul 17, 2012 3:02 pm

Re: How to execute installed program

Sat Feb 03, 2018 1:59 pm

What nobody is going to tell how to run Free Pascal?

1) Open up a command line terminal. You will see a command line prompt like: 2) Type the command for the Free Pascal compiler: You will see a message like so:

Code: Select all

Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Followed by a ton of useful help.

3) Now that you know it is installed and runs correctly will want to compile your program:

Code: Select all

[email protected]:~$ fpc myProg.pas
You may well need to add some options to that command depending on what you want to do. See the help messages.

fpc is a command line program so you won't see it show up as an icon or menu item in a GUI.

If you have the Lazarus IDE installed I presume that is in a menu or icon some place. Sorry I have no idea. I never use Lazarus.

If we forget pascal for a moment and think of a random program, as you suggest, then the same applies. If it is a command line program and is installed the normal way you will need to open a terminal and type the command name. It will not show up any GUI.

n67
Posts: 800
Joined: Mon Oct 30, 2017 4:55 pm

Re: How to execute installed program

Sat Feb 03, 2018 2:31 pm

If you have the Lazarus IDE installed I presume that is in a menu or icon some place. Sorry I have no idea. I never use Lazarus.
I think that's the gist of the problem. That OP is a "I like GUIs" kinda guy, and all the responders are, as is always the case on boards like this, "I spit on GUIs" guys.

In the real world (away from Unix/Linux), people expect a click-something-and-go interface, and they consider the GUI to the *BE* the program. I.e., when normal people think of running the Visual Basic program, they really, really mean clicking on some icon on their desktop and it brings them into Visual Basic. That that icon might actually be labeled something like "Visual Studio" is irrelevant.

It is hard to get past this expectation. Maybe we should stop trying...
"L'enfer, c'est les autres"

If a post offends you, just put that poster on your foes list, and be done with it (and with them).

To do otherwise, risks being banned.

jahboater
Posts: 2928
Joined: Wed Feb 04, 2015 6:38 pm

Re: How to execute installed program

Sat Feb 03, 2018 2:35 pm

ghans wrote:
Sat Feb 03, 2018 1:44 pm
The Free Pascal Compiler is a pure command line program.
This is the key.
Thats why Heater gently explained how to run it from the command line.
Its not difficult.


Heater
Posts: 9836
Joined: Tue Jul 17, 2012 3:02 pm

Re: How to execute installed program

Sat Feb 03, 2018 4:23 pm

n67,
I think that's the gist of the problem. That OP is a "I like GUIs" kinda guy, and all the responders are, as is always the case on boards like this, "I spit on GUIs" guys.
I'm not sure about that. The OP specifically asked about running fpc. Which s a command line program. A question I tried to answer as best I could. Then about other "random" program. It's not so clear if GUI is an important part of the question.

I don't spit on GUI's. I use them all the time. Sometimes they are even useful in software development. Like when laying out forms in a GUI application, but who does that anymore?

I do like being able to build a program without all all the complexity of an IDE.
It is hard to get past this expectation. Maybe we should stop trying...
No... even Microsoft came to its senses and put a BASH shell into Windows 10. Thus making it a tolerably useable operating system.

mungosyme
Posts: 1
Joined: Sat Feb 03, 2018 5:38 pm

Re: How to execute installed program

Sat Feb 03, 2018 5:48 pm

From the link that the OP posted it seems that he wants the FreePascal IDE, not Lazarus. In a shell he needs to type fp (not fpc). This starts the IDE which is similar to the original Turbo pascal IDE. As previously stated fpc starts the command line compiler.

hippy
Posts: 3786
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to execute installed program

Sat Feb 03, 2018 9:10 pm

n67 wrote:
Sat Feb 03, 2018 2:31 pm
I think that's the gist of the problem. That OP is a "I like GUIs" kinda guy, and all the responders are, as is always the case on boards like this, "I spit on GUIs" guys.
I disagree. No matter whether one likes GUIs or not it doesn't alter the fact that installing a command line only tool won't provide a link, icon, menu option or shortcut to launch something which has not been installed.

The main problem is the OP appears to have believed that installing FPC should have installed an IDE. My understanding is it doesn't. That's a separate installation.

Sheepdog
Posts: 14
Joined: Sun Aug 21, 2016 7:44 pm

Re: How to execute installed program

Fri Aug 10, 2018 3:39 am

Wow! THAT brought back memories!! I am a long-time fan of Pascal... going back to the days of Turbo Pascal in the early 1990s... late 1980s?

Anyway.... I hope the following will shed light on the discussion above. Most of what I'm going to say was mentioned at some point, but I hope the following will pull things together.

a) Once upon a time, "Pascal" was invented. This was before ANYONE had GUIs to like or loath, depending on your point of view.

b) A very successful early Pascal was Turbo Pascal from what was then called Borland.

If you are a Pi user, just getting going with programming, I would strongly recommend Lazarus to you. When you install Lazarus, you get a huge package which will allow you to create things for the Windows-like Raspbian. See...

https://www.tweaking4all.com/hardware/r ... erry-pi-2/

... but don't worry about the warnings that the simple install system won't work on Pi 3's. Those warnings are dated. You just do...

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fpc
sudo apt-get install lazarus
Once you've done that, look in the @Programming" part of the Raspbian main menu. You should see an entry for Lazarus. Click on that to start the Lazarus IDE (Integrated Development Environment). If you mean "the thing I use to write programs to run in the Raspbian QUI environment", then that's how.

Make yourself a little "hello world" program. (Help at http://sheepdogguides.com/lut/index.htm)

That will create a Raspbian friendly program. You merely drill down to it with the File Manager, and double click, and the program you wrote fires up.

---------
That's probably all you'd WANT to do. But, in case I misunderstood, here are other answers...

"Underneath" Lazarus is the Free Pascal Compiler system. If you don't WANT to-run-in-the-GUI programs, you go into the CLI, and type fp (not fpc). That starts what prompted my comment about memories. That starts a program which will let you write things which will run in the CLI. Rather crude things! But they may be what you want! It is sort of GUI like, in that you have menus, etc. But MUCH more basic. We'll get to "how to start something created this way" in a moment.

First I want to point out that Lazarus is MUCH MORE than just a "pretty face" for the underlying Pascal compiler. Lazarus has some amazing things which make it painless to create buttons on forms, have events handled, etc, etc. It really is the place to put your energies in 2018.

So... back to the "old skul"... let's see if I can remember how it is done!...

In the CLI, after doing the installs suggested, enter fp.

Use File/New from Template/ Program to start a new app. Enter MyFirstPascal ihn answer to the "Fill in template parameter: Program" request. ... Oh heck. Got this far, couldn't get the little app to compile. "Error while linking". But for LAZARUS, my system works fine.

ANYWAY... if you can overcome the "Error while linking", you can create little things to run under the CLI. If you do, I believe that the compiler will create executables... so you'd just type their name at the command prompt to launch them. Or, as I recall... it was a long time ago... fpc myprogram.pas to re-compile the soucecode... not something you'd normally do.

If someone can guide me past the "Can't link", I'd be grateful. It would be fun to write a program or two "the old way", for old time's sake!
New to Pi and Linux generally... old to computers. Using Raspbian 9 (Stretch) on a Pi 3 B (ver 1.2), apt-get update, apt-get upgrade at least as recently as 5 Aug 2018

Return to “Other programming languages”

Who is online

Users browsing this forum: No registered users and 7 guests