How can I build a cross-compiler for a C++ library to target many platforms on a single build server?
The cross-compiler should be able to build the library for (at least) {Windows 7, Mac OS X, Ubuntu 11.04} × {32 bit, 64 bit} × {Debug, Release}. I don't care if the whole build from scratch takes forever or if the gcc binary is 1 GB. If the cross-compiler cannot be a single executable, what is the workflow I should use to compile (and recompile) my library?
The host machine would be a Ubuntu 11.04.
Building cross-compiler is quite well covered in OSDev Wiki. For Windows, you can use mingw packages in your distro's repository
Windows host + TeamCity + GCC (mingw) + Gnu Make (or complementary build script solution) + MSVC8/9
You can have teamcity automate the building of everything for you, GCC will let you build targets in all DBG/REL, 32/64 bit, MacOS/Linux permutations. MSVC8/9 test for cross-compiler compatibilities.
Related
I use conan as a dependency manager for a large C++ project. The project was built for Linux and I am porting it to Windows.
Due to this I am compiling with mingwin since that development environment is closer to mine.
However, conan knows it's running on windows and so it downloads windows binaries.
I am finding that although compilation works, linking fails because mingwin binaries and MSVC binaries are incompatible.
I am not sure if I need to try to instruct meson (my build system) to use cl as the compiler, or trick conan to download Linux libraries instead of windows.
I am trying to install MinGW but it's always failing to install.
on windows 7
link of the program:
https://sourceforge.net/projects/mingw/files/latest/download
Tar zips are not generally for windows users the downlink should be a windows installer mingw-get-setup.EXE thus (not a GnuZip)
Also if your trying to unpack 32bit collections the question is which architecture do you need, certainly 32.exe will run on 64, but 64.exe will NOT work on 32.
Current build is 32bit "Although (currently) offering only a 32-bit compiler suite, all of MinGW's software will execute on the 64bit Windows platforms."
get it from official https://osdn.net/projects/mingw/releases/
latest link I got was
https://osdn.net/frs/redir.php?m=liquid&f=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip
once you have a valid windows .zip file, right click to "extract" then the exe should be in the bin folder.
Then it's just you on your own, and the myriad of instructions from google.
MinGW is a compiler generating files for the Windows platform, but MinGW itself can also be run on other platforms (like Linux for example).
What you need is are Windows binaries of MinGW.
But MinGW is a bit outdated and only supports 32-bit Windows.
I would really recommend using MinGW-w64.
Standalone build of MinGW-w64 for Windows (both 32-bit and 64-bit) are available at https://winlibs.com/ just download the archive and extract it. Then all the tools you need will be in the mingw32/bin or mingw64/bin folder.
If you're not very familiar with command line tools you should really use an IDE. There are some instructions on https://winlibs.com/ on how to use MinGW-w64 with Code::Blocks.
If on the other hand you are very familiar with command line or the Linux shell you should take a look at MSYS2 which also allows installing MinGW-w64 with it's pacman tool.
The download page for cmake only shows a 32 bit installer for windows. Any idea how to install it on 64 windows systems.
There is really no reason for a 64bit native CMake. CMake is only building the configuration, so you can use it to build configurations for 64bit software, even with the 32bit version.
That being said, if you truly want a 64bit native version, you could always download the source and compile it. There is no 64bit installer, however.
The 32 bit version works perfectly even on 64 bit Windows. I've used it, and it works.
EDIT: It looks like CMake is now available in both 32-bit and 64-bit flavors. Just go to their website and you can get the 64-bit version.
A 64-bit Windows installer is now available from the download page: https://cmake.org/download
I'm trying to build Qt in a shared 64 bit mode on my 32bit XP system.
I can configure the QMake and start the 64bit build. The problem is that when the build starts, the first thing that happens in that the process builds ui, moc and rcc utility compilers in 64 bit mode, then tries to run them on my 32bit machine.
Does anyone know how to configure the build so that it does not build those compilers first?
I don't think Qt support cross-compilation on Windows.
I suggest doing it the other way around, by using a 64bit machine (and a 64 bit version of Windows) to build the 64bit and 32bit versions.
Is there a manual for cross-compiling a C++ application from Linux to Windows?
Just that. I would like some information (links, reference, examples...) to guide me to do that.
I don't even know if it's possible.
My objective is to compile a program in Linux and get a .exe file that I can run under Windows.
The basics are not too difficult:
sudo apt-get install mingw32
cat > main.c <<EOF
int main()
{
printf("Hello, World!");
}
EOF
i586-mingw32msvc-cc main.c -o hello.exe
Replace apt-get with yum, or whatever your Linux distro uses. That will generate a hello.exe for Windows.
Once you get your head around that, you could use autotools, and set CC=i586-mingw32msvc-cc
CC=i586-mingw32msvc-cc ./configure && make
Or use CMake and a toolchain file to manage the build. More difficult still is adding native cross libraries. Usually they are stored in /usr/cross/i586-mingw32msvc/{include,lib} and you would need to add those paths in separately in the configure step of the build process.
It depends on what you mean (I couldn't really say).
If you mean that you want to use an existing Linux application on Windows, then you could try compiling it using Cygwin on Windows. This however does not give you a Windows executable free from all dependencies towards Cygwin (your executable still depends on the cygwin.dll file) - and it still may need some porting before it will work. See http://www.cygwin.com.
If you mean that you want to be able to perform the actual compilation of a Windows application on Linux and produce a .exe file that is executable on Windows - thus using your Linux box for development and/or compilation then you should look into MinGW for Linux which is a tool for crosscompiling for Windows on Linux. See http://www.mingw.org/wiki/LinuxCrossMinGW.
Best regards!
I suggest you give the following, GUB (Grand Unified Builder) a try as it cross-compiles several packages with their dependencies and assembles them into a single installation package for currently 11 architectures. You can download a prebuilt iso for installation in a VM from here and follow the source here. It can currently be used to cross-compile GNU LilyPond/ GNU Denemo / Inkscape and OpenOffice.org.
The target architectures are:
darwin-ppc - tar.bz2 file for Darwin 7 (MacOS 10.3)/PowerPC
darwin-x86 - tar.bz2 file for Darwin 8 (MacOS 10.4)/x86
mingw - mingw executable for Windows32
linux-x86 - shar archive for Linux/x86
linux-64 - shar archive for Linux/x86_64
linux-ppc - shar archive for Linux/PowerPC
freebsd-x86 - shar archive for FreeBSD 4/x86
freebsd-64 - shar archive for FreeBSD 6/x86_64
cygwin - .tar.bz2 packages for Cygwin/Windows32
arm - shar archive for Linux/ARM (largely untested)
debian - shar archive for Debian (largely untested)