Subject: Re: Run cross-compiled libssh2 win32 apps in wine?

Re: Run cross-compiled libssh2 win32 apps in wine?

From: Peter Stuge <peter_at_stuge.se>
Date: Fri, 29 Jan 2010 22:52:50 +0100

Simon Josefsson wrote:
> > I just cross-compiled libgpg-error-1.7, libgcrypt-1.4.5 and
> > libssh2-git with mingw, and I want to run the examples in wine,
> > but libgcrypt throws an error in random/rndw32.c:
> >
> > DBG: rndw32: get performance data problem: ec=2
>
> It is just a warning.

Aha! I thought it was causing the following crash.

> > randomness within wine might be tricky.
>
> Indeed. The problem is that Wine's emulation of Windows is buggy
> here, so it returns an error code instead of the expected data.

Bleh.

> > Question is, has anyone (Simon?) successfully run cross-compiled
> > (or natively built, for that matter!) libssh2 programs in wine?
>
> Sure -- I believe the self-test is running under Wine when I built
> my binary Windows build.
>
> > And if you did - were you using libgcrypt or OpenSSL for crypto?
>
> The binaries on http://josefsson.org/gnutls4win/ are built with
> libgcrypt.

No examples there though.

> See the Makefile for how to build libssh2 using debian's mingw +
> wine.

I can build without trouble, just that programs crash.

> You'll need binfmt_support to make Windows binaries be ran under
> Wine automatically.

Nod. I get the following crash with fairly useless backtrace.

Something that might be worth mentioning is that I've disabled
various stuff in libgcrypt that I don't want to use:

--enable-ciphers=aes --enable-pubkey-ciphers=dsa,rsa --enable-digests=sha1,sha256,sha512

..and changed libgcrypt.h accordingly before building libssh2:

--- a/src/libgcrypt.h
+++ b/src/libgcrypt.h
@@ -39,16 +39,16 @@
 
 #include <gcrypt.h>
 
-#define LIBSSH2_MD5 1
+#define LIBSSH2_MD5 0
 
-#define LIBSSH2_HMAC_RIPEMD 1
+#define LIBSSH2_HMAC_RIPEMD 0
 
 #define LIBSSH2_AES 1
 #define LIBSSH2_AES_CTR 1
-#define LIBSSH2_BLOWFISH 1
-#define LIBSSH2_RC4 1
-#define LIBSSH2_CAST 1
-#define LIBSSH2_3DES 1
+#define LIBSSH2_BLOWFISH 0
+#define LIBSSH2_RC4 0
+#define LIBSSH2_CAST 0
+#define LIBSSH2_3DES 0

Here's the output I get:

$ make check
make simple.exe
make[1]: Entering directory `/home/stuge/w32/libssh2/libssh2.git/tests'
make[1]: `simple.exe' is up to date.
make[1]: Leaving directory `/home/stuge/w32/libssh2/libssh2.git/tests'
make check-TESTS
make[1]: Entering directory `/home/stuge/w32/libssh2/libssh2.git/tests'
PASS: simple.exe
NOTE: you should run 'diskperf -y' to enable the disk statistics
fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
fixme:ntdll:NtQuerySystemInformation (0x00000004,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000006,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000007,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000009,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000000a,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000000c,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000000d,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000000e,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000000f,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_HANDLE_INFORMATION
fixme:ntdll:NtQuerySystemInformation (0x00000011,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000012,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000013,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000014,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_CACHE_INFORMATION
fixme:ntdll:NtQuerySystemInformation (0x00000016,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_INTERRUPT_INFORMATION
fixme:ntdll:NtQuerySystemInformation (0x00000018,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000019,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000001c,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000001d,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000001e,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000001f,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000020,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000021,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000022,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000024,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation SystemRegistryQuotaInformation: faking max registry size of 32 MB
fixme:ntdll:NtQuerySystemInformation (0x00000027,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000028,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000029,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000002a,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000002b,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000002c,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000002d,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000031,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000032,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000033,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000036,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000037,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000038,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x00000039,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000003a,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000003b,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000003c,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000003d,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000003e,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtQuerySystemInformation (0x0000003f,0x12c818,0x0000f800,0x60fa88) stub
fixme:ntdll:NtPowerInformation semi-stub: SystemPowerCapabilities
DBG: rndw32: get performance data problem: ec=2
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60fa7c,0x60fa78): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9dc,0x60f9d8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f92c,0x60f928): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f8fc,0x60f8f8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9ac,0x60f9a8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9ac,0x60f9a8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f8fc,0x60f8f8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9ac,0x60f9a8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9ac,0x60f9a8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f95c,0x60f958): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9ac,0x60f9a8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9ac,0x60f9a8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f95c,0x60f958): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9ac,0x60f9a8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9ac,0x60f9a8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60fa8c,0x60fa88): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60fa6c,0x60fa68): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60fa0c,0x60fa08): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f9bc,0x60f9b8): stub
fixme:process:GetProcessWorkingSetSize (0xffffffff,0x60f95c,0x60f958): stub
Fingerprint: wine: Unhandled page fault on read access to 0x00000000 at address 0x401525 (thread 001f), starting debugger...
Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x00401525).
Register dump:
 CS:0073 SS:007b DS:007b ES:007b FS:0033 GS:003b
 EIP:00401525 ESP:0060fc80 EBP:0060fe98 EFLAGS:00010246( R- -- I Z- -P- )
 EAX:00000000 EBX:6846aff4 ECX:0000000d EDX:00000000
 ESI:7ffdf000 EDI:00401130
Stack dump:
0x0060fc80: 00403096 00000001 00000000 00000000
0x0060fc90: 00000000 00000000 00000000 6802ae34
0x0060fca0: 00000020 00125cb0 0060fcc8 68320e4f
0x0060fcb0: 000fa328 00020000 00125ce8 02020002
0x0060fcc0: 536e6957 206b636f 00302e32 00110014
0x0060fcd0: 00125d70 0000a290 00000001 68320e4f
Backtrace:
=>0 0x00401525 in ssh2 (+0x1525) (0x0060fe98)
  1 0x004010b6 in ssh2 (+0x10b6) (0x0060fee8)
  2 0x00401148 in ssh2 (+0x1148) (0x0060ff08)
  3 0x6842b210 in kernel32 (+0x5b210) (0x0060ffe8)
0x00401525: movzbl 0x0(%eax),%eax
Modules:
Module Address Debug info Name (54 modules)
PE 240000- 262000 Deferred libgpg-error-0
PE 400000- 40d000 Export ssh2
PE 10000000-10105000 Deferred libgcrypt-11
ELF 40000000-40027000 Deferred netapi32<elf>
  \-PE 40010000-40027000 \ netapi32
ELF 40027000-40046000 Deferred iphlpapi<elf>
  \-PE 40030000-40046000 \ iphlpapi
ELF 4005e000-40073000 Deferred libresolv.so.2
PE 63b40000-63bda000 Deferred libssh2-1
ELF 68000000-6801f000 Deferred ld-linux.so.2
ELF 68020000-6815c000 Deferred libwine.so.1
ELF 6815d000-68166000 Deferred libnss_compat.so.2
ELF 68166000-68171000 Deferred libnss_nis.so.2
ELF 68174000-6818d000 Deferred libpthread.so.0
ELF 6818d000-682d7000 Deferred libc.so.6
ELF 682d7000-682db000 Deferred libdl.so.2
ELF 682dc000-6838e000 Deferred ntdll<elf>
  \-PE 682f0000-6838e000 \ ntdll
ELF 6838e000-683b4000 Deferred libm.so.6
ELF 683b4000-68507000 Export kernel32<elf>
  \-PE 683d0000-68507000 \ kernel32
ELF 6871f000-68736000 Deferred libnsl.so.1
ELF 68736000-68742000 Deferred libnss_files.so.2
ELF 68742000-68798000 Deferred advapi32<elf>
  \-PE 68750000-68798000 \ advapi32
ELF 68798000-68808000 Deferred msvcrt<elf>
  \-PE 687b0000-68808000 \ msvcrt
ELF 68808000-68953000 Deferred user32<elf>
  \-PE 68820000-68953000 \ user32
ELF 68953000-689f5000 Deferred gdi32<elf>
  \-PE 68960000-689f5000 \ gdi32
ELF 689f5000-68a23000 Deferred ws2_32<elf>
  \-PE 68a00000-68a23000 \ ws2_32
ELF 68a23000-68aaa000 Deferred libfreetype.so.6
ELF 68aaa000-68abe000 Deferred libz.so.1
ELF 68ad6000-68b03000 Deferred libfontconfig.so.1
ELF 68b03000-68b2a000 Deferred libexpat.so.1
ELF 68b5c000-68bf7000 Deferred winex11<elf>
  \-PE 68b70000-68bf7000 \ winex11
ELF 68c0f000-68c18000 Deferred libsm.so.6
ELF 68c18000-68c31000 Deferred libice.so.6
ELF 68c31000-68c40000 Deferred libxext.so.6
ELF 68c40000-68d34000 Deferred libx11.so.6
ELF 68d34000-68d39000 Deferred libuuid.so.1
ELF 68d39000-68d3d000 Deferred libxau.so.6
ELF 68d3d000-68d43000 Deferred libxdmcp.so.6
ELF 68d43000-68d64000 Deferred imm32<elf>
  \-PE 68d50000-68d64000 \ imm32
ELF 68d64000-68d6a000 Deferred libxxf86vm.so.1
ELF 68d6a000-68d74000 Deferred libxrender.so.1
ELF 68d74000-68d7d000 Deferred libxrandr.so.2
ELF 68d7d000-68d88000 Deferred libxcursor.so.1
ELF 68d88000-68d8e000 Deferred libxfixes.so.3
ELF 7bf00000-7bf04000 Deferred <wine-loader>
Threads:
process tid prio (all id:s are in hex)
0000000e
        0000001c 0
        00000014 0
        00000010 0
        0000000f 0
00000011
        00000018 0
        00000013 0
        00000012 0
00000019
        0000001d 0
        0000001b 0
        0000001a 0
00000035
        00000034 0
00000037
        00000036 0
0000000d
        0000000c 0
00000039
        00000038 0
0000003e
        0000000b 0
00000015 (D) Z:\home\stuge\w32\libssh2\libssh2.git\tests\.libs\ssh2.exe
        0000001f 0 <==
Backtrace:
=>0 0x00401525 in ssh2 (+0x1525) (0x0060fe98)
  1 0x004010b6 in ssh2 (+0x10b6) (0x0060fee8)
  2 0x00401148 in ssh2 (+0x1148) (0x0060ff08)
  3 0x6842b210 in kernel32 (+0x5b210) (0x0060ffe8)
FAIL: ssh2.sh
===========================================
1 of 2 tests failed
Please report to libssh2-devel_at_cool.haxx.se
===========================================
make[1]: *** [check-TESTS] Error 1
make[1]: Leaving directory `/home/stuge/w32/libssh2/libssh2.git/tests'
make: *** [check-am] Error 2

It's encouraging that simple.exe works, but still..

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-01-29