Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

DenBeke

macrumors regular
Original poster
Aug 11, 2011
192
8
Antwerp
Are there tools available that make an executable portable by getting all the libraries, putting them in a folder and change the paths in the executable?

I want to be able to give a folder with an executable to someone else, who hasn't any developer tools/SDK's.

How to solve this?
 

0d085d

macrumors regular
Apr 23, 2015
154
12
Possibly with the patchelf tool: https://nixos.org/patchelf.html

You'll want to set the linker search path as in the example:

Code:
patchelf --set-rpath /opt/my-libs/lib:/foo/lib executable

You can list the libraries used by the executable if you don't already know them:

Code:
ldd executable
 

DenBeke

macrumors regular
Original poster
Aug 11, 2011
192
8
Antwerp
What does
Possibly with the patchelf tool: https://nixos.org/patchelf.html

You'll want to set the linker search path as in the example:

Code:
patchelf --set-rpath /opt/my-libs/lib:/foo/lib executable

You can list the libraries used by the executable if you don't already know them:

Code:
ldd executable

What does the tool actually do?
And I suppose I'll need to use otool on OS X, since ldd is for Linux?
 

0d085d

macrumors regular
Apr 23, 2015
154
12
Sorry, my whole answer was Linux specific... clearly wasn't paying enough attention.

I *think* install_name_tool is what you need on OS X:

Code:
install_name_tool -add_rpath /path/to/library/files executable

And I suppose I'll need to use otool on OS X, since ldd is for Linux?

Yep.
Code:
otool -L executable
 
Last edited:

DenBeke

macrumors regular
Original poster
Aug 11, 2011
192
8
Antwerp
Sorry, my whole answer was Linux specific... clearly wasn't paying enough attention.

Well it's good to have the Linux solution as well :)

I was hoping for a fully automated solution, but no problem, I'll try to specify all library paths manually...
 

0d085d

macrumors regular
Apr 23, 2015
154
12
You can just give the path to a directory containing the libraries - doesn't have to be each individual library.
 

960design

macrumors 68040
Apr 17, 2012
3,732
1,610
Destin, FL
Are there tools available that make an executable portable by getting all the libraries, putting them in a folder and change the paths in the executable?

I want to be able to give a folder with an executable to someone else, who hasn't any developer tools/SDK's.

How to solve this?
Not enough coffee this morning, because I'm just not understanding your use case or need here. So, of course I'll just throw a bunch of junk at it: GitHub? I use Inno for Windows deployments and just create pkg ( dmg ) files for Mac deployments of software.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.