Questions tagged [cross-compiling]

For general cross compiling issues, where a separate 'hosting' environment is used to build for the 'target' platform.

Cross compilation in the most general sense is simply building software on a platform that is different from the platform where the software will run.

A typical example is compiling software for an embedded system. It is usually not possible to run compilation tools on the target hardware, perhaps due to:

  • Resource constraints
  • The lack of a sufficiently functional operating system
  • The lack of a compiler to build the tools themselves

In the GNU Compiler Collection (GCC), the platform where the tool chain runs is known as the "host", and the platform where the software runs is called the "target".

4475 questions
224
votes
10 answers

Missing include "bits/c++config.h" when cross compiling 64 bit program on 32 bit in Ubuntu

I am running the 32bit version of Ubuntu 10.10 and trying to cross compile to a 64 bit target. Based on my research, I have installed the g++-multilib package. The program is a very simple hello world: #include int main( int argc, char**…
Jesse Vogt
  • 16,229
  • 16
  • 59
  • 72
192
votes
13 answers

Error "gnu/stubs-32.h: No such file or directory" while compiling Nachos source code

I am trying to install Nachos on my laptop and I have Ubuntu 11.04 on the laptop. The code is in C and so to build it I assume I will need cross compiler. This is where my problem is. I downloaded the source code of the MIPS cross compiler using…
Ashish Agarwal
  • 14,555
  • 31
  • 86
  • 125
160
votes
8 answers

Cross compile Go on OSX?

I am trying to cross-compile a go app on OSX to build binaries for windows and linux. I have read everything what I could find on the net. Closest example that I have found has been published on (apart from many unfinished discussions on go-nuts…
ljgww
  • 3,418
  • 6
  • 19
  • 21
134
votes
2 answers

What's the difference of "./configure" option "--build", "--host" and "--target"?

The script ./configure accepts 3 options --build, --host and --target. I'm confusing their roles. What's the difference and semantics of them?
eonil
  • 83,476
  • 81
  • 317
  • 516
132
votes
5 answers

Undefined reference to a static member

I'm using a cross compiler. My code is: class WindowsTimer{ public: WindowsTimer(){ _frequency.QuadPart = 0ull; } private: static LARGE_INTEGER _frequency; }; I get the following error: undefined reference to…
kakush
  • 3,334
  • 14
  • 47
  • 68
126
votes
9 answers

How to install the Raspberry Pi cross compiler on my Linux host machine?

I am attempting to get cross-compiling for Raspberry Pi working on my Ubuntu machine. During my initial attempts I was using the arm-linux-gnueabi compiler, which is available in the Ubuntu repo. I got this working. I was able to build all my…
pqvst
  • 4,344
  • 6
  • 33
  • 42
111
votes
6 answers

Cross-compile a Rust application from Linux to Windows

Basically I'm trying to compile the simplest code to Windows while I am developing on Linux. fn main() { println!("Hello, and bye.") } I found these commands by searching the internet: rustc --target=i686-w64-mingw32-gcc main.rs rustc…
Fedcomp
  • 2,175
  • 5
  • 21
  • 23
110
votes
3 answers

How to build x86 and/or x64 on Windows from command line with CMAKE?

One way to get cmake to build x86 on Windows with Visual Studio is like so: Start Visual Studio Command prompt for x86 Run cmake: cmake -G "NMake Makefiles" \path_to_source\ nmake One way to get cmake to build x64 on Windows with Visual Studio is…
101010
  • 14,866
  • 30
  • 95
  • 172
99
votes
6 answers

How to stop MinGW and MSYS from mangling path names given at the command line

On Windows, I'm cross-compiling a program for ARM/Linux using CodeSourcery's cross-compiler suite. I use MinGW MSYS as my command interpreter, and very often it will mangle my paths and pathnames. For example, to build my program, I…
Ted Middleton
  • 6,859
  • 10
  • 51
  • 71
89
votes
5 answers

How do I configure Qt for cross-compilation from Linux to Windows target?

I want to cross compile the Qt libraries (and eventually my application) for a Windows x86_64 target using a Linux x86_64 host machine. I feel like I am close, but I may have a fundamental misunderstanding of some parts of this process. I began by…
Mr. Shickadance
  • 5,283
  • 9
  • 45
  • 61
84
votes
10 answers

How to Compile for OS X in Linux or Windows?

I would like to port my C/C++ apps to OS X. I don't have a Mac, but I have Linux and Windows. Is there any tool for this?
Unknown
  • 45,913
  • 27
  • 138
  • 182
80
votes
3 answers

All possible GOOS value?

If I get it right, GOOS is determined when compile the source code. To better support multiple OS, I'm interested in what GOOS could be. Of course, there might be infinite possibilities of it, since Go is opensourced. So what I really want is a…
liuyanghejerry
  • 3,771
  • 5
  • 32
  • 38
75
votes
5 answers

CMake: The C Compiler is not able to compile a simple test program

I am trying to cross-compile the Azure IoT SDK C for a Mips processor. Cross-compiling an older version of the same SDK using an older version of CMake (2.8.12.2) works just fine, so I doubt it's the code itself. I am guessing it's the Mips GCC…
Kagemand Andersen
  • 1,470
  • 2
  • 16
  • 30
75
votes
9 answers

Hunk #1 FAILED at 1. What's that mean?

I get the following error when running make, and I have no idea what it means or what to do about it. Can anyone illuminate me or point me in the right direction? (cd libdvdnav-git && patch -p1) < ../../contrib/src/dvdnav/dvdnav.patch patching file…
JellicleCat
  • 28,480
  • 24
  • 109
  • 162
67
votes
6 answers

How to write code in Java 11, but target Java 8 and above?

I am working on a small library and for obvious reasons I would like to write code using all the Java 11 features (except modules I guess for now), but I would like the library to be compatible with Java 8 and above. When I try this: javac -source…
neshkeev
  • 6,280
  • 3
  • 26
  • 47
1
2 3
99 100