How to run an application without installing

I want to be able to run an application without installing it and can't figure out how to do it. Basically I want to find all the dependencies of a particular program and then copy them along with the progam to a USB stick so that I can insert the USB stick, mount it and run 'myprog.sh' which would be a stub for setting the correct paths and any other required environment variables and then launching 'myprog'.

Is this doable?
 
To build a freestanding app you can compile a port with MAKE_ARGS+=STATIC=1 in the makefile.
You must also add the argument to every leaf port (And every leaf port of the leaf).

So you better off splitting the ports branch off to a private build for static builds. That way you don't contaminate your entire ports tree. You could also just copy the ports needed to a private tree instead of the whole tree.

I have sysutils/flashrom on USB stick. I made a seperate ports tree and compiled the port with STATIC.
After chasing the dependencies it worked.. Copied it from build machine to USB stick.
I can copy it to any FreeBSD 9,10,11,12 install and run it. Maybe even earlier versions too.
Basically STATIC compile adds all the libraries internally, making a bigger executable.
https://forums.freebsd.org/threads/make-a-stand-alone-application.66341/
 
Last edited:
Another XY problem.

Please explain in more detail what you are trying to do. What do you mean by "application" ???

I have many applications I have written and downloaded. Typical examples include C++ programs and python scripts. I don't "install" them, I compile or prepare them, and then run them. Sometimes they can be run directly, in the directory the executable is stored in. Sometimes I copy the executable to /usr/local/bin/ or ~/bin/ to make it easier to access. Sometimes I wrap them in shell scripts to streamline them.

Finding and fulfilling dependencies is part of step "compile and prepare".
 
Back
Top