Subject: Re: mingw cross compilation

Re: mingw cross compilation

From: Simon Josefsson <>
Date: Wed, 16 Jun 2010 23:52:12 +0200

Thomas Stover <> writes:

> I was following some posts I found on the list archives about building
> libssh2 for win32 from linux.

My Windows builds are built this way, and it has worked fine for many
releases. My makefile is available from:

It uses libgcrypt though, not OpenSSL.

> I actually got it to mostly work up until it starts to link everything
> together. Some sort of libtool confusion gets in the way. Lot's of
> things like this:
> *** Warning: linker path does not have real file for library -lssl.
> *** I have the capability to make that library automatically link in when
> *** you link to this library. But I can only do this if you have a
> *** shared version of the library, which you do not appear to have
> *** because I did check the linker path looking for a file starting
> *** with libssl and none of the candidates passed a file format test
> *** using a file magic. Last file checked:
> /home/stover/src/lib/libssl32.dll.a
> Later it libtool eventually fails with:
> ../src/.libs/libssh2.a: could not read symbols: Archive has no index; run
> ranlib to add one
> I think some how I need a "cross libtool" or maybe tell libtool what I'm
> doing.

Libtool should work fine for cross-compilation if the environment is

> -I'm using a home built mingw rooted at
> /opt/crosscompilers/win32/bin/i686-mingw32-
> -I have the win32 openssl files in /home/stover/src
> -This was my configure:
> ./configure CC=/opt/crosscompilers/win32/bin/i686-mingw32-gcc
> --build=i686-pc-linux-gnu --host=i686-mingw32
> --with-libssl-prefix=/home/stover/src/
> Oh well. Maybe some else has a clue.

Put /opt/crosscompilers/win32/bin/ in your PATH instead, and remove the
CC= parameter. Configure should figure out by itself how to invoke the
C compiler for the cross-compilation requested by --build and --host.

However, I suspect your problem is the libssl library. Did you build it
yourself? Do you have a shared build available? The error message
above indicate libtool cannot find libssl.

Received on 2010-06-16