pi-build icon indicating copy to clipboard operation
pi-build copied to clipboard

Best practice for executables

Open JaySheepdog-N0SR opened this issue 4 years ago • 3 comments

Instead of using ~/bin for executable files & scripts, should consider placing them in /usr/local/bin which is the standard directory for added on program executable files. You will notice that when building the FLdigi suite from source that this is where the files reside. This will eliminate issues for those of us who do not use the “pi” user on our RasPi but may have run the script as the pi user initially.

JaySheepdog-N0SR avatar Mar 04 '20 08:03 JaySheepdog-N0SR

I would agree that /usr/local/bin should be the place for all locally built binaries and would suggest one more thing...unless you are debugging the binary executables and shared libraries (using a debugger like gdb for instance) there is no reason to have the debugging information. To strip the binaries you would type: sudo strip fldigi As an example after compiling and installing fldigi the main executable is 85.767.936 bytes or 85.8 MB and after it is 6197000 bytes or 6.2 MB in size. This won't change the amount of RAM that is used during runtime, but it does save on sd card space! This also works on shared libraries. To get all the files in a directory like /usr/local/bin you could: cd /usr/local/bin sudo strip * You can always examine the file types and whether or not they've been stripped using: cd /usr/local/bin file *

73 de KN4FTT

Swift34 avatar Mar 08 '20 22:03 Swift34

I was looking this up recently and it appears that maybe /opt/ would be the best directory to install binaries that also have folders and files included with them. https://askubuntu.com/questions/6897/where-to-install-programs

WheezyE avatar Apr 10 '20 19:04 WheezyE

The FHS that is referred to is deprecated (written in 2003) and the discussion referred to is from 2010.

That being said, there are a few software developers who still install into /opt but the majority use the /use/local hierarchy. Binary files go into /use/local/bin and supporting files go to /use/local/share/

If you examine these directories, you’ll see that the fldigi suite of files go here as well as Xastir and many others.

Consistency is key, from an administrator’s standpoint, so if you install into /opt you should install everything into /opt. The best installation scripts give the option as to where to put the installed files for a given package, but this is not the norm.

I still contend, from my years as a Unix administrator and current industry practices, that /use/local is the most appropriate location for application installs. 73 N0SR

On Fri, Apr 10, 2020 at 13:41, WheezyE [email protected] wrote:

I was looking this up recently and it appears that maybe /opt/ would be the best directory to install binaries that also have folders and files included with them. https://askubuntu.com/questions/6897/where-to-install-programs

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

JaySheepdog-N0SR avatar Apr 10 '20 21:04 JaySheepdog-N0SR