tech:notes_cross-compilation
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_cross-compilation [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_cross-compilation [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes cross-compilation | ||
| + | |||
| + | |||
| + | Voir : | ||
| + | https:// | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | apt-get install crossbuild-essential-i386 | ||
| + | ~~~ | ||
| + | |||
| + | Ou | ||
| + | ~~~bash | ||
| + | cat / | ||
| + | |||
| + | dpkg --add-architecture i386 | ||
| + | apt-get update | ||
| + | |||
| + | apt-get install mingw32 mingw32-binutils | ||
| + | #apt-get install mingw-w64 | ||
| + | ~~~ | ||
| + | |||
| + | `plop.cpp` | ||
| + | ~~~cpp | ||
| + | #include < | ||
| + | |||
| + | int main(int argc, char** argv) | ||
| + | { | ||
| + | std::cout << " | ||
| + | return 0; | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | i586-mingw32msvc-g++ -o plop.exe plop.cpp | ||
| + | ~~~ | ||
| + | |||
| + | On windows error libstdc++-6.dll missing | ||
| + | |||
| + | Pour le plus avoir l' | ||
| + | Nous ne voulons plus de DLL, donc mettons tout en static | ||
| + | |||
| + | ~~~bash | ||
| + | i586-mingw32msvc-g++ -o plop.exe plop.cpp | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | aptitude search '~n curl ~r i386' | ||
| + | |||
| + | apt-get source curl:i386 | ||
| + | apt-get source libcurl3: | ||
| + | cd curl | ||
| + | |||
| + | #apt-get install crossbuild-essential-i386 | ||
| + | |||
| + | export ARCH=i386 CROSS_COMPILE=arm-linux | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | make -f lazy_makefile CC=i686-w64-mingw32-gcc | ||
| + | ./configure --host=i686-w64-mingw32 --enable-shared --disable-install-doc | ||
| + | ./configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 | ||
| + | ./configure --host=x86_64-w64-mingw32 --disable-magic --disable-cuckoo --with-crypto CFLAGS=-I/ | ||
| + | |||
| + | The right way to do this is to add the `-static` flag to an `LDFLAGS` variable. For all targets: `AM_LDFLAGS=-static` | ||
| + | |||
| + | export CC=i586-mingw32msvc-cc | ||
| + | ./configure --host=i686-w64-mingw32 --enable-static | ||
| + | |||
| + | export CFLAGS=' | ||
| + | |||
| + | make V=1 curl_LDFLAGS=-all-static | ||
| + | |||
| + | |||
| + | git clone -b curl-tiny-7.72 https:// | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | libtool: | ||
| + | libtool: | ||
| + | libtool: | ||
| + | libtool: | ||
| + | libtool: | ||
| + | libtool: | ||
| + | make[2]: Leaving directory '/ | ||
| + | make[1]: Leaving directory '/ | ||
| + | Making all in include | ||
| + | make[1]: Entering directory '/ | ||
| + | Making all in curl | ||
| + | make[2]: Entering directory '/ | ||
| + | make all-am | ||
| + | make[3]: Entering directory '/ | ||
| + | make[3]: Leaving directory '/ | ||
| + | make[2]: Leaving directory '/ | ||
| + | make[2]: Entering directory '/ | ||
| + | make[2]: Nothing to be done for ' | ||
| + | make[2]: Leaving directory '/ | ||
| + | make[1]: Leaving directory '/ | ||
| + | make[1]: Entering directory '/ | ||
| + | make[1]: Nothing to be done for ' | ||
| + | make[1]: Leaving directory '/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | $ find . -iname curl.exe | ||
| + | ./ | ||
| + | ./ | ||
| + | ~~~ | ||
| + | |||
| + | Le bon est celui qui est dans `src/ | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | export AM_LDFLAGS=' | ||
| + | |||
| + | git clone https:// | ||
| + | cd curl | ||
| + | git tag | ||
| + | git checkout curl-7_9_8 | ||
| + | |||
| + | export ROOTDIR=" | ||
| + | cd curl | ||
| + | #$ export CROSS_COMPILE=" | ||
| + | #export CROSS_COMPILE=" | ||
| + | export CROSS_COMPILE=" | ||
| + | #export CPPFLAGS=" | ||
| + | export CPPFLAGS=" | ||
| + | export LDFLAGS=" | ||
| + | export AR=${CROSS_COMPILE}-ar | ||
| + | export AS=${CROSS_COMPILE}-as | ||
| + | export LD=${CROSS_COMPILE}-ld | ||
| + | export RANLIB=${CROSS_COMPILE}-ranlib | ||
| + | export CC=${CROSS_COMPILE}-gcc | ||
| + | export NM=${CROSS_COMPILE}-nm | ||
| + | export LIBS=" | ||
| + | ./buildconf | ||
| + | ./configure --prefix=${ROOTDIR}/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | sudo apt-get build-dep curl | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Pb | ||
| + | |||
| + | ### Err | ||
| + | |||
| + | `m32test.c` | ||
| + | ~~~c | ||
| + | #include < | ||
| + | int main() | ||
| + | { | ||
| + | | ||
| + | | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | $ gcc -m32 -o m32test m32test.c | ||
| + | In file included from / | ||
| + | from m32test.c: | ||
| + | / | ||
| + | # | ||
| + | ^ | ||
| + | compilation terminated. | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | # gcc -m32 -o m32test m32test.c | ||
| + | In file included from m32test.c: | ||
| + | / | ||
| + | # | ||
| + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| + | compilation terminated. | ||
| + | ~~~ | ||
| + | |||
| + | Solution | ||
| + | ~~~bash | ||
| + | apt-get install gcc-multilib | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ### Err undefined reference to | ||
| + | |||
| + | Pb linking error | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
