On Sun, 28 Nov 2010, Andy Polyakov via RT wrote:

> (I wrote): 
> > In compiling openssl head (tarball from 18 November 2010) for mingw
> > under cygwin on a Windows98 machine,
> 
> I.e. it's linked with msvcrt.dll, right? It also means that non-vendor
> linker is involved...

It is linked with GNU ld from binutils.

> > I came across a problem in
> > crypto/bss_file.c. The code compiles fine on Windows98 and the
> > openssl.exe executable works fine on WindowsXP, but fails to work on
> > Windows98. The problem shows up during make test when testenc calls the
> > executable from the apps directory. It looks like even when linked with
> > libunicows, Windows98 can't handle the unicode functions.
> 
> I.e. you had to add -lunicows yourself, is it correctly understood? Did
> you add it as './Configure mingw -lunicows' or in some other way? If
> latter how exactly? Ultimately one wants to examine the actual ld
> command line. To do that you can remove apps/openssl.exe, add -v to
> CFLAG in Makefile and re-run make. You should find the actual ld command
> line somewhere there...

I thought that unicows had to be linked as the first library, so I
manually added -lunicows at the beginning of the LIBRARIES variable in
apps/Makefile, after Configure had completed.

You can see the gcc command for linking in the attached file
"linking_unicows.gcc". I also tried passing the --verbose option to ld by
adding -Wl,--verbose to CFLAGS. I think this also confirms unicows as
the first library. I am attaching an extract from the log as
"linking_unicows.details". Attempting to run the openssl.exe file as
openssl.exe version -a gives error messages similar to the previous one
I reported, attached as "version.unicows". Of interest, the executable
file doesn't show dependence on the unicows.dll. The dependencies on
system dll's are:

.\openssl.exe
  C:\WINDOWS\SYSTEM\msvcrt.dll
  C:\WINDOWS\SYSTEM\KERNEL32.dll
  C:\WINDOWS\SYSTEM\ADVAPI32.DLL
  C:\WINDOWS\SYSTEM\GDI32.dll
  C:\WINDOWS\SYSTEM\USER32.dll
  C:\WINDOWS\SYSTEM\WS2_32.DLL
  C:\WINDOWS\SYSTEM\WS2HELP.dll
 
> > I can't figure
> > out how to make this work on Win98, so I would propose for now adding a
> > check of the verion of Windows. Unicode should be supported starting at
> > NT4, so this patch should exclude the code on prior systems. If anyone
> > has a fix to make the code work on Win98, that would be better.
> > 
> > Error messages when running the compiled openssl.exe on Win98 look like:
> > 
> > 4294277479:error:020013EC:system 
> > library:fopen:reason(1004):bss_file.c:163:fopen('../apps/openssl.cnf','rb')
> > 4294277479:error:2006D002:BIO routines:BIO_new_file:system 
> > lib:bss_file.c:168:
> > 4294277479:error:0E078002:configuration file routines:DEF_LOAD:system 
> > lib:conf_def.c:199:
> 
> Note fopen:reason(1004). 1004 stands for "invalid flags" and that is
> something that MultiByteToWideChar could have returned... Note that the
> only recognized error from MultiByteToWideChar is "no unicode
> translation". What happens if you "relax" the 'else' condition, e.g. as
> following
> 
>       else /*if (GetLastError()==ERROR_NO_UNICODE_TRANSLATION)*/
> 
> I'm not suggesting this a fix, just trying to understand what happens
> exactly.


This seems to make the problems go away. With this commented out, the
application doesn't crash. Linking with libunicows does not appear
necessary. For openssl.exe version -a, see the attached file
"version.good".

The linking command from gcc is attached as "linking_good.gcc".

I am sending the files as attachments, since they have long lines and
might get corrupted in the mail.

Thanks for your help with this.

Doug

-- 
Doug Kaufman
Internet: [email protected]
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
 /usr/lib/gcc/i686-pc-mingw32/3.4.4/collect2.exe -Bdynamic -o openssl.exe 
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/crt2.o -L.. 
-L.. -L/usr/lib/gcc/i686-pc-mingw32/3.4.4 -L/usr/lib/gcc/i686-pc-mingw32/3.4.4 
-L/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib 
-L/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../.. openssl.o verify.o asn1pars.o 
req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o 
crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o 
gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o 
s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o 
pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o 
prime.o ts.o -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32 -lmingw32 -lgcc 
-lmoldname -lmingwex -lmsvcrt -lmingw32 -luser32 -lkernel32 -ladvapi32 
-lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
 /usr/lib/gcc/i686-pc-mingw32/3.4.4/collect2.exe -Bdynamic -o openssl.exe 
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/crt2.o -L.. 
-L.. -L/usr/lib/gcc/i686-pc-mingw32/3.4.4 -L/usr/lib/gcc/i686-pc-mingw32/3.4.4 
-L/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib 
-L/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../.. openssl.o verify.o asn1pars.o 
req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o 
crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o 
gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o 
s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o 
pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o 
prime.o ts.o -lunicows -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32 -lmingw32 
-lgcc -lmoldname -lmingwex -lmsvcrt -lmingw32 -luser32 -lkernel32 -ladvapi32 
-lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
GNU ld (GNU Binutils) 2.18.50.20080625
  Supported emulations:
   i386pe
using internal linker script:
==================================================
/* Default linker script, for normal executables */
OUTPUT_FORMAT(pei-i386)

...

==================================================
attempt to open 
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/crt2.o 
succeeded
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/crt2.o
attempt to open openssl.o succeeded
openssl.o
attempt to open verify.o succeeded
verify.o
attempt to open asn1pars.o succeeded
asn1pars.o
attempt to open req.o succeeded
req.o
attempt to open dgst.o succeeded
dgst.o
attempt to open dh.o succeeded
dh.o
attempt to open dhparam.o succeeded
dhparam.o
attempt to open enc.o succeeded
enc.o
attempt to open passwd.o succeeded
passwd.o
attempt to open gendh.o succeeded
gendh.o
attempt to open errstr.o succeeded
errstr.o
attempt to open ca.o succeeded
ca.o
attempt to open pkcs7.o succeeded
pkcs7.o
attempt to open crl2p7.o succeeded
crl2p7.o
attempt to open crl.o succeeded
crl.o
attempt to open rsa.o succeeded
rsa.o
attempt to open rsautl.o succeeded
rsautl.o
attempt to open dsa.o succeeded
dsa.o
attempt to open dsaparam.o succeeded
dsaparam.o
attempt to open ec.o succeeded
ec.o
attempt to open ecparam.o succeeded
ecparam.o
attempt to open x509.o succeeded
x509.o
attempt to open genrsa.o succeeded
genrsa.o
attempt to open gendsa.o succeeded
gendsa.o
attempt to open genpkey.o succeeded
genpkey.o
attempt to open s_server.o succeeded
s_server.o
attempt to open s_client.o succeeded
s_client.o
attempt to open speed.o succeeded
speed.o
attempt to open s_time.o succeeded
s_time.o
attempt to open apps.o succeeded
apps.o
attempt to open s_cb.o succeeded
s_cb.o
attempt to open s_socket.o succeeded
s_socket.o
attempt to open app_rand.o succeeded
app_rand.o
attempt to open version.o succeeded
version.o
attempt to open sess_id.o succeeded
sess_id.o
attempt to open ciphers.o succeeded
ciphers.o
attempt to open nseq.o succeeded
nseq.o
attempt to open pkcs12.o succeeded
pkcs12.o
attempt to open pkcs8.o succeeded
pkcs8.o
attempt to open pkey.o succeeded
pkey.o
attempt to open pkeyparam.o succeeded
pkeyparam.o
attempt to open pkeyutl.o succeeded
pkeyutl.o
attempt to open spkac.o succeeded
spkac.o
attempt to open smime.o succeeded
smime.o
attempt to open cms.o succeeded
cms.o
attempt to open rand.o succeeded
rand.o
attempt to open engine.o succeeded
engine.o
attempt to open ocsp.o succeeded
ocsp.o
attempt to open prime.o succeeded
prime.o
attempt to open ts.o succeeded
ts.o
attempt to open ../libunicows.dll.a failed
attempt to open ../unicows.dll.a failed
attempt to open ../libunicows.a failed
attempt to open ../unicows.lib failed
attempt to open ../libunicows.dll failed
attempt to open ../unicows.dll failed
attempt to open ../libunicows.a failed
attempt to open ../libunicows.dll.a failed
attempt to open ../unicows.dll.a failed
attempt to open ../libunicows.a failed
attempt to open ../unicows.lib failed
attempt to open ../libunicows.dll failed
attempt to open ../unicows.dll failed
attempt to open ../libunicows.a failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/libunicows.dll.a failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/unicows.dll.a failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/libunicows.a failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/unicows.lib failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/libunicows.dll failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/unicows.dll failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/libunicows.a failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/libunicows.dll.a failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/unicows.dll.a failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/libunicows.a failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/unicows.lib failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/libunicows.dll failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/unicows.dll failed
attempt to open /usr/lib/gcc/i686-pc-mingw32/3.4.4/libunicows.a failed
attempt to open 
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/libunicows.dll.a
 failed
attempt to open 
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/unicows.dll.a
 failed
attempt to open 
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/libunicows.a 
succeeded
attempt to open ../libssl.dll.a failed
attempt to open ../ssl.dll.a failed
attempt to open ../libssl.a succeeded
4169892581:error:020013EC:system 
library:fopen:reason(1004):bss_file.c:163:fopen('d:/cygwin/mingw/ssl/openssl.cnf','rb')

4169892581:error:2006D002:BIO routines:BIO_new_file:system lib:bss_file.c:168:

4169892581:error:0E078002:configuration file routines:DEF_LOAD:system 
lib:conf_def.c:199:

OpenSSL 1.1.0-dev xx XXX xxxx

built on: Sun Nov 28 12:30:36 PST 2010

platform: mingw

options:  bn(64,32) rc4(4x,int) des(ptr,risc1,16,long) blowfish(idx) 

compiler: gcc -v -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -mno-cygwin -DL_ENDIAN 
-DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i486 -Wall 
-DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT 
-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM 
-DWHIRLPOOL_ASM -DGHASH_ASM

OPENSSLDIR: "d:/cygwin/mingw/ssl"

Reply via email to