# Linux: buildling cross compile toolchain

**URL:** <https://forums.unrealengine.com/t/linux-buildling-cross-compile-toolchain/298496>\
**Category:** Platform & Builds\
**Tags:** Linux, unreal-engine, question\
**Created:** [November 8, 2014, 4:06pm UTC](https://forums.unrealengine.com/t/linux-buildling-cross-compile-toolchain/298496 "2014-11-08T16:06:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmahashin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dmahashin](https://forums.unrealengine.com/u/dmahashin)\
**Post date:** [November 8, 2014, 4:06pm UTC](https://forums.unrealengine.com/t/linux-buildling-cross-compile-toolchain/298496/1 "2014-11-08T16:06:29Z")

</div>

I’m trying to build cross compile toolchain as instructed by this page:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

The reason I’m not using the pre-compiled version is because eventually I would like to tweak the setup to generate cross compiler for arm-linux target. But as a first step trying to get the standard cross compiler for x86-linux working.

I’m seeing this failure:

[INFO] =================================================================  
[INFO] Building mingw-w64 files  
[EXTRA] Configuring mingw-w64-crt  
[ERROR] configure: error: Please check if the mingw-w64 header set and the build/host option are set properly.  
[ERROR]  
[ERROR] \>\>  
[ERROR] \>\> Build failed in step ‘Building mingw-w64 files’  
[ERROR] \>\> called in step ‘(top-level)’  
[ERROR] \>\>  
[ERROR] \>\> Error happened in: CT\_DoExecLog[scripts/functions@257]  
[ERROR] \>\> called from: do\_libc[scripts/build/libc/mingw.sh@66]  
[ERROR] \>\> called from: main[scripts/crosstool-NG.sh@638]  
[ERROR] \>\>  
[ERROR] \>\> For more info on this error, look at the file: ‘build.log’  
[ERROR] \>\> There is a list of known issues, some with workarounds, in:  
[ERROR] \>\> ‘/home/dmahashin/projects/ue4/cross/build/crosstool-ng/docs/B - Known issues.txt’  
[ERROR]  
[ERROR] (elapsed: 29:38.96)

The config.log file for mingw-w64-crt configure script is the following:

configure:5640: $? = 1  
configure: failed program was:  
| /\* confdefs.h _/  
| #define PACKAGE\_NAME “mingw-w64-runtime”  
| #define PACKAGE\_TARNAME “mingw-w64-runtime”  
| #define PACKAGE\_VERSION “2.0”  
| #define PACKAGE\_STRING “mingw-w64-runtime 2.0”  
| #define PACKAGE\_BUGREPORT “[mingw-w64-public@lists.sourceforge.net](mailto:mingw-w64-public@lists.sourceforge.net)”  
| #define PACKAGE\_URL “”  
| #define PACKAGE “mingw-w64-runtime”  
| #define VERSION “2.0”  
| #define \_\_ENABLE\_GLOBBING 0  
| #define STDC\_HEADERS 1  
| #define HAVE\_SYS\_TYPES\_H 1  
| #define HAVE\_SYS\_STAT\_H 1  
| #define HAVE\_STDLIB\_H 1  
| #define HAVE\_STRING\_H 1  
| #define HAVE\_MEMORY\_H 1  
| #define HAVE\_STRINGS\_H 1  
| #define HAVE\_INTTYPES\_H 1  
| #define HAVE\_STDINT\_H 1  
| #define HAVE\_UNISTD\_H 1  
| /_ end confdefs.h. \*/  
| #include \<\_mingw\_mac.h\>  
configure:5640: result: no  
configure:5640: checking for \_mingw\_mac.h  
configure:5640: result: no  
configure:5644: error: Please check if the mingw-w64 header set and the build/host option are set properly.

I noticed that this file actually exists and installed in presumably the cross compiler build directory:  
~/x-tools/x86\_64-pc-mingw32/x86\_64-pc-mingw32/sysroot/usr/x86\_64-pc-mingw32/include/\_mingw\_mac.h

It looks like the configure script is trying to look for this header under the build machine’s true root directory (i.e /usr/include, etc).

Looking into crosstool-ng’s mingw.sh script this is how the configure is called:  
CT\_DoExecLog CFG   
“${CT\_SRC\_DIR}/mingw-w64-v${CT\_WINAPI\_VERSION}/mingw-w64-crt/configure”   
–prefix=/usr   
–build=${CT\_BUILD}   
–host=${CT\_TARGET} \

Doesn’t this need a --with-sysroot option ?  
I tried adding that and pointing it to the ~/x-tools/… location above and it still fails. Looking at the configure script it doesn’t look like it’s actually using the given --with-sysroot value at all.  
Inside …/linux-host-build/.build/src/mingw-w64-v2.0.7/mingw-w64-crt/configure there is this suspicious comment:

# Checks for programs.

# Checks for headers, libs, etc need to utilize the sysroot… no idea how

Has anyone ran into and fixed this issue in the past ? Any tips would be greatly appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![RCL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RCL](https://forums.unrealengine.com/u/RCL)\
**Post date:** [December 10, 2014, 10:34pm UTC](https://forums.unrealengine.com/t/linux-buildling-cross-compile-toolchain/298496/2 "2014-12-10T22:34:09Z")

</div>

While not exactly answering the your question, note that we are building mingw64 with ct-ng 1.19.0 - the newer version aren’t tested (and didn’t work for me). Build log normally has enough information to figure out the problem. A few more caveats:

1. pass absolute filenames everywhere
2. build on a case-sensitive filesystem (this matters if you’re trying cygwin and/or Mac builds).

I have zipped our ARM toolchain and gave our CDN people to upload - will shortly paste the URL to it.

---

<div class="post-metadata">

**Author:** ![RCL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RCL](https://forums.unrealengine.com/u/RCL)\
**Post date:** [January 5, 2015, 10:08pm UTC](https://forums.unrealengine.com/t/linux-buildling-cross-compile-toolchain/298496/3 "2015-01-05T22:08:05Z")

</div>

I am sorry for the delay - that didn’t happen until the Christmas break. Here’s the link to _Windows_ toolchain targeting ARM Linux (note that it contains ct-ng files + instructions that can help you build Linux toolchain): [https://s3.amazonaws.com/unrealengine/qfe/arm-unknown-linux-gnueabihf\_v5\_clang-3.5.0-ld-2.23.1-glibc-2.13.zip](https://s3.amazonaws.com/unrealengine/qfe/arm-unknown-linux-gnueabihf_v5_clang-3.5.0-ld-2.23.1-glibc-2.13.zip)
