Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🌍 multiarch cross compiling environments

License

NotificationsYou must be signed in to change notification settings

multiarch/crossbuild

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌍 multiarch cross compiling environments

actions

This is a multiarch Docker build environment image.You can use this image to produce binaries for multiple architectures.

Supported targets

TripleAliaseslinuxosxwindows
x86_64-linux-gnu(default), linux, amd64, x86_64X
arm-linux-gnueabiarm, armv5X
arm-linux-gnueabihfarmhf, armv7, armv7lX
aarch64-linux-gnuarm64, aarch64X
mipsel-linux-gnumips, mipselX
powerpc64le-linux-gnupowerpc, powerpc64, powerpc64leX
x86_64-apple-darwinosx, osx64, darwin, darwin64X
x86_64h-apple-darwinosx64h, darwin64h, x86_64hX
i386-apple-darwinosx32, darwin32X
x86_64-w64-mingw32windows, win64X
i686-w64-mingw32win32X

Using crossbuild

x86_64

$docker run --rm -v$(pwd):/workdir multiarch/crossbuild make helloworldcc helloworld.c -o helloworld$file helloworldhelloworld: ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=9cfb3d5b46cba98c5aa99db67398afbebb270cb9, not stripped

Misc: usingcc instead ofmake

$docker run --rm -v$(pwd):/workdir multiarch/crossbuild cc test/helloworld.c

arm

$docker run --rm -v$(pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabi multiarch/crossbuild make helloworldcc     helloworld.c   -o helloworld$file helloworldhelloworld: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c8667acaa127072e05ddb9f67a5e48a337c80bc9, not stripped

armhf

$docker run --rm -v$(pwd):/workdir -e CROSS_TRIPLE=arm-linux-gnueabihf multiarch/crossbuild make helloworldcc     helloworld.c   -o helloworld$file helloworldhelloworld: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=ad507da0b9aeb78e7b824692d4bae6b2e6084598, not stripped

powerpc 64-bit el

$docker run --rm -v$(pwd):/workdir -e CROSS_TRIPLE=powerpc64le-linux-gnu multiarch/crossbuild make helloworldcc     helloworld.c   -o helloworld$file helloworldhelloworld: ELF 64-bit LSB  executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=035c50a8b410361d3069f77e2ec2454c70a140e8, not stripped

arm64

$docker run --rm -v$(pwd):/workdir -e CROSS_TRIPLE=aarch64-linux-gnu multiarch/crossbuild make helloworldcc     helloworld.c   -o helloworld$file helloworldhelloworld: ELF 64-bit LSB  executable, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.7.0, BuildID[sha1]=dce6100f0bc19504bc19987535f3cc04bd550d60, not stripped

mips el

$docker run --rm -v$(pwd):/workdir -e CROSS_TRIPLE=mipsel-linux-gnu multiarch/crossbuild make helloworldcc     helloworld.c   -o helloworld$file helloworldhelloworld: ELF 32-bit LSB  executable, MIPS, MIPS-II version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=d6b2f608a3c1a56b8b990be66eed0c41baaf97cd, not stripped

darwin i386

$docker run -it --rm -v$(pwd):/workdir -e CROSS_TRIPLE=i386-apple-darwin  multiarch/crossbuild make helloworldo32-clang     helloworld.c   -o helloworld$file helloworldhelloworld: Mach-O executable i386

darwin x86_64

$docker run -it --rm -v$(pwd):/workdir -e CROSS_TRIPLE=x86_64-apple-darwin  multiarch/crossbuild make helloworldo64-clang     helloworld.c   -o helloworld$file helloworldhelloworld: Mach-O 64-bit executable x86_64

windows i386

$docker run -it --rm -v$(pwd):/workdir -e CROSS_TRIPLE=i686-w64-mingw32  multiarch/crossbuild make helloworldo32-clang     helloworld.c   -o helloworld$file helloworldhelloworld: PE32 executable (console) Intel 80386, for MS Windows

windows x86_64

$docker run -it --rm -v$(pwd):/workdir -e CROSS_TRIPLE=x86_64-w64-mingw32  multiarch/crossbuild make helloworldo64-clang     helloworld.c   -o helloworld$file helloworldhelloworld: PE32+ executable (console) x86-64, for MS Windows

Using crossbuild in a Dockerfile

FROM multiarch/crossbuildRUN git clone https://github.com/bit-spark/objective-c-hello-worldENV CROSS_TRIPLE=x86_64-apple-darwinWORKDIR /workdir/objective-c-hello-worldRUN crossbuild ./compile-all.sh

Projects usingcrossbuild

Credit

This project is inspired by thecross-compiler by the venerableSteeve Morin

Legal note

OSX/Darwin/Apple builds:Please ensure you have read and understood the Xcode licenseterms before continuing.

License

MIT


[8]ページ先頭

©2009-2025 Movatter.jp