edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] Windows MSVC140 build
@ 2017-01-27 19:02 Geoff McLane
  2017-01-27 19:21 ` Karl Dahlke
  0 siblings, 1 reply; 7+ messages in thread
From: Geoff McLane @ 2017-01-27 19:02 UTC (permalink / raw)
  To: Edbrowse-dev

Hi all,

This is all about building edbrowse in
Windows 10, in 32 and 64-bits...

Some time back I retired my trusty MSVC10 (2010),
downloaded MSVC14 (2015), and started to re-do
each project... first in 32-bits...

Unfortunately with edbrowse ran into a horrible
warning, that I can not seem able to solve -

  main.c
c:\program files (x86)\microsoft 
sdks\windows\v7.0a\include\sal_supp.h(57): warning C4005: '__useHeader': 
macro redefinition [F:\Projects\edbrowse-geoff\build\edbrowse.vcxproj]
   C:\Program Files (x86)\Microsoft Visual Studio 
14.0\VC\include\sal.h(2866): note: see previous definition of '__useHeader'
c:\program files (x86)\microsoft 
sdks\windows\v7.0a\include\specstrings_supp.h(77): warning C4005: 
'__on_failure': macro redefinition 
[F:\Projects\edbrowse-geoff\build\edbrowse.vcxproj]
   C:\Program Files (x86)\Microsoft Visual Studio 
14.0\VC\include\sal.h(2876): note: see previous definition of '__on_failure'

This is a horrific warning, since as you can see it
seems to be in 'system' header files - the MSVC14 include
sal.h is incompatible with the microsoft sdks header
sal_supp.h and specstrings_supp.h... bah!

For now I have suppressed this warning 4005... but would
always strive to avoid that suppression... I have googled
around, and found it reported here and there, but none
provided a solution yet...

Does anyone have any ideas?

There are still some dozen other msvc140 warnings... which
I have left for now...

But the main thing is I had to provide a few small fixes
for some 'errors' that msvc140 exposed...

At the moment I have only done fixes in my
edbrowse-fork, while I test them further... and maybe
refine them before finally adding them to edbrowse...

The two main ones are in jseng-moz.cpp... in the function
readFromEb()

1. Why is 'ssize_t rc;' used, instead of just 'int rc;'?
Unfortunately `ssize_t` does not exist in WIN32. Alternatively
could provide a define or typedef... but why not an 'int'?
Maybe missing something here...

2. Why is '(short unsigned int *)uc_run' used instead
of '(const jschar *)uc_run'? Which seems to be what
the prototype of JS_EvaluateUCScript in jsapi.h...
Again, am I missing something?

The other important item is to define HAVE_STRUCT_TIMESPEC.
For now I have just defined it in eb.h, but this could
perhaps also be done in CMakeLists.txt...

As stated, I will continue to test, and refine, but
look forward to any further comments meantime...

For the 64-bit build I need to also re-do and
install libraries like mozjs-24.lib, and maybe others,
in 64-bit msvc140 form... quite a pain... but will
get there...

Are there any others out there who do a Windows
MSVC build?

Current full patch below...

Regards, Geoff.

<msvc140-32.diff>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index df70164..16b0f16 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,7 +36,8 @@ if(WIN32)
          # C4101: 'idx' : unreferenced local variable
          # C4018: '>' : signed/unsigned mismatch
          # C4800: 'JSBool' : forcing value to bool
-        foreach(warning 4244 4101 4090 4018 4800)
+        # C4005: '__useHeader': macro redefinition
+        foreach(warning 4244 4101 4090 4018 4800 4005)
              set(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}")
          endforeach()
          set( MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES 
-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS 
-D__CRT_NONSTDC_NO_WARNINGS" )
diff --git a/build/build-me.bat b/build/build-me.bat
index e5cc744..386f6a7 100644
--- a/build/build-me.bat
+++ b/build/build-me.bat
@@ -12,6 +12,12 @@
  @set TMPINS=..\..\software
  @set TMPCM=%TMPSRC%\CMakeLists.txt
  @set DOPAUSE=pause
+@set VCVERS=14
+@set GENERATOR=Visual Studio %VCVERS%
+
+pushd %TMPSRC%
+@set TMPSRC=%CD%
+popd

  @call chkmsvc %TMPPRJ%

@@ -22,7 +28,7 @@
  @if NOT EXIST %TMPCM% goto NOCM

  @set TMPLOG=bldlog-1.txt
-@set TMPOPTS=-DCMAKE_INSTALL_PREFIX=%TMPINS%
+@set TMPOPTS=-G "%GENERATOR%" -DCMAKE_INSTALL_PREFIX=%TMPINS%

  @REM 20151031 - Add OSBC support in WIN32 build
  @set TMPOPTS=%TMPOPTS% -DBUILD_EDBR_ODBC:BOOL=ON
@@ -34,7 +40,7 @@
  @goto RPT
  :GOTCMD

-@echo Build %DATE% %TIME% > %TMPLOG%
+@echo Build %DATE% %TIME% in %CD% > %TMPLOG%
  @echo Build source %TMPSRC%... all output to build log %TMPLOG%
  @echo Build source %TMPSRC%... all output to build log %TMPLOG% >> 
%TMPLOG%

diff --git a/src/eb.h b/src/eb.h
index 8cdc3e7..78ec2f2 100644
--- a/src/eb.h
+++ b/src/eb.h
@@ -25,6 +25,12 @@
  #define _GNU_SOURCE
  #endif

+#ifndef HAVE_STRUCT_TIMESPEC
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+#define HAVE_STRUCT_TIMESPEC
+#endif
+#endif // HAVE_STRUCT_TIMESPEC
+
  /* seems like everybody needs these header files */
  #include <sys/types.h>
  #include <ctype.h>
diff --git a/src/jseng-moz.cpp b/src/jseng-moz.cpp
index bd276f5..5c411a3 100644
--- a/src/jseng-moz.cpp
+++ b/src/jseng-moz.cpp
@@ -194,7 +194,7 @@ int js_main(int argc, char **argv)

  static void readFromEb(void *data_p, int n)
  {
-    ssize_t rc;
+    int rc;
      unsigned char *bytes_p = (unsigned char *)data_p;
      if (n == 0)
          return;
@@ -2478,7 +2478,7 @@ static void processMessage(void)
          head.n = 0;
          head.proplength = 0;
          if (JS_EvaluateUCScript
-            (jcx, parent, (short unsigned int *)uc_run, uc_len / 2,
+            (jcx, parent, (const jschar *)uc_run, uc_len / 2,
               "foo", head.lineno, v.address())) {
              if (v != JSVAL_VOID) {
                  s = 0;
</msvc140-32.diff>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-28 16:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 19:02 [Edbrowse-dev] Windows MSVC140 build Geoff McLane
2017-01-27 19:21 ` Karl Dahlke
2017-01-27 19:43   ` Geoff McLane
2017-01-27 19:59     ` Karl Dahlke
2017-01-28  2:06       ` Geoff McLane
2017-01-28  2:36         ` Karl Dahlke
2017-01-28 16:53           ` Geoff McLane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).