Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use MinGW-w64 with Cygwin?

MinGW-w64 has been available with Cygwin at least since December 2010. However I am having hard time using this to compile almost anything. I have set symbolic links with alternatives

p=x86_64-w64-mingw32
alternatives \
    --install /usr/bin/gcc.exe gcc /usr/bin/$p-gcc.exe 0 \
    --slave /usr/bin/ar.exe ar /usr/bin/$p-ar.exe

For example if I try to compile wget

./configure --without-ssl
make

Errors (edited for brevity)

connect.o:connect.c:(.text+0x3f): undefined reference to `__imp_htons'
connect.o:connect.c:(.text+0xbe7): undefined reference to `__imp_ntohs'
connect.o:connect.c:(.text+0xd96): undefined reference to `run_with_timeout'

If I use

  • MinGW shell with MinGW gcc
  • Cygwin shell with Cygwin gcc (gcc4-core)

Then Wget will compile.

Based off ak2 answer, this seems to work

./configure --host=x86_64-w64-mingw32 --disable-ipv6 --without-ssl
make
like image 433
Zombo Avatar asked May 08 '12 05:05

Zombo


People also ask

Can MinGW and Cygwin coexist?

The MSYS2 and CYGWIN can be used with different operation modes: You can use them together with MinGW to build Windows-native software. You can use them together with any other compiler to build Windows-native software, even with Visual Studio.

Does MinGW require Cygwin?

Whereas Mingw has small storage of POSIX tools only to support running GNU development tools. 3. These are built by using POSIX API and the user needs to install the Cygwin DLL, it requires Cygwin DLL compatibility layer because the programs are distributed with source code.

Is Cygwin same as MinGW?

MinGW is higher performance than Cygwin, but it's also 32-bit which may be a problem with your applications. There is a 64-bit environment similar to MinGW but it's a different project. MinGW-w64 is in all senses the successor to MinGW.


1 Answers

ak2 is partially incorrect as stated here.

The correct option is --host=x86_64-w64-mingw32, as you found out. --target is used for building a cross-compiler itself. The options are:

  • --build: What you are building on
  • --host: What you are building for
  • --target: If what you are building is a cross-compiler, what that cross-compiler will build for.
like image 53
Jonathan Baldwin Avatar answered Sep 30 '22 23:09

Jonathan Baldwin