You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Allan Edwards <ak...@us.ibm.com> on 2004/07/21 00:11:32 UTC

Windows 2003 IA64 builds?

Has anyone attempted to build apr/apache for Windows 2003 Itanium?
First attempts to build using 2003 SDK and Visual Studio 6.0
gave a surprising number of type mismatch warnings, about 100
for apr/aprutil and around 80 for libhttpd. Need to comb through
these to see how many are real issues, but was wondering if this is
pioneering work or has anyone ventured down this path ahead of me?

Allan


Re: Windows 2003 IA64 builds?

Posted by Allan Edwards <ak...@us.ibm.com>.
I posted a companion patch to the apr list last night.
This patch against HEAD along with the apr patch get
the three core dlls cross compiling with Visual Studio 6
+ IA64 SDK. It addresses most /W2 warnings and fixes a
couple of bugs. I haven't looked at many of the modules
yet.

As I mentioned in the other note there are a lot more
warnings that are thrown with /W3 that need to be
investigated furher.

In addition to fixing compiler warnings there is the
question of the build process. I'm currently running
"setenv /SRV64 /RETAIL" from the SDK to set the IA64
environment, then running msdev with the /USEENV option.
This requires a separate set of .dsp files that have
been munged to specify /machine:IA64 among other things.
Keeping the .dsp's separate rather than folding into
the existing ones if for convenience and maintainability
at least in the short term, maybe the long term too.

One problem that comes up is that there are 3 executables
built that are used to generate tables at compile time, but
since everything is cross compiled IA64 that doesn't work.
I'll have to hack around that somehow, maybe store the prebuilt
files in CVS and copy to the appropriate locations.
I'm open to suggestions if anyone has a better idea.

If this sounds reasonable I'll proceed along this path.

Allan
------------------------------------------------------
Index: os/win32/ap_regkey.c
===================================================================
RCS file: /home/cvs/httpd-2.0/os/win32/ap_regkey.c,v
retrieving revision 1.11
diff -U3 -r1.11 ap_regkey.c
--- os/win32/ap_regkey.c	9 Feb 2004 20:40:49 -0000	1.11
+++ os/win32/ap_regkey.c	17 Aug 2004 21:02:48 -0000
@@ -236,7 +236,7 @@
           */
          valuelen = (size - 1) * 3 + 1;
          *result = apr_palloc(pool, valuelen);
-        rv = apr_conv_ucs2_to_utf8(wvalue, &size, *result, &valuelen);
+        rv = apr_conv_ucs2_to_utf8(wvalue, (apr_size_t *)&size, *result, &valuelen);
          if (rv != APR_SUCCESS)
              return rv;
          else if (size)
@@ -309,7 +309,7 @@

          wvallen = alloclen = size;
          wvalue = apr_palloc(pool, alloclen * 2);
-        rv = apr_conv_utf8_to_ucs2(value, &size, wvalue, &wvallen);
+        rv = apr_conv_utf8_to_ucs2(value, (apr_size_t *)&size, wvalue, &wvallen);
          if (rv != APR_SUCCESS)
              return rv;
          else if (size)
@@ -363,7 +363,7 @@
              return APR_ENAMETOOLONG;
          /* Read to NULL buffer to determine value size */
          rc = RegQueryValueExW(key->hkey, wvalname, 0, resulttype,
-                              NULL, resultsize);
+                              NULL, (LPDWORD)resultsize);
          if (rc != ERROR_SUCCESS) {
              return APR_FROM_OS_ERROR(rc);
          }
@@ -371,7 +371,7 @@
          /* Read value based on size query above */
          *result = apr_palloc(pool, *resultsize);
          rc = RegQueryValueExW(key->hkey, wvalname, 0, resulttype,
-                             (LPBYTE)*result, resultsize);
+                             (LPBYTE)*result, (LPDWORD)resultsize);
      }
  #endif /* APR_HAS_UNICODE_FS */
  #if APR_HAS_ANSI_FS
@@ -379,14 +379,14 @@
      {
          /* Read to NULL buffer to determine value size */
          rc = RegQueryValueEx(key->hkey, valuename, 0, resulttype,
-                             NULL, resultsize);
+                             NULL, (LPDWORD)resultsize);
          if (rc != ERROR_SUCCESS)
              return APR_FROM_OS_ERROR(rc);

          /* Read value based on size query above */
          *result = apr_palloc(pool, *resultsize);
          rc = RegQueryValueEx(key->hkey, valuename, 0, resulttype,
-                             (LPBYTE)*result, resultsize);
+                             (LPBYTE)*result, (LPDWORD)resultsize);
          if (rc != ERROR_SUCCESS)
              return APR_FROM_OS_ERROR(rc);
      }
@@ -452,7 +452,7 @@
      char *buf;
      char *tmp;
      DWORD type;
-    DWORD size = 0;
+    apr_size_t size = 0;

      rv = ap_regkey_value_raw_get(&value, &size, &type, key, valuename, pool);
      if (rv != APR_SUCCESS) {
Index: server/mpm/winnt/child.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/child.c,v
retrieving revision 1.37
diff -U3 -r1.37 child.c
--- server/mpm/winnt/child.c	14 Aug 2004 10:57:13 -0000	1.37
+++ server/mpm/winnt/child.c	17 Aug 2004 21:02:48 -0000
@@ -684,7 +684,7 @@
  {
      int rc;
      DWORD BytesRead;
-    DWORD CompKey;
+    apr_size_t CompKey;
      LPOVERLAPPED pol;

      mpm_recycle_completion_context(context);
Index: server/mpm/winnt/mpm_winnt.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
retrieving revision 1.311
diff -U3 -r1.311 mpm_winnt.c
--- server/mpm/winnt/mpm_winnt.c	24 Apr 2004 11:23:14 -0000	1.311
+++ server/mpm/winnt/mpm_winnt.c	17 Aug 2004 21:02:49 -0000
@@ -416,7 +416,7 @@
      HANDLE hDup;
      HANDLE os_start;
      HANDLE hScore;
-    DWORD BytesWritten;
+    apr_size_t BytesWritten;

      if (!DuplicateHandle(hCurrentProcess, child_ready_event, hProcess, &hDup,
          EVENT_MODIFY_STATE | SYNCHRONIZE, FALSE, 0)) {
@@ -566,14 +566,14 @@
      int lcnt = 0;
      ap_listen_rec *lr;
      LPWSAPROTOCOL_INFO  lpWSAProtocolInfo;
-    DWORD BytesWritten;
+    apr_size_t BytesWritten;

      /* Run the chain of open sockets. For each socket, duplicate it
       * for the target process then send the WSAPROTOCOL_INFO
       * (returned by dup socket) to the child.
       */
      for (lr = ap_listeners; lr; lr = lr->next, ++lcnt) {
-        int nsd;
+        apr_os_sock_t nsd;
          lpWSAProtocolInfo = apr_pcalloc(p, sizeof(WSAPROTOCOL_INFO));
          apr_os_sock_get(&nsd,lr->sd);
          ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, ap_server_conf,





Re: Windows 2003 IA64 builds?

Posted by Allan Edwards <ak...@us.ibm.com>.
Joe Orton wrote:
> w.r.t. common code, depends what the changes are; if there are places
> where an int is used to store the difference between pointers, it's
> probably a good and safe change to make that an apr_ssize_t instead.

Yes, there are a few of those, they are the easy ones to fix :)

> w.r.t. warnings: yes, gcc is just less picky.  But Win64 has a 32-bit
> long, right?  

That's correct, but that actually contributes to a fairly low % of warnings

>>+                rv = collapse_iovec((char**) &ptfb->Tail, (apr_size_t 
>>*)&ptfb->TailLength,
> 
> if that's casting (int *) to (size_t *) that looks dangerous.

Will take another look at that. I'm offline for the next 3 days but hope to
pick it up again next Monday.

Thanks
Allan


Re: Windows 2003 IA64 builds?

Posted by Joe Orton <jo...@redhat.com>.
On Tue, Aug 17, 2004 at 06:29:34PM -0400, Allan Edwards wrote:
> I'm wondering why gcc doesn't do the same since
> int=4 ptr=8 bytes for both platforms, is gcc just not
> as strict? And how to proceed, do we start fixing
> these warnings for Win64 even though they may not
> represent real life concerns in order to achieve a
> warning free /W3 compile for Win 64?

w.r.t. common code, depends what the changes are; if there are places
where an int is used to store the difference between pointers, it's
probably a good and safe change to make that an apr_ssize_t instead.

w.r.t. warnings: yes, gcc is just less picky.  But Win64 has a 32-bit
long, right?  So there is a significant difference between Win64 and
64-bit Unix platforms which are all (AFAIK) LP64.

> -                rv = collapse_iovec((char**) &ptfb->Tail, 
> &ptfb->TailLength,
> +                rv = collapse_iovec((char**) &ptfb->Tail, (apr_size_t 
> *)&ptfb->TailLength,

if that's casting (int *) to (size_t *) that looks dangerous.

joe

Re: Windows 2003 IA64 builds?

Posted by Allan Edwards <ak...@us.ibm.com>.
Here's a snapshot of work in progress. This patch
is against HEAD but I'm actually developing on the
0.9 branch and with Visual Studio 6 + IA64 SDK
cross compile.

As I mentioned in my previous note there are a lot
of warnings thrown when compiling 64 bit and this
just hits the low lying fruit for /W2 compile and
eliminates a couple of obvious bugs.

What is a little puzzling is that most of the
remaining  warnings are in common code, but it
appears that a Linux IA64 build is pretty clean
even with -Wall.

eg. even backing off to /W2 the Win 64 compile throws
__int64 to int mismatch warnings for pointer arithmetic
char *p1, *p2;
int diff = p2 -p1;

also lots of size_t mismatch warnings show up with /W3.

I'm wondering why gcc doesn't do the same since
int=4 ptr=8 bytes for both platforms, is gcc just not
as strict? And how to proceed, do we start fixing
these warnings for Win64 even though they may not
represent real life concerns in order to achieve a
warning free /W3 compile for Win 64?

Allan
-----------------------------------------------------

Index: apr/file_io/win32/open.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/open.c,v
retrieving revision 1.121
diff -u -3 -r1.121 open.c
--- apr/file_io/win32/open.c	13 Feb 2004 09:38:27 -0000	1.121
+++ apr/file_io/win32/open.c	17 Aug 2004 20:59:19 -0000
@@ -47,7 +47,7 @@
       * Note that the \\?\ form only works for local drive paths, and
       * \\?\UNC\ is needed UNC paths.
       */
-    int srcremains = strlen(srcstr) + 1;
+    apr_size_t srcremains = strlen(srcstr) + 1;
      apr_wchar_t *t = retstr;
      apr_status_t rv;

@@ -101,7 +101,7 @@
       * then transform \\'s back into /'s since the \\?\ form never
       * allows '/' path seperators, and APR always uses '/'s.
       */
-    int srcremains = wcslen(srcstr) + 1;
+    apr_size_t srcremains = wcslen(srcstr) + 1;
      apr_status_t rv;
      char *t = retstr;
      if (srcstr[0] == L'\\' && srcstr[1] == L'\\' &&
Index: apr/file_io/win32/readwrite.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/readwrite.c,v
retrieving revision 1.80
diff -u -3 -r1.80 readwrite.c
--- apr/file_io/win32/readwrite.c	13 Feb 2004 09:38:27 -0000	1.80
+++ apr/file_io/win32/readwrite.c	17 Aug 2004 20:59:19 -0000
@@ -27,8 +27,9 @@
   * read_with_timeout()
   * Uses async i/o to emulate unix non-blocking i/o with timeouts.
   */
-static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t len, apr_size_t *nbytes)
+static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t len_in, apr_size_t *nbytes)
  {
+    DWORD len = (DWORD)len_in;
      apr_status_t rv;
      *nbytes = 0;

@@ -68,7 +69,7 @@
          file->pOverlapped->OffsetHigh = (DWORD)(file->filePtr >> 32);
      }

-    rv = ReadFile(file->filehand, buf, len, nbytes, file->pOverlapped);
+    rv = ReadFile(file->filehand, buf, len, (LPDWORD)nbytes, file->pOverlapped);

      if (!rv) {
          rv = apr_get_os_error();
@@ -85,7 +86,7 @@
              switch (rv) {
              case WAIT_OBJECT_0:
                  GetOverlappedResult(file->filehand, file->pOverlapped,
-                                    nbytes, TRUE);
+                                    (LPDWORD)nbytes, TRUE);
                  rv = APR_SUCCESS;
                  break;
              case WAIT_TIMEOUT:
@@ -309,7 +310,7 @@
                  rv = WaitForSingleObject(thefile->pOverlapped->hEvent, INFINITE);
                  switch (rv) {
                      case WAIT_OBJECT_0:
-                        GetOverlappedResult(thefile->filehand, thefile->pOverlapped, nbytes, TRUE);
+                        GetOverlappedResult(thefile->filehand, thefile->pOverlapped, (LPDWORD)nbytes, TRUE);
                          rv = APR_SUCCESS;
                          break;
                      case WAIT_TIMEOUT:
@@ -343,7 +344,7 @@
  {
      apr_status_t rv = APR_SUCCESS;
      apr_size_t i;
-    DWORD bwrote = 0;
+    size_t bwrote = 0;
      char *buf;

      *nbytes = 0;
@@ -361,7 +362,7 @@

  APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile)
  {
-    DWORD len = 1;
+    apr_size_t len = 1;

      return apr_file_write(thefile, &ch, &len);
  }
@@ -375,7 +376,7 @@
  APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile)
  {
      apr_status_t rc;
-    int bread;
+    apr_size_t bread;

      bread = 1;
      rc = apr_file_read(thefile, ch, &bread);
@@ -393,7 +394,7 @@

  APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile)
  {
-    DWORD len = strlen(str);
+    apr_size_t len = strlen(str);

      return apr_file_write(thefile, str, &len);
  }
Index: apr/network_io/win32/sendrecv.c
===================================================================
RCS file: /home/cvs/apr/network_io/win32/sendrecv.c,v
retrieving revision 1.67
diff -u -3 -r1.67 sendrecv.c
--- apr/network_io/win32/sendrecv.c	22 Jul 2004 01:48:34 -0000	1.67
+++ apr/network_io/win32/sendrecv.c	17 Aug 2004 20:59:19 -0000
@@ -228,7 +228,7 @@
      apr_ssize_t rv;
      apr_off_t curoff = *offset;
      DWORD dwFlags = 0;
-    DWORD nbytes;
+    apr_size_t nbytes;
      TRANSMIT_FILE_BUFFERS tfb, *ptfb = NULL;
      int ptr = 0;
      int bytes_to_send;   /* Bytes to send out of the file (not including headers) */
@@ -269,7 +269,7 @@
      if (hdtr && hdtr->numheaders) {
          ptfb = &tfb;
          nbytes = 0;
-        rv = collapse_iovec((char **)&ptfb->Head, &ptfb->HeadLength,
+        rv = collapse_iovec((char **)&ptfb->Head, (apr_size_t *)&ptfb->HeadLength,
                              hdtr->headers, hdtr->numheaders,
                              hdtrbuf, sizeof(hdtrbuf));
          /* If not enough buffer, punt to sendv */
@@ -298,7 +298,7 @@
              /* Collapse the trailers into a single buffer */
              if (hdtr && hdtr->numtrailers) {
                  ptfb = &tfb;
-                rv = collapse_iovec((char**) &ptfb->Tail, &ptfb->TailLength,
+                rv = collapse_iovec((char**) &ptfb->Tail, (apr_size_t *)&ptfb->TailLength,
                                      hdtr->trailers, hdtr->numtrailers,
                                      hdtrbuf + ptfb->HeadLength,
                                      sizeof(hdtrbuf) - ptfb->HeadLength);
@@ -341,7 +341,7 @@
                      if (!disconnected) {
                          if (!WSAGetOverlappedResult(sock->socketdes,
                                                      sock->overlapped,
-                                                    &nbytes,
+                                                    (LPDWORD)&nbytes,
                                                      FALSE,
                                                      &dwFlags)) {
                              status = apr_get_netos_error();