Score:-2

Are binary executables portable?

cn flag

Consider I have a binary executable file (like ffmpeg). Can I just copy that file to another machine running Ubuntu for using it? Will it just work or might it face problems?

user535733 avatar
cn flag
Many executable files depend upon the existence of other libraries, applications, config files, etc. If the application expects to find those dependencies, and they are missing, then the application might crash unexpectedly. This is why most software is *packaged*, clearly including --or directly referencing-- those dependencies.
james hofer avatar
cn flag
Yes was thinking the same. So there's no way to create a stable portable file?
user535733 avatar
cn flag
Sure there is. There are several. But that's not the broad, hypothetical question you asked above. If you have a specific question, open a new question asking that with details.
hr flag
@jameshofer to be independent of external libraries, an executable would need to be *statically linked* rather than *dynamically linked* at build time.
james hofer avatar
cn flag
Thanks guys. Yes it's a different topic. I prefer to search on web, rather than opening a new question. I might find a solution. @user535733 I think your comment is needed as an answer cause it's useful.
ru flag
This is way too broad a question in its current form so I have closed it as needing clarity. This is too broad to answer within the scope of Ask Ubuntu as currently written.
james hofer avatar
cn flag
@ThomasWard I don't think it's too broad. People might have the same question. And other users mentioned good points about it. "It might be or might not, based on libraries and versions etc.".
ru flag
@jameshofer when the answer is "It Depends" - as it really does depend on that - it's very broad and *not* able to be answered within one post. As said elsewhere, if you are asking how to compile something statically linked then that's its own question and that's technically the *only* way to make a portable application, unless you use a container service like snaps or appimages that create a complete 'package' of the program and its dependencies available (or can download those read-only dependencies like in snaps)
Score:2
cn flag

If other machines have the same architecture, e.g. amd64, then you can use binary executable files without any problems.

But obviously if the binary requires some libraries, or something else to run, it may throw errors and quit.

ru flag
I would not agree with your statement. Because it is entirely dependent on the version of libraries installed on each machine to determine if a portable executable will actually function when moved to another system post-compilation.
Pilot6 avatar
cn flag
Well, you are correct in general. But the question is too general as well. Any binary will run, but it may have errors if something is missing.
ru flag
then I would suggest that the question is "too broad" to be answered properly here and should be closed, not answered.
Pilot6 avatar
cn flag
I agree............
Dave Ankin avatar
cn flag
you could find the other libraries via - https://unix.stackexchange.com/a/120017 - or the other, say, config files by `dpkg -L $package_name`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.