[opensuse] Lazarus and free pascal need ELF
Good day, I created a small app in Lazarus. Running in lazarus is fine. Running it from the command line seems it needs ELF. So does Free pascal. running in fp is fine. elf.h do exist on the system. Kindly please how to correct this "problem"? Thanks, Regards Johan Sch -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday, 2010-03-24 at 18:47 +0200, Johan wrote:
Good day,
I created a small app in Lazarus. Running in lazarus is fine. Running it from the command line seems it needs ELF.
Could you give more details? I have no problem running freepascal programs independently. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkuqqf0ACgkQtTMYHG2NR9Wn7gCfWhIJYwUE81uOHCd5qNGL+OFM pWAAn20UYBTjtN2hZMoEgrITMKAqBOaE =OzBU -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/25/2010 02:10 AM, Carlos E. R. wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wednesday, 2010-03-24 at 18:47 +0200, Johan wrote:
Good day,
I created a small app in Lazarus. Running in lazarus is fine. Running it from the command line seems it needs ELF.
Could you give more details? I have no problem running freepascal programs independently.
- -- Cheers, Carlos E. R.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAkuqqf0ACgkQtTMYHG2NR9Wn7gCfWhIJYwUE81uOHCd5qNGL+OFM pWAAn20UYBTjtN2hZMoEgrITMKAqBOaE =OzBU -----END PGP SIGNATURE-----
good day, Lazarus the following in command line.. johan@linux-v2bn:~/allprograms/Numerology/core-numbers2> . corenumbers2 If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF johan@linux-v2bn:~/allprograms/Numerology/core-numbers2> In free pascal it is like this... johan@linux-v2bn:~/allprograms/pascalprograms> . addition If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF johan@linux-v2bn:~/allprograms/pascalprograms> In both cases the programs show green in ls. johan@linux-v2bn:~> whereis elf elf: /usr/include/elf.h /usr/share/man/man5/elf.5.gz johan@linux-v2bn:~> I trust that the above may be of help. Thanks Regards Johan Sch -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Johan wrote:
good day,
Lazarus the following in command line..
johan@linux-v2bn:~/allprograms/Numerology/core-numbers2> . corenumbers2 If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF johan@linux-v2bn:~/allprograms/Numerology/core-numbers2>
In free pascal it is like this...
johan@linux-v2bn:~/allprograms/pascalprograms> . addition If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF
Johan, try this instead: ./addition -- Per Jessen, Zürich (11.3°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/25/2010 09:42 AM, Per Jessen wrote:
Johan wrote:
good day,
Lazarus the following in command line..
johan@linux-v2bn:~/allprograms/Numerology/core-numbers2> . corenumbers2 If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF johan@linux-v2bn:~/allprograms/Numerology/core-numbers2>
In free pascal it is like this...
johan@linux-v2bn:~/allprograms/pascalprograms> . addition If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF
Johan, try this instead:
./addition
Well I'll be .....?? Easy just one char added and all is well. Funny scripts do work without the / Thanks. May you have a nice day. Regards Johan Sch -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, 2010-03-25 at 12:03 +0200, Johan wrote:
On 03/25/2010 09:42 AM, Pe
Johan, try this instead: ./addition Well I'll be .....?? Easy just one char added and all is well. Funny scripts do work without the /
Scripts aren't binaries; something compiled to ELF has no interpreter [it is a real "program"]. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/25/2010 12:44 PM, Adam Tauno Williams wrote:
On Thu, 2010-03-25 at 12:03 +0200, Johan wrote:
On 03/25/2010 09:42 AM, Pe
Johan, try this instead: ./addition Well I'll be .....?? Easy just one char added and all is well. Funny scripts do work without the /
Scripts aren't binaries; something compiled to ELF has no interpreter [it is a real "program"].
Thanks. This what it looks like on a script. johan@linux-v2bn:~> ./AGnucash-save bash: ./AGnucash-save: bin/bash: bad interpreter: No such file or directory johan@linux-v2bn:~> . AGnucash-save May you have a nice day. Regards Johan Sch -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, 25 Mar 2010 21:33:00 Johan wrote:
On 03/25/2010 12:44 PM, Adam Tauno Williams wrote:
On Thu, 2010-03-25 at 12:03 +0200, Johan wrote:
On 03/25/2010 09:42 AM, Pe
Johan, try this instead: ./addition
Well I'll be .....?? Easy just one char added and all is well. Funny scripts do work without the /
Scripts aren't binaries; something compiled to ELF has no interpreter [it is a real "program"].
Thanks. This what it looks like on a script.
johan@linux-v2bn:~> ./AGnucash-save bash: ./AGnucash-save: bin/bash: bad interpreter: No such file or directory johan@linux-v2bn:~> . AGnucash-save
May you have a nice day. Regards Johan Sch
Johan, What is the first line of your script? It it: #!/bin/bash or #!bin/bash. If the second case, it is wrong, because bin/bash is a path relative to the pwd. It needs to be an absolute path /bin/bash as this is where bash resides (unless you have a custom version of bash residing in a non-standard path that you want to use to run the script for some reason). -- =================================================== Rodney Baker VK5ZTV rodney.baker@iinet.net.au =================================================== -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/25/2010 01:10 PM, Rodney Baker wrote:
On Thu, 25 Mar 2010 21:33:00 Johan wrote:
On 03/25/2010 12:44 PM, Adam Tauno Williams wrote:
On Thu, 2010-03-25 at 12:03 +0200, Johan wrote:
On 03/25/2010 09:42 AM, Pe
Johan, try this instead: ./addition
Well I'll be .....?? Easy just one char added and all is well. Funny scripts do work without the /
Scripts aren't binaries; something compiled to ELF has no interpreter [it is a real "program"].
Thanks. This what it looks like on a script.
johan@linux-v2bn:~> ./AGnucash-save bash: ./AGnucash-save: bin/bash: bad interpreter: No such file or directory johan@linux-v2bn:~> . AGnucash-save
May you have a nice day. Regards Johan Sch
Johan,
What is the first line of your script? It it:
#!/bin/bash
or #!bin/bash.
If the second case, it is wrong, because bin/bash is a path relative to the pwd. It needs to be an absolute path /bin/bash as this is where bash resides (unless you have a custom version of bash residing in a non-standard path that you want to use to run the script for some reason).
Hi Rodney, What I was trying to demonstrate here was.. 1__ ./binary .. on a binary you need the forward / (no spaces ./b*) otherwise no dice. and 2__ . script .. on a script only the dot . (a space between . and s* ) otherwise no dice. All this I only found out about 2 hrs ago by a kind person on the list. I use #!/bin/bash Thanks Regards Johan Sch -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Johan wrote:
Hi Rodney, What I was trying to demonstrate here was..
1__ ./binary .. on a binary you need the forward / (no spaces ./b*) otherwise no dice. and 2__ . script .. on a script only the dot . (a space between . and s* ) otherwise no dice.
They are two different things. You cannot call a binary with 2), but a script can be called with both 1) and 2) - the latter with the twist that any variables set by the script also set in the current process. /Per -- Per Jessen, Zürich (19.4°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Per Jessen wrote:
Johan wrote:
Hi Rodney, What I was trying to demonstrate here was..
1__ ./binary .. on a binary you need the forward / (no spaces ./b*) otherwise no dice. and 2__ . script .. on a script only the dot . (a space between . and s* ) otherwise no dice.
They are two different things. You cannot call a binary with 2), but a script can be called with both 1) and 2) - the latter with the twist that any variables set by the script also set in the current process.
2) is the same as sourcing a script, i.e. to execute it without forking a new shell process. -- Per Jessen, Zürich (19.1°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, 2010-03-25 at 13:41 +0100, Per Jessen wrote:
Hi Rodney, What I was trying to demonstrate here was..
1__ ./binary .. on a binary you need the forward / (no spaces ./b*) otherwise no dice. and 2__ . script .. on a script only the dot . (a space between . and s* ) otherwise no dice. They are two different things. You cannot call a binary with 2), but a script can be called with both 1) and 2) - the latter with the twist
Johan wrote: that any variables set by the script also set in the current process.
Per Jessen wrote: 2) is the same as sourcing a script, i.e. to execute it without forking a new shell process.
Which unless you know what you are doing is *not* how you want to run
scripts. If you want to run an application or a script in the current
directory always use "./{filename}".
The rule is simplIf you don't know what "sourcing" and "forking" mean
don't use ". {filename}" unless instructed to do so by someone who knows
what "sourcing" and "forking" mean.
--
Adam Tauno Williams
On 03/25/2010 02:59 PM, Adam Tauno Williams wrote:
On Thu, 2010-03-25 at 13:41 +0100, Per Jessen wrote:
Hi Rodney, What I was trying to demonstrate here was..
1__ ./binary .. on a binary you need the forward / (no spaces ./b*) otherwise no dice. and 2__ . script .. on a script only the dot . (a space between . and s* ) otherwise no dice. They are two different things. You cannot call a binary with 2), but a script can be called with both 1) and 2) - the latter with the twist
Johan wrote: that any variables set by the script also set in the current process.
Per Jessen wrote: 2) is the same as sourcing a script, i.e. to execute it without forking a new shell process.
Which unless you know what you are doing is *not* how you want to run scripts. If you want to run an application or a script in the current directory always use "./{filename}".
The rule is simplIf you don't know what "sourcing" and "forking" mean don't use ". {filename}" unless instructed to do so by someone who knows what "sourcing" and "forking" mean.
Well, Well, this is what happens when you think you know and actually don't. I am grateful for your detailed explanation. Now at keast I do know some more. Thanks, Regards Johan Sch -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 25 March 2010 11:03:37 Johan wrote:
On 03/25/2010 09:42 AM, Per Jessen wrote:
Johan wrote:
good day,
Lazarus the following in command line..
johan@linux-v2bn:~/allprograms/Numerology/core-numbers2> . corenumbers2 If 'ELF' is not a typo you can use command-not-found
to lookup the package that contains it, like this: cnf ELF
johan@linux-v2bn:~/allprograms/Numerology/core-numbers2>
In free pascal it is like this...
johan@linux-v2bn:~/allprograms/pascalprograms> . addition If 'ELF' is not a typo you can use command-not-found to lookup the
package that contains it, like this: cnf ELF
Johan, try this instead:
./addition
Well I'll be .....??
Easy just one char added and all is well.
Funny scripts do work without the /
dot followed by space followed by a script does something different than dot followed by "/" followed by script The first one "sources" the script - and it fails to source the elf binary. Just always use ./name, Andreas -- Andreas Jaeger, Program Manager openSUSE, aj@{novell.com,opensuse.org} Twitter: jaegerandi | Identica: jaegerandi SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Maxfeldstr. 5, 90409 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
On 3/25/2010 6:03 AM, Johan wrote:
On 03/25/2010 09:42 AM, Per Jessen wrote:
Johan wrote:
good day,
Lazarus the following in command line..
johan@linux-v2bn:~/allprograms/Numerology/core-numbers2> . corenumbers2 If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF johan@linux-v2bn:~/allprograms/Numerology/core-numbers2>
In free pascal it is like this...
johan@linux-v2bn:~/allprograms/pascalprograms> . addition If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF
Johan, try this instead:
./addition
Well I'll be .....??
Easy just one char added and all is well.
Funny scripts do work without the /
No they don't, at least they don't do what you think they are doing that way. In a bourne shell interpreter, which is what you are in while you are logged in and sitting at a command prompt, the syntax "dot space filename" does not execute the file, it sources the file. That means it reads the file and pretends that you typed in it's contents at the prompt you are sitting at. It has the effect that your current shell instance ends up directly executing the commands, which may look and smell like the normal way a script or program is executed, but it's in fact quite different. Sourcing a file is usually meant for a script to read in some variables from another file and have those variables set in the current shells environment. So for one example, 10 different scripts could all read the same set of settings from a single file, so you could have one file with settings in it and 10 scripts that each just sourced the settings file. Where otherwise you'd have to write those variables in 10 different scripts, and remember to change them all later when something needs to change. But it works for any valid shell commands not just setting variables and that has many uses in special situations. You can define a whole function or performs all kinds of programming logic to set variables dynamically etc. You do not use the sourcing mechanism simply to run shell scripts. You run them the same way you'd run any other kind of executable. If you tried to source a binary or a perl script it would not work (as you found out) and might not be harmless in the way it failed either (as you were lucky enough this time not to find out). The simplest example of why this is "wrong" even though it seems to "work for scripts" would be to look at any typical script that has an exit command. #!/bin/sh echo "Hello there, I'm going away now." exit If you run that script any of the proper ways, by making it executable and executing it, or by executing "sh" and giving this scripts filename as a commandline argument to sh, example: chmod 755 hello ./hello or sh hello Then it does what you'd expect. It prints the message and your prompt is returned. If you source this script instead, example: . hello It would print the message and immediately log you off the system or close the xterm you were using. The difference is, when you run a program, be it a binary or a perl script or shell script or other, it runs in a new process which is a child of your shell process (your command prompt). The exit command in the script just causes the child process to die, and control returns to your shell and you get a new prompt. That's normal. Every program has an exit somewhere. It's often omitted from scripts because once there is no more script file to read the shell will exit by itself as if there had been an exit command. If it didn't do that it'd just hang there forever. When you source a file, your _current_ shell process interprets the commands itself directly, no child process. When it reaches that exit, it's exactly the same as if you typed exit and hit enter, which closes your window or logs you off the system, depending on how your are connected. It's also wrong because script authors know that the script is running in it's own new child environment which is destroyed at the end, so they are free to do almost anything, including setting environment variables, cd-ing to other directories, changing the shells behaviour, because none of that will affect the parent process that ran the script. A script might cd to /tmp, disable filename globbing, and change the LOGNAME or USER or LANG environment variables to suit the needs of whatever task it's doing. If you source that script instead of run it, your current login shell is modified with all those changes, which will screw up everything you try to do from that point on until you log off and log back in. -- bkw
Thanks. May you have a nice day. Regards Johan Sch
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 03/25/2010 09:08 PM, Brian K. White wrote:
On 3/25/2010 6:03 AM, Johan wrote:
On 03/25/2010 09:42 AM, Per Jessen wrote:
Johan wrote:
good day,
Lazarus the following in command line..
johan@linux-v2bn:~/allprograms/Numerology/core-numbers2> . corenumbers2 If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF johan@linux-v2bn:~/allprograms/Numerology/core-numbers2>
In free pascal it is like this...
johan@linux-v2bn:~/allprograms/pascalprograms> . addition If 'ELF' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf ELF
Johan, try this instead:
./addition
Well I'll be .....??
Easy just one char added and all is well.
Funny scripts do work without the /
No they don't, at least they don't do what you think they are doing that way.
In a bourne shell interpreter, which is what you are in while you are logged in and sitting at a command prompt, the syntax "dot space filename" does not execute the file, it sources the file.
That means it reads the file and pretends that you typed in it's contents at the prompt you are sitting at.
It has the effect that your current shell instance ends up directly executing the commands, which may look and smell like the normal way a script or program is executed, but it's in fact quite different.
Sourcing a file is usually meant for a script to read in some variables from another file and have those variables set in the current shells environment. So for one example, 10 different scripts could all read the same set of settings from a single file, so you could have one file with settings in it and 10 scripts that each just sourced the settings file. Where otherwise you'd have to write those variables in 10 different scripts, and remember to change them all later when something needs to change. But it works for any valid shell commands not just setting variables and that has many uses in special situations. You can define a whole function or performs all kinds of programming logic to set variables dynamically etc.
You do not use the sourcing mechanism simply to run shell scripts. You run them the same way you'd run any other kind of executable. If you tried to source a binary or a perl script it would not work (as you found out) and might not be harmless in the way it failed either (as you were lucky enough this time not to find out).
The simplest example of why this is "wrong" even though it seems to "work for scripts" would be to look at any typical script that has an exit command.
#!/bin/sh echo "Hello there, I'm going away now." exit
If you run that script any of the proper ways, by making it executable and executing it, or by executing "sh" and giving this scripts filename as a commandline argument to sh, example: chmod 755 hello ./hello or sh hello
Then it does what you'd expect. It prints the message and your prompt is returned.
If you source this script instead, example: . hello
It would print the message and immediately log you off the system or close the xterm you were using.
The difference is, when you run a program, be it a binary or a perl script or shell script or other, it runs in a new process which is a child of your shell process (your command prompt). The exit command in the script just causes the child process to die, and control returns to your shell and you get a new prompt. That's normal. Every program has an exit somewhere. It's often omitted from scripts because once there is no more script file to read the shell will exit by itself as if there had been an exit command. If it didn't do that it'd just hang there forever. When you source a file, your _current_ shell process interprets the commands itself directly, no child process. When it reaches that exit, it's exactly the same as if you typed exit and hit enter, which closes your window or logs you off the system, depending on how your are connected.
It's also wrong because script authors know that the script is running in it's own new child environment which is destroyed at the end, so they are free to do almost anything, including setting environment variables, cd-ing to other directories, changing the shells behaviour, because none of that will affect the parent process that ran the script.
A script might cd to /tmp, disable filename globbing, and change the LOGNAME or USER or LANG environment variables to suit the needs of whatever task it's doing. If you source that script instead of run it, your current login shell is modified with all those changes, which will screw up everything you try to do from that point on until you log off and log back in.
Good day Brian, You must be a good teacher. The above is a good example of a person that will be a good teacher. I do really appreciate the work you have done to put me on the right track. I have been lucky so far not to have screwed up my system. I tested your little script and it does exactly what you predicted. Big thanks, May you have a very nice day, Regards Johan Sch -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (7)
-
Adam Tauno Williams
-
Andreas Jaeger
-
Brian K. White
-
Carlos E. R.
-
Johan
-
Per Jessen
-
Rodney Baker