tuto:linux:tuto_compilation
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
tuto:linux:tuto_compilation [2013/06/05 20:43] – [Exemples] root | tuto:linux:tuto_compilation [2013/06/08 17:19] (Version actuelle) – [Exemples] root | ||
---|---|---|---|
Ligne 262: | Ligne 262: | ||
| | ||
</ | </ | ||
+ | |||
+ | * Include les 2 librairies dans une seule : | ||
+ | |||
+ | <code c compile6.sh> | ||
+ | #!/bin/bash | ||
+ | |||
+ | gcc -c -Wall -Werror -fpic foo.c | ||
+ | |||
+ | gcc -c -Wall -Werror -fpic boo.c | ||
+ | gcc -shared -o libgigix.so boo.o foo.o | ||
+ | |||
+ | gcc -L. -Wall -o test main.c -lgigix | ||
+ | |||
+ | export LD_LIBRARY_PATH=/ | ||
+ | ./test | ||
+ | |||
+ | ldd test | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | root@ks305337: | ||
+ | This is a shared library test... | ||
+ | Hello, I'm a shared library : foo | ||
+ | Hello, I'm a shared library : boo | ||
+ | linux-vdso.so.1 => (0x00007fff2e7fe000) | ||
+ | libgigix.so => / | ||
+ | libc.so.6 => / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | === Compilation statique === | ||
+ | |||
+ | |||
+ | Pour compiler un programme en static (par exemple python) : | ||
+ | < | ||
+ | ./configure LDFLAGS=" | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | Pour transformer un binaire dynamique en statique, il existe des outils comme : | ||
+ | * [[http:// | ||
+ | * [[http:// |
tuto/linux/tuto_compilation.1370464993.txt.gz · Dernière modification : 2013/06/05 20:43 de root