[PATCH] mk1mf.pl doesn't generate makefile for Windows CE

classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[PATCH] mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
Hello all,

I found that mk1mf.pl in OpenSSL-0.9.8 doesn't generate a correct
makefile for Windows CE. It uses VC-32.pl instead of VC-CE.pl.

Here is a patch to fix this problem.

Although there still are some problems to be solved to compile, it is a
good starting point, I think.

--
Satoshi Nakamura <[hidden email]>


--- openssl-0.9.8.orig/util/mk1mf.pl 2005-07-05 08:24:12.000000000 +0900
+++ openssl-0.9.8/util/mk1mf.pl 2005-07-24 15:53:31.761420800 +0900
@@ -122,16 +122,16 @@
 $NT=0;
 
 push(@INC,"util/pl","pl");
-if (($platform =~ /VC-(.+)/))
+if ($platform eq "VC-CE")
+ {
+ require 'VC-CE.pl';
+ }
+elsif (($platform =~ /VC-(.+)/))
  {
  $FLAVOR=$1;
  $NT = 1 if $1 eq "NT";
  require 'VC-32.pl';
  }
-elsif ($platform eq "VC-CE")
- {
- require 'VC-CE.pl';
- }
 elsif ($platform eq "Mingw32")
  {
  require 'Mingw32.pl';
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
> I found that mk1mf.pl in OpenSSL-0.9.8 doesn't generate a correct
> makefile for Windows CE. It uses VC-32.pl instead of VC-CE.pl.
>
> Here is a patch to fix this problem.

I've chosen to unify VC-32.pl and VC-CE.pl instead. I mean VC-CE.pl is
gone now and VC-32.pl is expected to take care of all Windows flavors,
Win32, Win64 and WinCE. See http://cvs.openssl.org/chngview?cn=14275 for
reference.

> Although there still are some problems to be solved to compile, it is a
> good starting point, I think.

Just in case, there is ongoing discussion about improving CE support,
which goes under "OpenSSL for Windows Mobile 2003" subject, see for
example http://marc.theaimsgroup.com/?t=112185232800001&r=1&w=2. A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
Hi,

At 25 Jul 2005 00:19:17 +0200 Andy Polyakov wrote:
> I've chosen to unify VC-32.pl and VC-CE.pl instead. I mean VC-CE.pl is
> gone now and VC-32.pl is expected to take care of all Windows flavors,
> Win32, Win64 and WinCE. See http://cvs.openssl.org/chngview?cn=14275
> for reference.

I see. I downloaded the latest 0.9.8-snapshot, and it generates correct
cedll.mak.


> Just in case, there is ongoing discussion about improving CE support,
> which goes under "OpenSSL for Windows Mobile 2003" subject, see for
> example http://marc.theaimsgroup.com/?t=112185232800001&r=1&w=2. A.

I feel changing too many things at once is not a good idea. How about
making the current code to compile on the corrent supported platforms
first, then making changes for other platforms such as eVC4 + PPC2003SDK
if needed. After that, remove dependencies on wcecompat for platforms
which allow that.

Regards.

--
Satoshi Nakamura <[hidden email]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
>>I've chosen to unify VC-32.pl and VC-CE.pl instead. I mean VC-CE.pl is
>>gone now and VC-32.pl is expected to take care of all Windows flavors,
>>Win32, Win64 and WinCE. See http://cvs.openssl.org/chngview?cn=14275
>>for reference.
>
> I see. I downloaded the latest 0.9.8-snapshot, and it generates correct
> cedll.mak.

I've been browsing through MSDN and didn't quite figured out where
_WIN32_WCE and platform-specific pre-processor macros get
assigned/defined. Most notably I used to believe that they're
pre-defined by compiler driver itself, but [this time?] I failed to find
an explicit reference confirming that this is actually case. I found
reference that at least _WIN32_WCE is defined through project
preferences as -D_WIN32_WCE=$(CEVersion). Now, VC-32.pl passes down
$(WCETARGETDEFS), but does it actually cover _WIN32_WCE? Can you
double-check this? Or better yet, can you post how WCETARGETDEFS is
[normally] expanded?

>>Just in case, there is ongoing discussion about improving CE support,
>>which goes under "OpenSSL for Windows Mobile 2003" subject, see for
>>example http://marc.theaimsgroup.com/?t=112185232800001&r=1&w=2.
>
> I feel changing too many things at once is not a good idea. How about
> making the current code to compile on the corrent supported platforms
> first, then making changes for other platforms such as eVC4 + PPC2003SDK
> if needed. After that, remove dependencies on wcecompat for platforms
> which allow that.

Well, the way I feel is that "currently supported platforms" needs
definition first:-) And once again [as already mentioned in above
mentioned thread] I still fail to see why PPC2003 needs special
treatment. I'd rather classify them by _WIN32_WCE value or something
similar. A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
Hi,

At 25 Jul 2005 11:27:32 +0200 Andy Polyakov wrote:

> I've been browsing through MSDN and didn't quite figured out where
> _WIN32_WCE and platform-specific pre-processor macros get
> assigned/defined. Most notably I used to believe that they're pre-
> defined by compiler driver itself, but [this time?] I failed to find an
> explicit reference confirming that this is actually case. I found
> reference that at least _WIN32_WCE is defined through project
> preferences as -D_WIN32_WCE=$(CEVersion). Now, VC-32.pl passes down
> $(WCETARGETDEFS), but does it actually cover _WIN32_WCE? Can you double-
> check this? Or better yet, can you post how WCETARGETDEFS is [normally]
> expanded?

Compiler doesn't define any _WIN32_WCE, UNDER_CE and so on. So you need
to specify explicitly with -D options. Unfortunatelly wcecompat has a bug
that it defines _WIN32_CE instead of _WIN32_WCE.

For example, for Pocket PC (on WCE300) ARM, WCETARGETDEFS is expanded to

-DWCEPLATFORM=MS_POCKET_PC_2000 -DARM -D_ARM_ -DUNDER_CE=300 -D_WIN32_CE=300 -DUNICODE -D_UNICODE

I think we need to fix this problem before everything else. The simplest
way to fix this problem is to add -D_WIN32_WCE=$(WCEVERSION) after
$(WCETARGETDEFS) in makefiles.


> Well, the way I feel is that "currently supported platforms" needs
> definition first:-) And once again [as already mentioned in above
> mentioned thread] I still fail to see why PPC2003 needs special
> treatment. I'd rather classify them by _WIN32_WCE value or something
> similar.

In original wcecompat, there are five platforms defined: MS HPC, MS HPC
Pro, ms palm size pc, ms pocket pc and Pocket PC 2002. I think "ms pocket
pc" is a good starting point. Because this is the oldest platform which
was built on Windows CE 3.0. Before Windows CE 3.0, supports for C
runtime library are poorer. In addition, a library built for "ms pocket
pc" can be used on newer Pocket PC platforms.

Actually, I can build OpenSSL for "MS HPC Pro" platform using some
patches against wcecompat. But before we start investigating about lacks
of C runtime library supports, how about making it compile for "ms pocket
pc" platform?


About PPC2003 issue, sometimes it needs platform specific treatment,
because APIs are defined for 'Platform' but for 'Version of Windows CE'.
But from my experience, these cases are rare and mostly involved in shell
APIs or something which may not be used by OpenSSL.

I beleive we can classify by _WIN32_WCE (and possibly _WIN32_WCE_PSPC) in
most cases.

Regards.

--
Satoshi Nakamura <[hidden email]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
>>I found
>>reference that at least _WIN32_WCE is defined through project
>>preferences as -D_WIN32_WCE=$(CEVersion).
>
> I think we need to fix this problem before everything else. The simplest
> way to fix this problem is to add -D_WIN32_WCE=$(WCEVERSION) after
> $(WCETARGETDEFS) in makefiles.

Can you double-confirm this? MSDN mentions -D_WIN32_WCE=$(CEVersion) and
you suggest -D_WIN32_WCE=$(WCEVERSION). Is one wrong or are both right? A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
>>> I found
>>> reference that at least _WIN32_WCE is defined through project
>>> preferences as -D_WIN32_WCE=$(CEVersion).
>>
>>
>> I think we need to fix this problem before everything else. The simplest
>> way to fix this problem is to add -D_WIN32_WCE=$(WCEVERSION) after
>> $(WCETARGETDEFS) in makefiles.
>
>
> Can you double-confirm this? MSDN mentions -D_WIN32_WCE=$(CEVersion) and
> you suggest -D_WIN32_WCE=$(WCEVERSION). Is one wrong or are both right?

OK, I can see that WCEVERSION is defined in 3rd party wcecompat.mak, but
I would feel better if we use variable set by VCVARS*.BAR or whatever
it's called in embedded C. Meaning that I'd like to rephrase the
question. Can you figure out variables set by VC, which we can use? A.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
Hi,

At 25 Jul 2005 23:36:41 +0200 Andy Polyakov wrote:
> > Can you double-confirm this? MSDN mentions -D_WIN32_WCE=$(CEVersion)
> > and you suggest -D_WIN32_WCE=$(WCEVERSION). Is one wrong or are both
> > right?
>
> OK, I can see that WCEVERSION is defined in 3rd party wcecompat.mak,
> but I would feel better if we use variable set by VCVARS*.BAR or
> whatever it's called in embedded C. Meaning that I'd like to rephrase
> the question. Can you figure out variables set by VC, which we can use?

They are OSVERSION, PLATFORM, WCEROOT, SDKROOT, PATH, INCLUDE, LIB, CC,
TARGETCPU and CFG.

Here is a script from WCEARM.BAT.

if "%OSVERSION%"=="" set OSVERSION=WCE300
if "%PLATFORM%"=="" set PLATFORM=ms pocket pc
if "%WCEROOT%"=="" set WCEROOT=C:\Program Files\Microsoft eMbedded Visual Tools
if "%SDKROOT%"=="" set SDKROOT=C:\Program Files\Windows CE Tools

set PATH=%WCEROOT%\COMMON\EVC\bin;%WCEROOT%\EVC\%OSVERSION%\bin;%path%
set INCLUDE=%SDKROOT%\%OSVERSION%\%PLATFORM%\include;%SDKROOT%\%OSVERSION%\%PLATFORM%\MFC\include;%SDKROOT%\%OSVERSION%\%PLATFORM%\ATL\include;
set LIB=%SDKROOT%\%OSVERSION%\%PLATFORM%\lib\arm;%SDKROOT%\%OSVERSION%\%PLATFORM%\MFC\lib\arm;%SDKROOT%\%OSVERSION%\%PLATFORM%\ATL\lib\arm;

set CC=clarm.exe

set TARGETCPU=ARM
set CFG=none


CEVersion is set by IDE, so you cannot utilize it from commandline.

--
Satoshi Nakamura <[hidden email]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
>>OK, I can see that WCEVERSION is defined in 3rd party wcecompat.mak,
>>but I would feel better if we use variable set by VCVARS*.BAR or
>>whatever it's called in embedded C. Meaning that I'd like to rephrase
>>the question. Can you figure out variables set by VC, which we can use?
>
>
> They are OSVERSION, PLATFORM, WCEROOT, SDKROOT, PATH, INCLUDE, LIB, CC,
> TARGETCPU and CFG.
>
> Here is a script from WCEARM.BAT.
>
> if "%OSVERSION%"=="" set OSVERSION=WCE300
> if "%PLATFORM%"=="" set PLATFORM=ms pocket pc
> if "%WCEROOT%"=="" set WCEROOT=C:\Program Files\Microsoft eMbedded Visual Tools
> if "%SDKROOT%"=="" set SDKROOT=C:\Program Files\Windows CE Tools
>
> set CC=clarm.exe
>
> set TARGETCPU=ARM
> set CFG=none
>
>
> CEVersion is set by IDE, so you cannot utilize it from commandline.

And therefore I've decided to eliminate dependency on wcedefs.mak [from
wcecompat] and implemented the corresponding logic directly to
VC-32.mak. Grab latest snapshot to test it. For reference. Note that
this change doesn't eliminate dependency on wcecompat [which is not the
goal], but dependency on wcedefs.mak file from wcecompat. A.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: mk1mf.pl doesn't generate makefile for Windows CE

Steven Reddie
Hi Andy,

I haven't been keeping on top of the issues with CE builds (since they
worked for me with a few minor tweaks).  What was the problem with
wcedefs.mak?  I had made a whole lot of changes to better support some more
CE platforms but with it gone won't be able to role them in so easily.  The
reason for an external CE-specific makefile is that the settings vary
between the different dev kits (eVC3 and eVC4) and so it can take enough
code to straighten things out that it would clutter VC-32.pl more than may
be liked.  It's not a big deal if only ARM is supported, but CE supports
several other processors too.

One change that you may want to make is turning off the optimisations.  I
think the flags are /Ox /Ob2 /O2.  /Ox and /O2 will cause eVC4 to break with
internal compiler errors on a number of modules.

Regards,

Steven

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
On Behalf Of Andy Polyakov
Sent: Monday, 1 August 2005 7:32 PM
To: [hidden email]
Subject: Re: mk1mf.pl doesn't generate makefile for Windows CE

>>OK, I can see that WCEVERSION is defined in 3rd party wcecompat.mak,
>>but I would feel better if we use variable set by VCVARS*.BAR or
>>whatever it's called in embedded C. Meaning that I'd like to rephrase
>>the question. Can you figure out variables set by VC, which we can use?
>
>
> They are OSVERSION, PLATFORM, WCEROOT, SDKROOT, PATH, INCLUDE, LIB,
> CC, TARGETCPU and CFG.
>
> Here is a script from WCEARM.BAT.
>
> if "%OSVERSION%"=="" set OSVERSION=WCE300 if "%PLATFORM%"=="" set
> PLATFORM=ms pocket pc if "%WCEROOT%"=="" set WCEROOT=C:\Program
> Files\Microsoft eMbedded Visual Tools if "%SDKROOT%"=="" set
> SDKROOT=C:\Program Files\Windows CE Tools
>
> set CC=clarm.exe
>
> set TARGETCPU=ARM
> set CFG=none
>
>
> CEVersion is set by IDE, so you cannot utilize it from commandline.

And therefore I've decided to eliminate dependency on wcedefs.mak [from
wcecompat] and implemented the corresponding logic directly to VC-32.mak.
Grab latest snapshot to test it. For reference. Note that this change
doesn't eliminate dependency on wcecompat [which is not the goal], but
dependency on wcedefs.mak file from wcecompat. A.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
> I haven't been keeping on top of the issues with CE builds (since they
> worked for me with a few minor tweaks).  What was the problem with
> wcedefs.mak?

Lack of support for *arbitrary* CE version, most notably > 300, lack of
support for commonly referred _WIN32_WCE and lack of support for
*arbitrary* %PLATFORM% string. The vision is to reduce WCE-isms to #if
defined(_WIN32_WCE) && _WIN32_WCE>=*minimally_required* and eventual
#ifdef PLATFORM [there it's *proven* to be required]. The latter is
currently broken as I now realize, by means of essentially meaningless
-DWCEPLATFORM=$wceplatf [which was kind of copied from wcedefs.mak]. It
should be -D$wceplatf [or why not -DWCE_$wceplatf], right? Note that all
this doesn't exclude possibilty of wcecompat library being compiled with
different _WIN32_CE for same CPU architecture, as long as binary
compatibility is known to be preserved...

> I had made a whole lot of changes to better support some more
> CE platforms but with it gone won't be able to role them in so easily.

Goal is to make it compatible, so just tell what got broken in OpenSSL
and we take it from there...

> The
> reason for an external CE-specific makefile is that the settings vary
> between the different dev kits (eVC3 and eVC4) and so it can take enough
> code to straighten things out that it would clutter VC-32.pl more than may
> be liked.  It's not a big deal if only ARM is supported, but CE supports
> several other processors too.

I don't see WCE *processor* dependencies in OpenSSL... The only real
dependency is /machine argument passed to linker, but it's addressed in
VC-32.pl... There're surely are CPU dependencies in
%WCECOMPAT%/include... I can see only one in setjmp.h... We use setjmp
in des/read_pwd.c, but does that code actually work under WCE? If not,
keep in mind that the dependency might as well disappear as we make it
work...

> One change that you may want to make is turning off the optimisations.  I
> think the flags are /Ox /Ob2 /O2.  /Ox and /O2 will cause eVC4 to break with
> internal compiler errors on a number of modules.

Well, let's set them to "least common denominator" or remove them
altogether, leaving the option to specify them through environment
variable. Either similar to 'set CL=/Ox', which tricks cl.exe to
optimize everything without specifying any such options explicitly in
command line... Or by dropping explicit $(CL) [or similar] into compiler
command line in makefile... A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
> The vision is to reduce WCE-isms to #if
> defined(_WIN32_WCE) && _WIN32_WCE>=*minimally_required* and eventual
> #ifdef PLATFORM [there it's *proven* to be required]. The latter is
> currently broken as I now realize, by means of essentially meaningless
> -DWCEPLATFORM=$wceplatf

In rand_win.c we could read

#if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO

Well, WCEPLATFORM!=MS_HPC_PRO condition is *never* met... Meaning that
CryptGenRandom was never called on *any* WCE platform, instead of all
but MS_HPC_PRO... Fixed by replacing it with _WIN32_WCE>=210 condition,
which is minimum requirement according to MSDN.

> [which was kind of copied from wcedefs.mak]. It
> should be -D$wceplatf [or why not -DWCE_$wceplatf], right?

I've chosen to settle for -DWCE_PLATFORM_$wceplatf, because that's what
is apparently set by Visual Studio IDE [as some references at MSDN
suggest]. In the above case would result in WCE_PLATFOMR_MS_HPC_PRO
macro being defined. A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
In reply to this post by Andy Polyakov
>> One change that you may want to make is turning off the optimisations.  I
>> think the flags are /Ox /Ob2 /O2.  /Ox and /O2 will cause eVC4 to
>> break with
>> internal compiler errors on a number of modules.
>
>
> Well, let's set them to "least common denominator"

How does /O1i sound? 1 means optimize for space (should be appropriate
for embedded systems:-), i - enables intrinsics (to gain some
performance "back"). A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
In reply to this post by Andy Polyakov
Hi,

At 01 Aug 2005 11:31:57 +0200 Andy Polyakov wrote:
> And therefore I've decided to eliminate dependency on wcedefs.mak [from
> wcecompat] and implemented the corresponding logic directly to VC-32.mak.
>  Grab latest snapshot to test it. For reference. Note that this change
> doesn't eliminate dependency on wcecompat [which is not the goal], but
> dependency on wcedefs.mak file from wcecompat. A.

I got openssl-0.9.8-stable-SNAP-20050801.tar.gz and found some problems.

1. Use /MC instead of /MD and /MDd
/MD and /MDd are not supported for Windows CE.

2. Define UNDER_CE as well as _WIN32_WCE.
Some system headers use UNDER_CE instead of _WIN32_CE.

3. Define CPU dependent macros such as _X86_ or _ARM_
System headers use them.

4. /Gs0 is not supported by the compiler for SH3 and SH4

5. /Qsh4 is required for SH4


Here is a patch.

I've tested it for Pocket PC platforms, but not tested for other
platforms and emulartion environments. I'll do it later.


--- openssl-0.9.8-stable-SNAP-20050801.orig/util/pl/VC-32.pl 2005-07-31 05:05:40.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050801/util/pl/VC-32.pl 2005-08-02 23:33:19.006385400 +0900
@@ -41,6 +41,7 @@
     $wcevers = $ENV{'OSVERSION'}; # WCENNN
     die '%OSVERSION% value is insane' if ($wcevers !~ /^WCE([1-9])([0-9]{2})$/);
     $wcecdefs = "-D_WIN32_WCE=$1$2"; # -D_WIN32_WCE=NNN
+    $wcecdefs .= "-DUNDER_CE=$1$2";    # -DUNDER_CE=NNN
     $wcelflag = "/subsystem:windowsce,$1.$2"; # ...,N.NN
     if ($ENV{'TARGETCPU'} =~ /^X86/)
     { $wcelflag .= " /machine:X86"; }
@@ -49,12 +50,24 @@
     $wceplatf =  $ENV{'PLATFORM'};
     $wceplatf =~ tr/a-z0-9 /A-Z0-9_/d;
     $wcecdefs .= " -DWCEPLATFORM=$wceplatf";
+    if ($ENV{'TARGETCPU'} =~ /^X86/)
+    { $wcecdefs .= " -Dx86 -D_X86_" }
+    elsif ($ENV{'TARGETCPU'} =~ /^R4[0-9]{3}/)
+    { $wcecdefs .= " -DMIPS -D_MIPS_ -DMIPS_R4000" }
+    elsif ($ENV{'TARGETCPU'} =~ /^ARM/)
+    { $wcecdefs .= " -DARM -D_ARM_" }
+    else
+    { $wcecdefs .= " -D$ENV{'TARGETCPU'} -D_$ENV{'TARGETCPU'}_" }
+    if ($ENV{'TARGETCPU'} =~ /^SH[0-9]/)
+    { $wcecdefs .= " -DSHx" }
 
     $cc='$(CC)';
-    $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include';
+    $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include';
+    $base_cflags.= " /Gs0" if ($ENV{'TARGETCPU'} !~ /^SH[0-9]/);
     $base_cflags.=" $wcecdefs";
-    $opt_cflags=' /MD /Ox /O2 /Ob2';
-    $dbg_clfags=' /MDd /Od -DDEBUG -D_DEBUG';
+    $base_cflags.=" -Qsh4" if ($ENV{'TARGETCPU'} =~ /^SH4/);
+    $opt_cflags=' /MC /Ox /O2 /Ob2';
+    $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /opt:ref $wcelflag";
     }
 else # Win32


--
Satoshi Nakamura <[hidden email]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
> I got openssl-0.9.8-stable-SNAP-20050801.tar.gz and found some problems.
>
> 1. Use /MC instead of /MD and /MDd
> /MD and /MDd are not supported for Windows CE.

For my reference. What's /MC? I can't find it on MSDN... Can you post
output from 'cl /help'?

> 2. Define UNDER_CE as well as _WIN32_WCE.
> Some system headers use UNDER_CE instead of _WIN32_CE.
>
> 3. Define CPU dependent macros such as _X86_ or _ARM_
> System headers use them.

How is this handled otherwise? I mean does Studio IDE set them up? This
is also for my reference... Is there anything else IDE sets up?

> 4. /Gs0 is not supported by the compiler for SH3 and SH4

I'd remove it altogether. /Gs is set implicitly by /O anyway. Note that
optimization level is suggested to be changed to /O1i. A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
In reply to this post by Andy Polyakov
Hi,

At 02 Aug 2005 14:23:17 +0200 Andy Polyakov wrote:
> In rand_win.c we could read
>
> #if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO
>
> Well, WCEPLATFORM!=MS_HPC_PRO condition is *never* met... Meaning that
> CryptGenRandom was never called on *any* WCE platform, instead of all
> but MS_HPC_PRO... Fixed by replacing it with _WIN32_WCE>=210 condition,
> which is minimum requirement according to MSDN.

I agree with this change.

Here is a patch which eliminates some 'unreferenced local variable'
warnings. In addition to that, change not to call GetVersion because it
is not supported.


diff -ur openssl-0.9.8-stable-SNAP-20050802.orig/crypto/rand/rand_win.c openssl-0.9.8-stable-SNAP-20050802/crypto/rand/rand_win.c
--- openssl-0.9.8-stable-SNAP-20050802.orig/crypto/rand/rand_win.c 2005-05-21 23:00:22.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050802/crypto/rand/rand_win.c 2005-08-02 23:51:45.833052600 +0900
@@ -195,10 +195,14 @@
  HCRYPTPROV hProvider = 0;
  BYTE buf[64];
  DWORD w;
+#ifndef OPENSSL_SYS_WINCE
  HWND h;
+#endif
  int good = 0;
 
+#ifndef OPENSSL_SYS_WINCE
  HMODULE advapi, kernel, user, netapi;
+#endif
  CRYPTACQUIRECONTEXTW acquire = 0;
  CRYPTGENRANDOM gen = 0;
  CRYPTRELEASECONTEXT release = 0;
@@ -217,7 +221,7 @@
         osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;
         GetVersionEx( &osverinfo ) ;
 
-#if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO
+#if defined(OPENSSL_SYS_WINCE) && _WIN32_WCE >= 210
 #ifndef CryptAcquireContext
 #define CryptAcquireContext CryptAcquireContextW
 #endif
@@ -632,8 +636,10 @@
 void RAND_screen(void) /* function available for backward compatibility */
 {
  RAND_poll();
+#if !defined(OPENSSL_SYS_WINCE)
  if (GetVersion() >= 0x80000000 || !OPENSSL_isservice())
  readscreen();
+#endif
 }
 

--
Satoshi Nakamura <[hidden email]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
In reply to this post by Satoshi Nakamura
Hi,

At 02 Aug 2005 23:37:43 +0900 Satoshi Nakamura wrote:
> Here is a patch.

Sorry, there was a small bug. This is the correct one against
snapshot-20050802.

diff -ur openssl-0.9.8-stable-SNAP-20050802.orig/util/pl/VC-32.pl openssl-0.9.8-stable-SNAP-20050802/util/pl/VC-32.pl
--- openssl-0.9.8-stable-SNAP-20050802.orig/util/pl/VC-32.pl 2005-07-31 05:05:40.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050802/util/pl/VC-32.pl 2005-08-02 23:48:49.721423400 +0900
@@ -41,6 +41,7 @@
     $wcevers = $ENV{'OSVERSION'}; # WCENNN
     die '%OSVERSION% value is insane' if ($wcevers !~ /^WCE([1-9])([0-9]{2})$/);
     $wcecdefs = "-D_WIN32_WCE=$1$2"; # -D_WIN32_WCE=NNN
+    $wcecdefs .= " -DUNDER_CE=$1$2";    # -DUNDER_CE=NNN
     $wcelflag = "/subsystem:windowsce,$1.$2"; # ...,N.NN
     if ($ENV{'TARGETCPU'} =~ /^X86/)
     { $wcelflag .= " /machine:X86"; }
@@ -49,12 +50,24 @@
     $wceplatf =  $ENV{'PLATFORM'};
     $wceplatf =~ tr/a-z0-9 /A-Z0-9_/d;
     $wcecdefs .= " -DWCEPLATFORM=$wceplatf";
+    if ($ENV{'TARGETCPU'} =~ /^X86/)
+    { $wcecdefs .= " -Dx86 -D_X86_" }
+    elsif ($ENV{'TARGETCPU'} =~ /^R4[0-9]{3}/)
+    { $wcecdefs .= " -DMIPS -D_MIPS_ -DMIPS_R4000" }
+    elsif ($ENV{'TARGETCPU'} =~ /^ARM/)
+    { $wcecdefs .= " -DARM -D_ARM_" }
+    else
+    { $wcecdefs .= " -D$ENV{'TARGETCPU'} -D_$ENV{'TARGETCPU'}_" }
+    if ($ENV{'TARGETCPU'} =~ /^SH[0-9]/)
+    { $wcecdefs .= " -DSHx" }
 
     $cc='$(CC)';
-    $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include';
+    $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include';
+    $base_cflags.= " /Gs0" if ($ENV{'TARGETCPU'} !~ /^SH[0-9]/);
     $base_cflags.=" $wcecdefs";
-    $opt_cflags=' /MD /Ox /O2 /Ob2';
-    $dbg_clfags=' /MDd /Od -DDEBUG -D_DEBUG';
+    $base_cflags.=" -Qsh4" if ($ENV{'TARGETCPU'} =~ /^SH4/);
+    $opt_cflags=' /MC /Ox /O2 /Ob2';
+    $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /opt:ref $wcelflag";
     }
 else # Win32


In addition, this patch is required to compile.

diff -ur openssl-0.9.8-stable-SNAP-20050802.orig/crypto/cryptlib.c openssl-0.9.8-stable-SNAP-20050802/crypto/cryptlib.c
--- openssl-0.9.8-stable-SNAP-20050802.orig/crypto/cryptlib.c 2005-07-05 09:04:43.000000000 +0900
+++ openssl-0.9.8-stable-SNAP-20050802/crypto/cryptlib.c 2005-08-03 00:04:13.621919400 +0900
@@ -620,7 +620,7 @@
  }
 #endif
 
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(_WIN32_WCE)
 #include <tchar.h>
 
 #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333


Regards.

--
Satoshi Nakamura <[hidden email]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Andy Polyakov
> In addition, this patch is required to compile.
>
> diff -ur openssl-0.9.8-stable-SNAP-20050802.orig/crypto/cryptlib.c openssl-0.9.8-stable-SNAP-20050802/crypto/cryptlib.c
> --- openssl-0.9.8-stable-SNAP-20050802.orig/crypto/cryptlib.c 2005-07-05 09:04:43.000000000 +0900
> +++ openssl-0.9.8-stable-SNAP-20050802/crypto/cryptlib.c 2005-08-03 00:04:13.621919400 +0900
> @@ -620,7 +620,7 @@
>   }
>  #endif
>  
> -#if defined(_WIN32) && !defined(__CYGWIN__)
> +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(_WIN32_WCE)
>  #include <tchar.h>

What fails more specifically? I'd prefer to keep OPENSSL_showfatal,
which would show dialog box on WCE... A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
In reply to this post by Andy Polyakov
Hi,

At 02 Aug 2005 17:14:52 +0200 Andy Polyakov wrote:
> For my reference. What's /MC? I can't find it on MSDN... Can you post
> output from 'cl /help'?

This is cut from output of clarm /?, which is in WCE300 directory.

---
                                 -LINKING-

/MC link with COREDLL.LIB, CORELIBC.LIB  /LDd Create .DLL debug libary
/ML link with COREDLL.LIB, LIBC.LIB      /F<num> set stack size
/LD Create .DLL                          /link [linker options and libraries]

                      -NOT SUPPORTED IN THIS RELEASE-

/Gd __cdecl calling convention           /Gi[-] enable incremental compilation
/Gr __fastcall calling convention        /Gm[-] enable minimal rebuild
/Gz __stdcall calling convention         /EHs enable synchronous C++ EH
/GA optimize for Windows Application     /EHa enable asynchronous C++ EH
/GD optimize for Windows DLL             /EHc extern "C" defaults to nothrow
/GZ enable runtime debug checks          /ZI enable Edit & Continue debug info
/Ge force stack checking for all funcs   /MD link with MSVCRT.LIB
/Gs[num] disable stack checking calls    /MT link with LIBCMT.LIB
/Gh enable hook function call            /MDd link with MSVCRTD.LIB debug lib
/GR[-] enable C++ RTTI                   /MLd link with LIBCD.LIB debug lib
/GX[-] enable C++ EH (same as /EHsc)     /MTd link with LIBCMTD.LIB debug lib
---


> How is this handled otherwise? I mean does Studio IDE set them up? This
> is also for my reference... Is there anything else IDE sets up?

When I create new project for Pocket PC, ARM platform, I got these
project options listed in 'Project Settings' dialog box.

/nologo /W3 /Zi /Od /D "DEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion)
/D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE"
/Fp"ARMDbg/wcetest.pch" /Yu"stdafx.h" /Fo"ARMDbg/" /Fd"ARMDbg/"
/M$(CECrtMTDebug) /c

And these are expaned to:

/nologo /W3 /GX- /D _WIN32_WCE=300 /D "WIN32_PLATFORM_PSPC=310" /D "ARM"
/D "_ARM_" /D UNDER_CE=300 /D "UNICODE" /D "_UNICODE" /D "NDEBUG"
/Fp"ARMRel/test.pch" /Yu"stdafx.h" /Fo"ARMRel/" /Oxs /MC /c

It seems that AppWizard defines ARM and _ARM_ directly.

--
Satoshi Nakamura <[hidden email]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: mk1mf.pl doesn't generate makefile for Windows CE

Satoshi Nakamura
In reply to this post by Andy Polyakov
Hi,

At 02 Aug 2005 17:26:51 +0200 Andy Polyakov wrote:
> What fails more specifically? I'd prefer to keep OPENSSL_showfatal,
> which would show dialog box on WCE... A.

Here is an error message I got:


Building OpenSSL
        clarm.exe /Fotmp32dll_ARM\cryptlib.obj  -Iinc32 -Itmp32dll_ARM /MC /Ox
/O2 /Ob2 /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE
-DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -IC:\wcecompat/include
/Gs0 -D_WIN32_WCE=300 -DUNDER_CE=300 -DWCEPLATFORM=MS_POCKET_PC -DARM -D_ARM_
/Fdout32dll_ARM -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_KRB5 -D_WINDLL
-D_DLL  -DOPENSSL_BUILD_SHLIBCRYPTO -c .\crypto\cryptlib.c
cryptlib.c
.\crypto\cryptlib.c(634) : error C2220: warning treated as error - no object file generated
.\crypto\cryptlib.c(634) : warning C4013: 'GetProcessWindowStation' undefined; assuming extern returning int
.\crypto\cryptlib.c(634) : warning C4047: '=' : 'struct HWINSTA__ *' differs in
levels of indirection from 'int '
.\crypto\cryptlib.c(637) : warning C4013: 'GetUserObjectInformationW' undefined; assuming extern returning int
.\crypto\cryptlib.c(637) : error C2065: 'UOI_NAME' : undeclared identifier
.\crypto\cryptlib.c(672) : warning C4013: 'GetStdHandle' undefined; assuming extern returning int
.\crypto\cryptlib.c(672) : error C2065: 'STD_ERROR_HANDLE' : undeclared identifier
.\crypto\cryptlib.c(672) : warning C4047: '=' : 'void *' differs in levels of indirection from 'int '
.\crypto\cryptlib.c(673) : warning C4013: 'GetFileType' undefined; assuming extern returning int
.\crypto\cryptlib.c(673) : error C2065: 'FILE_TYPE_UNKNOWN' : undeclared identifier
.\crypto\cryptlib.c(682) : warning C4133: '=' : incompatible types - from 'const char *' to 'const unsigned short *'
.\crypto\cryptlib.c(725) : warning C4013: 'GetVersion' undefined; assuming extern returning int
.\crypto\cryptlib.c(726) : warning C4013: 'RegisterEventSource' undefined; assuming extern returning int
.\crypto\cryptlib.c(726) : warning C4047: 'initializing' : 'void *' differs in levels of indirection from 'int '
.\crypto\cryptlib.c(728) : warning C4013: 'ReportEvent' undefined; assuming extern returning int
.\crypto\cryptlib.c(729) : warning C4013: 'DeregisterEventSource' undefined; assuming extern returning int
.\crypto\cryptlib.c(733) : error C2065: 'MSGBOXPARAMS' : undeclared identifier
.\crypto\cryptlib.c(733) : error C2146: syntax error : missing ';' before identifier 'm'
.\crypto\cryptlib.c(733) : error C2065: 'm' : undeclared identifier
.\crypto\cryptlib.c(735) : error C2224: left of '.cbSize' must have struct/union type
.\crypto\cryptlib.c(736) : error C2224: left of '.hwndOwner' must have struct/union type
.\crypto\cryptlib.c(737) : error C2224: left of '.lpszCaption' must have struct/union type
.\crypto\cryptlib.c(738) : error C2224: left of '.dwStyle' must have struct/union type
.\crypto\cryptlib.c(739) : error C2224: left of '.hInstance' must have struct/union type
.\crypto\cryptlib.c(740) : error C2224: left of '.lpszIcon' must have struct/union type
.\crypto\cryptlib.c(740) : error C2065: 'IDI_ERROR' : undeclared identifier
.\crypto\cryptlib.c(741) : error C2224: left of '.dwContextHelpId' must have struct/union type
.\crypto\cryptlib.c(742) : error C2224: left of '.lpfnMsgBoxCallback' must have
struct/union type
.\crypto\cryptlib.c(743) : error C2224: left of '.dwLanguageId' must have struct/union type
.\crypto\cryptlib.c(744) : error C2224: left of '.lpszText' must have struct/union type
.\crypto\cryptlib.c(746) : warning C4013: 'MessageBoxIndirect' undefined; assuming extern returning int
NMAKE : fatal error U1077: 'clarm.exe' : return code '0x2'


I'll look into it later so that OPENSSL_showfatal can show a message box.

--
Satoshi Nakamura <[hidden email]>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
12