LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-30-2010, 05:34 PM   #1
ceashton
Member
 
Registered: Nov 2006
Distribution: Slackware 12.2
Posts: 36

Rep: Reputation: 15
Build ImageMagick into a single binary?


Dear all,

I have script that I wish to distribute to a small group that requires ImageMagick, but many in the group don't have ImageMagick installed. I'm not really in a position where by I can install ImageMagick on all the groups machines, and my knowledge of compiling is pretty restricted to ./configure; make; make install.

Is it possible to compile ImageMagick (or indeed any other program) into a single binary without any external dependencies?

I believe to accomplish this I provide ./configure with the following arguments:

Code:
./configure --enable-shared=no  --enable-static=yes
Is this the correct way to go, or am I barking up the wrong tree?

Many thanks in advance,

Chris
 
Old 03-30-2010, 05:44 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
This sounds like an exercise in frustration. Why not simply show everyone how to install ImageMagick? (It's available using the package manager in every distro I have ever used)
 
Old 03-31-2010, 12:31 AM   #3
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by pixellany View Post
This sounds like an exercise in frustration. Why not simply show everyone how to install ImageMagick? (It's available using the package manager in every distro I have ever used)
Agree. Installing ImageMagick should be quite straightforward.
Unless you need features from specific version of ImageMagic.

In this case you can convert dynamically linked executable into self-containing one using Ermine (http://magicErmine.com) or statifier
(http://statifier.sf.net)
Statifier is licensed under GPL, but has trouble on systems with memory randomization. On the other hand Ermine is commercial, but able to handle those system.
 
Old 03-31-2010, 01:34 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Valery, out of curiosity: ImageMagick has 9 standalone executable in my installation
is comprised of 8 binaries. How big would they become in that process?
 
Old 03-31-2010, 02:30 AM   #5
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by Tinkster View Post
Valery, out of curiosity: ImageMagick has 9 standalone executable in my installation
is comprised of 8 binaries. How big would they become in that process?
On my Fedora 12 (i386):

Code:
[valery@localhost bin]$ ls -l animate compare composite  conjure convert display identify import mogrify montage stream 
-rwxr-xr-x. 1 root root 10988 2009-08-03 21:38 animate
-rwxr-xr-x. 1 root root 11128 2009-08-03 21:38 compare
-rwxr-xr-x. 1 root root 10988 2009-08-03 21:38 composite
-rwxr-xr-x. 1 root root 10988 2009-08-03 21:38 conjure
-rwxr-xr-x. 1 root root 10988 2009-08-03 21:38 convert
-rwxr-xr-x. 1 root root 10988 2009-08-03 21:38 display
-rwxr-xr-x. 1 root root 11128 2009-08-03 21:38 identify
-rwxr-xr-x. 1 root root 10984 2009-08-03 21:38 import
-rwxr-xr-x. 1 root root 10988 2009-08-03 21:38 mogrify
-rwxr-xr-x. 1 root root 10988 2009-08-03 21:38 montage
-rwxr-xr-x. 1 root root 10984 2009-08-03 21:38 stream
Code:
[valery@localhost bin]$ ldd animate
	linux-gate.so.1 =>  (0x00974000)
	libMagickCore.so.2 => /usr/lib/libMagickCore.so.2 (0x00982000)
	libMagickWand.so.2 => /usr/lib/libMagickWand.so.2 (0x004c0000)
	liblcms.so.1 => /usr/lib/liblcms.so.1 (0x00d98000)
	libtiff.so.3 => /usr/lib/libtiff.so.3 (0x04f1d000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x0085e000)
	libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x0024d000)
	libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00110000)
	libXext.so.6 => /usr/lib/libXext.so.6 (0x00798000)
	libXt.so.6 => /usr/lib/libXt.so.6 (0x051fe000)
	libbz2.so.1 => /lib/libbz2.so.1 (0x002a4000)
	libz.so.1 => /lib/libz.so.1 (0x004ab000)
	libgomp.so.1 => /usr/lib/libgomp.so.1 (0x0060b000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00484000)
	libltdl.so.7 => /usr/lib/libltdl.so.7 (0x04e1e000)
	libSM.so.6 => /usr/lib/libSM.so.6 (0x00d8e000)
	libICE.so.6 => /usr/lib/libICE.so.6 (0x00d36000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0x0064c000)
	libm.so.6 => /lib/libm.so.6 (0x00451000)
	libc.so.6 => /lib/libc.so.6 (0x002da000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00c9a000)
	libexpat.so.1 => /lib/libexpat.so.1 (0x008f7000)
	librt.so.1 => /lib/librt.so.1 (0x004a0000)
	/lib/ld-linux.so.2 (0x002b8000)
	libdl.so.2 => /lib/libdl.so.2 (0x0047d000)
	libuuid.so.1 => /lib/libuuid.so.1 (0x00c93000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0x0062c000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0x0078c000)
Size of all executables put together is nothing compared to the size of shared libraries.

I expect that packed executable will be about 10-20 MB.
And ANY packed executable is memory hog, because it uses it's own libraries. In additional to the host's libc it will map to memory it's own libc.

While packed executables eat from the disk space and RAM them provide convenience. It's trade off.
By the way recently LWN.net has article about bundling libraries with applications: http://lwn.net/Articles/378216/

I personally think, that while "no bundling" police make sense from the distribution maker point of view, for those who want their software works on different distros it's very hard to avoid bundling (if at all possible)
 
Old 03-31-2010, 05:59 AM   #6
ceashton
Member
 
Registered: Nov 2006
Distribution: Slackware 12.2
Posts: 36

Original Poster
Rep: Reputation: 15
Many thanks for the replies.

Apologies, I had forgotten ImageMagick produced multiple binaries. I only require 'convert' if that makes the task any easier.

Quote:
Why not simply show everyone how to install ImageMagick?
Some of the machines don't have any developer tools installed on them, and I am unfamiliar with all the various package managers.

From my perspective of just wanting to get the job done with the least amount of hassle to myself and the other users, it would be much easier if I could just distribute the single self contained binary of 'convert', or even a directory containing the binary and required libs. I imagined there would be a parameter I could provide at the configure stage that would do this for me, but from Valery's post:

Quote:
In this case you can convert dynamically linked executable into self-containing one using Ermine (http://magicErmine.com) or statifier
(http://statifier.sf.net)
It seems this is not possible and I need to use Ermine or Statifier, or have I misunderstood?

Many thanks again,

Chris
 
Old 03-31-2010, 08:22 AM   #7
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by ceashton View Post
Many thanks for the replies.

From my perspective of just wanting to get the job done with the least amount of hassle to myself and the other users
Your goals are contradict: least amount of hassle for yourself is to assume that users' systems have convert installed (or users will take care of it)
Least trouble for the users is indeed to provide them with anything, that not installed on their boxes.

Quote:
, it would be much easier if I could just distribute the single self contained binary of 'convert', or even a directory containing the binary and required libs. I imagined there would be a parameter I could provide at the configure stage that would do this for me, but from Valery's post:



It seems this is not possible and I need to use Ermine or Statifier, or have I misunderstood?

Many thanks again,

Chris
Have a look at output off
Code:
ldd convert
If you can find all those static libraries, to link convert against,
then you can build static convert.
If you believe that user box will have all of those libraries - you can
distribute dynamically linked convert.

Or you may use statifier/ermine.

By the way this reading may be of interest to you:
http://magicermine.com/sesl.html
 
Old 03-31-2010, 12:16 PM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Slightly off-topic, but be sure to check the ImageMagick license before re-packaging and distributing any part of it.

On-topic:
I'm still missing why you don't simply tell your users to install ImageMagick---it comes with every distro I have ever tried, and they would not need any development setup, etc.
 
Old 03-31-2010, 01:11 PM   #9
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by pixellany View Post
Slightly off-topic, but be sure to check the ImageMagick license before re-packaging and distributing any part of it.
From ImageMagick's license file"
Code:
The authoratitive ImageMagick license can be found at
http://www.imagemagick.org/script/license.php and ImageMagick notices at
http://www.imagemagick.org/script/notice.php.

Before we get to the text of the license lets just review what the license says in simple terms:

It allows you to:

    * freely download and use ImageMagick software, in whole or in part, for personal, company internal, or commercial purposes;
    * use ImageMagick software in packages or distributions that you create.
 
Old 04-01-2010, 09:28 AM   #10
ceashton
Member
 
Registered: Nov 2006
Distribution: Slackware 12.2
Posts: 36

Original Poster
Rep: Reputation: 15
Dear all,

Quote:
Originally Posted by pixellany View Post
I'm still missing why you don't simply tell your users to install ImageMagick---it comes with every distro I have ever tried, and they would not need any development setup, etc.
Most of the end users wouldn't have a clue about how to go about installing/compiling. The computers were set up for them and it seems there is no support. Also they are remote and too many of them for me to talk though the process over a phone... and I'm not familiar with how too many of the distributions work!

Hence, I just want to be able to distribute a shell script with convert (and any dependancies) that the user clicks on and have the script do all the grunt work. It is literally only to resize jpgs and create thumbnails, so I should be able to compile with a limited set of dependancies, I guess.

pixellany and Valery Reznic, no problems with the licence that I see, so long as it is distributed with the code and proper credit is given?

It seems my knowledge of compiling etc is a bit constraining at the moment. I've had a read of the links Valery Reznic provided and had a play with ldd, but as yet I'm still missing something as I can't get it to work. I'll post back when I a specific question or manage to resolve my problem.

For now, many thanks for your replies and suggestions.

Chris
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using imagemagick to convert numerous jpg files to single pdf jrtayloriv Linux - Software 7 05-03-2013 05:13 AM
How to build statically linked binary with autoconf The_Sven Linux - General 2 11-15-2009 09:31 AM
Executing multiple instances of a binary file from a single script? j_65_uk Linux - Newbie 3 07-02-2009 04:56 PM
Storing multiple options in a single variable (binary addition?) matt_heys Programming 1 04-03-2009 03:38 PM
How to build one binary for all Redhat systems? mattengland Linux - Software 3 09-11-2005 11:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration