Geany execute problem

New to FreeBASIC? Post your questions here.
Post Reply
mark bower
Posts: 395
Joined: Dec 28, 2005 6:12
Location: arcadia, CA USA

Geany execute problem

Post by mark bower »

Ubuntu 20.04/Geany 1.36

I place a file.BAS file on the desk top either by copying one already on the Desktop, or by modifying in Geany and saving to the Desktop. Thus the file is located at /home/mark/Desktop.

Within Geany I browse to locate file.BAS on the Desktop. Geany opens it. When I try to execute it (interpreted, not compiled), Geany balks and generates as below the pop-up error msg suggesting it is located at root:
uxterm

/tmp/geany_run_script_B9Y3W1.sh: 7: ./DATALOG_rev6.3_10Dec22: not found

------------------------
(program exited with code: 127)
Press return to continue
Suggestions please to alleviate this problem. I do not believe I had this problem a number of years ago, and by fiddling I have had success, but just haven’t been able to figure out how I got it to work. There must be a simple answer?
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Geany execute problem

Post by fxm »

FreeBASIC has no interpreter.
Under Geany, you must first compile any new or modified *.bas file.
mark bower
Posts: 395
Joined: Dec 28, 2005 6:12
Location: arcadia, CA USA

Re: Geany execute problem

Post by mark bower »

I may not have used the correct terminology, BUT Geany does run/execute a .BAS file. My program reads outputs from two HP meters just fine, when all is right - it takes a bit of doing with permissions - that which you folks in the past have helped me with.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Geany execute problem

Post by fxm »

No, Geany does not execute a .bas file. You must first compile it.
mark bower
Posts: 395
Joined: Dec 28, 2005 6:12
Location: arcadia, CA USA

Re: Geany execute problem

Post by mark bower »

Do we have a disconnect? A look at the Geany icon-toolbar: 1)there is an icon with an arrow going from a pentahedron to a circle and 2) a "cog-wheel" icon. (I am color blind so do not offer colors)

If I hover over the "arrowed" icon, it says "Compile the current file". If I hover over the "cog-wheel" icon, it says "Run or view the current file".

I can launch with the "cog-wheel" icon and my .BAS program runs just fine. Make changes - run. Make changes - run. etc. Then compile to run without Geany. So what do I not understand?
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Geany execute problem

Post by dodicat »

I use Geany for pascal (.pas)
The problem with this type of ide (with no temp files created / destroyed via a quick run), is that the last good .exe file lingers, so if your program runs straight off the cog wheels then you must have a .exe somewhere from before, i.e. you have pressed the compile icon at sometime, maybe today or last week.
My Geany runs .bas files also of course.
Windows gives this with uncompiled myfile.bas file, and clicking the cogs :
'"./myfile"' is not recognized as an internal or external command,
operable program or batch file.

IMHO an ide should be able to delete any temporary .exe files using a quick run option.
Otherwise, to be 100% sure of any code updates performing properly, you have to manually delete any previous .exe file.
mark bower
Posts: 395
Joined: Dec 28, 2005 6:12
Location: arcadia, CA USA

Re: Geany execute problem

Post by mark bower »

@ dodicat

Your comments sent me in the right direction and am back to where I was a few years ago, working with Geany with no problems - other than awkwardness you allude to. Let me describe the steps I take and what I observe. I am calling the starting program used file.BAS which executes with Geany and is fully executable. The permission codes are essential, they work, thoh may not be coded perfectly.

Here goes:
Definitions:
fully executable – program runs and initiates meters for data(volts) capture
partially executable - program runs, but does not initialize meters for data (volts) capture
Geany
open it with no programs

Desktop
file.BAS(fully executable) copy to (copy).BAS
change name to copy.BAS

Geany
open copy.BAS
run copy.BAS – get error msg, does not run
compile copy.BAS ---> copy.EXE on Desktop
run copy.BAS – runs, BUT is only partially executable
close Geany

Desktop
run copy.EXE – runs, BUT is only partially executable

Terminal
cd Desktop
sudo chown copy.EXE
sudo chmod -R -f 4777 copy.EXE
exit terminal

Desktop
run copy.EXE, fully executable

Geany
find it empty, no programs
open copy.BAS – fully executable
So, I am very happy to be programming again without aggravation wrt Geany. However, considering fxm's input and your comments, I ask the following: Am I correct that after I have done the above, then make changes to copy.BAS in Geany, that when I run the .BAS in Geany it is actually compiling it behind the scenes before running it, thoh it appears to be running as copy.BAS?

[edit]
And this morning the "Coup de Grace". I deleted the copy.EXE from the Desktop, then went to Geany and tried to execute copy.BAS. Sure enuf, it would not execute and generated the error msg. Just what you said: the compiled program must be "present in the background" in order for the .BAS to work in Geany. It does seem like strange behavior.
Last edited by mark bower on Dec 12, 2022 16:36, edited 1 time in total.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Geany execute problem

Post by dodicat »

I haven't used Linux for a few years.
Your terminal commands
cd Desktop
sudo chown copy.EXE
sudo chmod -R -f 4777 copy.EXE
exit terminal

So your permissions are independent of fb.
It would seem a pity for you to renew the permissions at every compile.

Instead of using your desktop folder, create a new folder in your home folder and name it bin.
This bin folder will have different properties than any old folder, for one, it will be on your system path, and executables in the bin folder will run from anywhere.
(This used to be the case anyway.)
Maybe the permissions will remain stable also, you will have to test.

Member badidea is an experienced Geany + Linux user.
Maybe he will chip in.

I cannot visualize Geany doing any secret compiles in the background.
pidd
Posts: 31
Joined: Nov 11, 2022 16:27

Re: Geany execute problem

Post by pidd »

mark bower wrote: Dec 11, 2022 21:05 Do we have a disconnect? A look at the Geany icon-toolbar: 1)there is an icon with an arrow going from a pentahedron to a circle and 2) a "cog-wheel" icon. (I am color blind so do not offer colors)

If I hover over the "arrowed" icon, it says "Compile the current file". If I hover over the "cog-wheel" icon, it says "Run or view the current file".

I can launch with the "cog-wheel" icon and my .BAS program runs just fine. Make changes - run. Make changes - run. etc. Then compile to run without Geany. So what do I not understand?
That can a bit misleading, by default the run will run the last compiled copy of the program, not the .bas file currently on the screen. It runs the compiled file, not the source file.

You can probably alter that behaviour by adding a compile to the execute command in the build settings.
mark bower
Posts: 395
Joined: Dec 28, 2005 6:12
Location: arcadia, CA USA

Re: Geany execute problem

Post by mark bower »

You are correct - I have to add permissions for each compiled revision as I improve the program code. The code includes the command "ioperm", but that does not do the trick for the meters and RS232 to USB connection.
So your permissions are independent of fb.
It would seem a pity for you to renew the permissions at every compile.
However, I can live with the "burden" now that I have a clear picture of what is going on. Funny, for all my use of Geany a few years back that I did not remember the process. But now I have detailed the process in a saved document.

I may try what you suggest, but admittedly my programming is minimal. I am just trying to make cosmetic improvements to a datalog program. However, having not worked with the code for a few years, so much of the code baffles me. A good portion of the code came from FB supporters such as yourself and some of the code I never mastered, such as ThreadCreate.

Thanks again for your support.
mark bower
Posts: 395
Joined: Dec 28, 2005 6:12
Location: arcadia, CA USA

Re: Geany execute problem

Post by mark bower »

@pidd
My hat is off to you. You have filled in an extremely important point, and for all my use, something I did not uncover; I immediately tested what you said:
That can a bit misleading, by default the run will run the last compiled copy of the program, not the .bas file currently on the screen. It runs the compiled file, not the source file.
Now I understand why I make changes to the .BAS in Geany, but wondering why they do not show up; I have assumed I was making a coding error. And then seemingly(by luck), I compile at some point so changes do take place, but not realizing this was do to compiling. I have wasted hours in wondering why the changes are not taking place. I will now just compile after each set of changes. The only problem is the program will not fully execute (Geany or compiled) until I change permissions of the compiled code - however, all the meter read "stuff" is "static", works great with no coding changes.

The cardinal rule:
The compiled program must be present for the .BAS program to run in Geany. Permissions must be given to the copy.EXE on the Desktop in order for copy.BAS to be fully executable in Geany. Stated differently: in order for copy.BAS to be fully executable in Geany, copy.EXE on the Desktop must be given full permissions.

And now, at last, I believe with your comments and others I have a good grasp on what takes place. And your comments fortify what the others have said in previous posts. This has been a very satisfying thread.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Geany execute problem

Post by badidea »

dodicat wrote: Dec 12, 2022 16:36Member badidea is an experienced Geany + Linux user.
A bit busy with other things these day. I did not read the whole topic (just noticed my user name). If the issue has not been solved yet, check out these topics on Geany:
- Geany to compile FB source code on Windows?
- Using Geany in Linux - Screen shot plz
- Geany FBC Build Command Not Working
- how to use Geany (Lubuntu)
On my todo-list is still writing the "ultimate using freebasic with geany" guide, but not for today.
Post Reply