Prerequisites and instructions for using crosstool-NG for building a cross toolchain on Windows (Cygwin) as build and, optionally Windows (hereafter) MinGW-w64 as host.
- Use Cygwin64 if you can. DLL base-address problems are lessened that way and if you bought a 64-bit CPU, you may as well use it.
- You must enable Case Sensitivity in the Windows Kernel (this is only really necessary for Linux targets, but at present, crosstool-ng refuses to operate on case insensitive filesystems). The registry key for this is:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive
(set to 0 and reboot the machine.)Read more here. Since release 1.7, Cygwin no longer supports the ‘managed’ mount option. You must use case sensitive FS. - Using
setup.exe
orsetup-x86_64.exe
, install the default packages and also the following ones:- autoconf
- automake
- bison
- diffutils
- flex
- gawk
- gcc-g++
- git
- gperf
- help2man
- libncurses-devel
- make
- patch
- python-devel
- texinfo
- wget
- xzLeave “Select required packages (RECOMMENDED)” ticked. Notes:
- The packages marked with * are only needed if your host is MinGW-w64.
- Although nativestrict symlinks seem like the best idea, extracting glibc fails when they are enabled, so just don’t set anything here. If your host is MinGW-w64 then these ‘Cygwin-special’ symlinks won’t work, but you can dereference them by using tar options –dereference and –hard-dereference when making a final tarball. I plan to investigate and fix or at least work around the extraction problem. Read more here.
- If both BFD and GOLD linkers are enabled in binutils,
collect2.exe
will attempt to runld
which is a shell script so you need to make sure that a working shell is in your path. Eventually this will be replaced with a native program for MinGW-w64 host.
Notes
- Cygwin is slow. No, really, really slow. Expect about approximately 5x to 10x slowdown compared to a Linux system.
- 需要加入到系统环境变量:
- E:\x86_64-ubuntu16.04-linux-gnu\bin
- E:\x86_64-ubuntu16.04-linux-gnu\libexec\gcc\x86_64-ubuntu16.04-linux-gnu\8.3.0
- E:\x86_64-ubuntu16.04-linux-gnu\x86_64-ubuntu16.04-linux-gnu\bin
- 编译时需要指定sysroot
--sysroot=E:\x86_64-ubuntu16.04-linux-gnu\x86_64-ubuntu16.04-linux-gnu\sysroot