Discussion:
[Mingw-cross-env-list] Cross Compile OpenSSH-7.5p1 failure
J Gomez
2017-04-27 21:11:12 UTC
Permalink
Followed the directions on installing MXE using binary install at
http://pkg.mxe.cc using Debian Jessie 8.7.1 x64.

Did the following:

sudo apt-get install mxe-i686-w64-mingw32.static-openssl install
mxe-i686-w64-mingw32.static-zlib mxe-i686-w64-mingw32.static-gcc

Also added export PATH=$PATH:/usr/lib/mxe/usr/bin to ~/.profile.

Then attempted to compile OpenSSH-7.5p1 using:

./configure --host=i686-w64-mingw32.static --build=i686

But it fails with:

<snip>
configure: error: *** Can't find recent OpenSSL libcrypto (see config.log
for details) ***

I'm guessing I have to compile libcryto since I don't see it at
http://mxe.cc/build-matrix.html?

Thanks for the help!

Jose
Nagaev Boris
2017-04-28 01:32:57 UTC
Permalink
Hey Jose
Post by J Gomez
Followed the directions on installing MXE using binary install at
http://pkg.mxe.cc using Debian Jessie 8.7.1 x64.
sudo apt-get install mxe-i686-w64-mingw32.static-openssl install
mxe-i686-w64-mingw32.static-zlib mxe-i686-w64-mingw32.static-gcc
The command has extra "install" argument.
Post by J Gomez
Also added export PATH=$PATH:/usr/lib/mxe/usr/bin to ~/.profile.
I assume you use this file:
https://mirrors.evowise.com/pub/OpenBSD/OpenSSH/portable/openssh-7.5p1.tar.gz
Post by J Gomez
./configure --host=i686-w64-mingw32.static --build=i686
<snip>
configure: error: *** Can't find recent OpenSSL libcrypto (see config.log
for details) ***
I can reproduce it here.
Post by J Gomez
I'm guessing I have to compile libcryto since I don't see it at
http://mxe.cc/build-matrix.html?
usr/i686-w64-mingw32.static/lib/libcrypto.a is installed as a part of
openssl package. The problem is that openssh's configure script fails
to find it.

I checked config.log and it has the errors like this:

libcrypto.a(rand_win.o):rand_win.c:(.text+0xf6d): undefined reference
to `***@8'

This is because libcrypto uses symbols from other libraries
(GetDeviceCaps is from system library gdi32). The full list of these
libraries can be found in file
usr/i686-w64-mingw32.static/lib/pkgconfig/libcrypto.pc

I added the following option to configure:
--with-libs="$(i686-w64-mingw32.static-pkg-config --libs libcrypto)"

Now it fails with another error: checking for socklen_t equivalent...
configure: error: Cannot find a type to use in place of socklen_t

I fixed this error with the following patch:

--- /tmp/openssh-7.5p1/aclocal.m4 2017-03-20 03:39:27.000000000 +0100
+++ aclocal.m4 2017-04-28 03:09:05.245672111 +0200
@@ -152,10 +152,9 @@
for arg2 in "struct sockaddr" void; do
for t in int size_t unsigned long "unsigned long"; do
AC_TRY_COMPILE([
- #include <sys/types.h>
- #include <sys/socket.h>
+ #include <ws2tcpip.h>

- int getpeername (int, $arg2 *, $t *);
+ WINSOCK_API_LINKAGE int WSAAPI getpeername (SOCKET,
$arg2 *, $t *);
],[
$t len;
getpeername(0,0,&len);

followed by `autoreconf` invocation.

But when I run `make` tons of errors of missing headers (like
netinet/in.h) appeared.

It looks like the package needs more patching to build with MXE.

PS. There is libssh2 package in MXE.
--
Best regards,
Boris Nagaev
Loading...