Question: I successfully compiled swftools using their instructions (http://wiki.swftools.org/index.php/FAQ) on my Fedora 14 machine. I want to use one of the tools (pdf2swf) on another Linux machine. When I move it and run it on the other machine it asks for some shared libraries. Is it possible to compile swftools (in particular pdf2swf) so that when I run it on another Linux machine it does not ask for any shared libraries? It is OK if the executable itself is bigger in size, as far as it can run independently.

I am new to Linux, so if something requires advanced knowledge please point me to the appropriate online resource.

Regards

Answer: 
it's trivial: link with -static. of course, this implies that you'll need static libraries installed. the linker (often called through cc) simply defaults to using shared libraries when both are available.

```
[hahn@box ~]$ cat hello.c
#include <stdio.h>
int main() {
    printf("Hello, world!\n"); 
    return 0; 
}
[hahn@box ~]$ cc hello.c -o hello
[hahn@box ~]$ file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped
[hahn@box ~]$ ldd hello
        linux-gate.so.1 =>  (0x00205000)
        libc.so.6 => /lib/libc.so.6 (0x00697000)
        /lib/ld-linux.so.2 (0x005b4000)
[hahn@box ~]$ cc hello.c -o hello -static
[hahn@box ~]$ file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, not stripped
[hahn@box ~]$ ldd hello
        not a dynamic executable
[hahn@box ~]$ ./hello
Hello, world!

```

to make this work, I needed to install glibc-static, which is not installed by default (at least on this box, which is Fedora14). some packages let you select static linking at the ./configure level, or else you may need to modify the Makefile.
Well, what you want are statically linked libraries, as opposed to dynamically/shared libraries.

You need to compile your application and link it statically. If you use gcc you can apply the static switch to your call of the compiler:

```
gcc -static <and the whole gcc shebang>

```

Most of the times you can edit the makefile (look for a CC define or CC\_ARGS something like that) and just include the static switch as above.