From 4149775eee8fa026344322dfaa59ba340e2340cf Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sun, 22 Feb 2015 21:14:29 -0800 Subject: [PATCH 1/5] forward port vs2014/c++11 fixes from v0.11.14-nodecpp11 branch --- common.gypi | 12 ++++++++---- configure | 4 ++-- deps/cares/common.gypi | 8 ++++---- deps/http_parser/http_parser.gyp | 4 ++-- deps/openssl/openssl/e_os.h | 4 ++-- deps/uv/common.gypi | 8 ++++---- deps/uv/src/win/fs.c | 4 ++-- deps/v8/build/toolchain.gypi | 16 ++++++++-------- deps/zlib/zconf.h | 3 +++ src/node.cc | 2 +- vcbuild.bat | 15 +++++++++++++-- 11 files changed, 49 insertions(+), 31 deletions(-) diff --git a/common.gypi b/common.gypi index 8886b743927d..e9271bf89d93 100644 --- a/common.gypi +++ b/common.gypi @@ -50,7 +50,7 @@ ], 'msvs_settings': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 1, # static debug + 'RuntimeLibrary': 3, # MDd 'Optimization': 0, # /Od, no optimization 'MinimalRebuild': 'false', 'OmitFramePointers': 'false', @@ -89,7 +89,7 @@ ], 'msvs_settings': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 0, # static release + 'RuntimeLibrary': 2, # MD 'Optimization': 3, # /Ox, full optimization 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible @@ -173,7 +173,7 @@ }], [ 'OS in "linux freebsd openbsd solaris android"', { 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], - 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ], + 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=c++11' ], 'ldflags': [ '-rdynamic' ], 'target_conditions': [ ['_type=="static_library"', { @@ -204,6 +204,10 @@ ['OS=="mac"', { 'defines': ['_DARWIN_USE_64_BIT_INODE=1'], 'xcode_settings': { + 'CLANG_CXX_LIBRARY': 'libc++', + 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', + 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', + 'GCC_OPTIMIZATION_LEVEL': '3', 'ALWAYS_SEARCH_USER_PATHS': 'NO', 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic @@ -213,7 +217,7 @@ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics 'PREBINDING': 'NO', # No -Wl,-prebind - 'MACOSX_DEPLOYMENT_TARGET': '10.5', # -mmacosx-version-min=10.5 + 'MACOSX_DEPLOYMENT_TARGET': '10.9', # -mmacosx-version-min=10.9 'USE_HEADERMAP': 'NO', 'OTHER_CFLAGS': [ '-fno-strict-aliasing', diff --git a/configure b/configure index 66cb312ddb86..626c6db24459 100755 --- a/configure +++ b/configure @@ -711,7 +711,7 @@ def configure_winsdk(o): winsdk_dir = os.environ.get('WindowsSdkDir') - if winsdk_dir and os.path.isfile(winsdk_dir + '\\bin\\ctrpp.exe'): + if winsdk_dir and os.path.isfile(winsdk_dir + '\\bin\\x64\\ctrpp.exe'): print('Found ctrpp in WinSDK--will build generated files ' 'into tools/msvs/genfiles.') o['variables']['node_has_winsdk'] = 'true' @@ -1035,7 +1035,7 @@ if options.use_ninja: elif options.use_xcode: gyp_args += ['-f', 'xcode'] elif flavor == 'win': - gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto'] + gyp_args += ['-f', 'msvs', '-G', 'msvs_version=2013'] else: gyp_args += ['-f', 'make-' + flavor] diff --git a/deps/cares/common.gypi b/deps/cares/common.gypi index 8c10d5b06d3c..522dc55f7054 100644 --- a/deps/cares/common.gypi +++ b/deps/cares/common.gypi @@ -18,9 +18,9 @@ 'VCCLCompilerTool': { 'target_conditions': [ ['library=="static_library"', { - 'RuntimeLibrary': 1 # static debug + 'RuntimeLibrary': 3 # MDd }, { - 'RuntimeLibrary': 3 # DLL debug + 'RuntimeLibrary': 3 # MDd }] ], 'Optimization': 0, # /Od, no optimization @@ -49,9 +49,9 @@ 'VCCLCompilerTool': { 'target_conditions': [ ['library=="static_library"', { - 'RuntimeLibrary': 0, # static release + 'RuntimeLibrary': 2 # MD }, { - 'RuntimeLibrary': 2, # debug release + 'RuntimeLibrary': 2 # MD }], ], 'Optimization': 3, # /Ox, full optimization diff --git a/deps/http_parser/http_parser.gyp b/deps/http_parser/http_parser.gyp index ef34ecaeaeab..da30ee634f7d 100644 --- a/deps/http_parser/http_parser.gyp +++ b/deps/http_parser/http_parser.gyp @@ -15,7 +15,7 @@ 'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ], 'msvs_settings': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 1, # static debug + 'RuntimeLibrary': 3 # MDd }, }, }, @@ -24,7 +24,7 @@ 'cflags': [ '-Wall', '-Wextra', '-O3' ], 'msvs_settings': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 0, # static release + 'RuntimeLibrary': 2 # MD }, }, } diff --git a/deps/openssl/openssl/e_os.h b/deps/openssl/openssl/e_os.h index 4df285b5b5a0..99d9f44c0280 100644 --- a/deps/openssl/openssl/e_os.h +++ b/deps/openssl/openssl/e_os.h @@ -307,7 +307,7 @@ static __inline unsigned int _strlen31(const char *str) # undef isxdigit # endif # if defined(_MSC_VER) && !defined(_DLL) && defined(stdin) -# if _MSC_VER>=1300 +# if _MSC_VER>=1300 && _MSC_VER<1900 # undef stdin # undef stdout # undef stderr @@ -315,7 +315,7 @@ static __inline unsigned int _strlen31(const char *str) # define stdin (&__iob_func()[0]) # define stdout (&__iob_func()[1]) # define stderr (&__iob_func()[2]) -# elif defined(I_CAN_LIVE_WITH_LNK4049) +# elif _MSC_VER<1900 && defined(I_CAN_LIVE_WITH_LNK4049) # undef stdin # undef stdout # undef stderr diff --git a/deps/uv/common.gypi b/deps/uv/common.gypi index a8e2ef44c613..11a86344d775 100644 --- a/deps/uv/common.gypi +++ b/deps/uv/common.gypi @@ -20,9 +20,9 @@ 'VCCLCompilerTool': { 'target_conditions': [ ['uv_library=="static_library"', { - 'RuntimeLibrary': 1, # static debug + 'RuntimeLibrary': 3 # MDd }, { - 'RuntimeLibrary': 3, # DLL debug + 'RuntimeLibrary': 3 # MDd }], ], 'Optimization': 0, # /Od, no optimization @@ -57,9 +57,9 @@ 'VCCLCompilerTool': { 'target_conditions': [ ['uv_library=="static_library"', { - 'RuntimeLibrary': 0, # static release + 'RuntimeLibrary': 2 # MD }, { - 'RuntimeLibrary': 2, # debug release + 'RuntimeLibrary': 2 # MD }], ], 'Optimization': 3, # /Ox, full optimization diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index 30a457a023b4..4dad2e00acad 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -802,9 +802,9 @@ void fs__scandir(uv_fs_t* req) { if (len == 0) { fmt = L"./*"; } else if (pathw[len - 1] == L'/' || pathw[len - 1] == L'\\') { - fmt = L"%s*"; + fmt = L"%S*"; } else { - fmt = L"%s\\*"; + fmt = L"%S\\*"; } /* Figure out whether path is a file or a directory. */ diff --git a/deps/v8/build/toolchain.gypi b/deps/v8/build/toolchain.gypi index 1d47360d2a7a..ad87c374edba 100644 --- a/deps/v8/build/toolchain.gypi +++ b/deps/v8/build/toolchain.gypi @@ -554,9 +554,9 @@ 'Optimization': '0', 'conditions': [ ['component=="shared_library"', { - 'RuntimeLibrary': '3', # /MDd + 'RuntimeLibrary': 3 # MDd }, { - 'RuntimeLibrary': '1', # /MTd + 'RuntimeLibrary': 3 # MDd }], ], }, @@ -599,9 +599,9 @@ 'BasicRuntimeChecks': '0', 'conditions': [ ['component=="shared_library"', { - 'RuntimeLibrary': '3', # /MDd + 'RuntimeLibrary': 3 # MDd }, { - 'RuntimeLibrary': '1', # /MTd + 'RuntimeLibrary': 3 # MDd }], ], }, @@ -653,9 +653,9 @@ 'BasicRuntimeChecks': '0', 'conditions': [ ['component=="shared_library"', { - 'RuntimeLibrary': '3', #/MDd + 'RuntimeLibrary': 3 # MDd }, { - 'RuntimeLibrary': '1', #/MTd + 'RuntimeLibrary': 3 # MDd }], ['v8_target_arch=="x64"', { # TODO(2207): remove this option once the bug is fixed. @@ -826,9 +826,9 @@ 'StringPooling': 'true', 'conditions': [ ['component=="shared_library"', { - 'RuntimeLibrary': '2', #/MD + 'RuntimeLibrary': 2 # MD }, { - 'RuntimeLibrary': '0', #/MT + 'RuntimeLibrary': 2 # MD }], ['v8_target_arch=="x64"', { # TODO(2207): remove this option once the bug is fixed. diff --git a/deps/zlib/zconf.h b/deps/zlib/zconf.h index 9987a775530c..c61459d21a30 100644 --- a/deps/zlib/zconf.h +++ b/deps/zlib/zconf.h @@ -203,6 +203,9 @@ #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) # define STDC +# if _MSC_VER>=1900 +# define STDC99 +# endif #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) # define STDC diff --git a/src/node.cc b/src/node.cc index c8dfe041214f..f7044acc596d 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2293,7 +2293,7 @@ static void EnvSetter(Local property, WCHAR* key_ptr = reinterpret_cast(*key); // Environment variables that start with '=' are read-only. if (key_ptr[0] != L'=') { - SetEnvironmentVariableW(key_ptr, reinterpret_cast(*val)); + _wputenv_s(key_ptr, reinterpret_cast(*val)); } #endif // Whether it worked or not, always return rval. diff --git a/vcbuild.bat b/vcbuild.bat index c16217c7a9c2..a5b5dc6081a3 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -13,6 +13,7 @@ if /i "%1"=="/?" goto help @rem Process arguments. set config=Release +set platform=Win32 set msiplatform=x86 set target=Build set target_arch=ia32 @@ -94,6 +95,7 @@ if defined build_release ( if "%config%"=="Debug" set debug_arg=--debug if "%target_arch%"=="x64" set msiplatform=x64 +if "%target_arch%"=="x64" set platform=x64 if defined nosnapshot set nosnapshot_arg=--without-snapshot if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1 if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1 @@ -121,6 +123,15 @@ ENDLOCAL @rem Skip project generation if requested. if defined nobuild goto sign +@rem Look for Visual Studio 2014 +if not defined VS140COMNTOOLS goto vc-set-2013 +if not exist "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2013 +call "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" +if not defined VCINSTALLDIR goto msbuild-not-found +set GYP_MSVS_VERSION=2013 +goto msbuild-found + +:vc-set-2013 @rem Look for Visual Studio 2013 if not defined VS120COMNTOOLS goto vc-set-2012 if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2012 @@ -160,7 +171,7 @@ goto run :msbuild-found @rem Build the sln with msbuild. -msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo +msbuild node.sln /m:%NUMBER_OF_PROCESSORS% /p:BuildInParallel=true /toolsversion:14.0 /p:PlatformToolset=v140 /t:%target% /p:Configuration=%config% /p:Platform=%platform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 goto exit :sign @@ -227,7 +238,7 @@ if "%test%"=="test" goto jslint goto exit :create-msvs-files-failed -echo Failed to create vc project files. +echo Failed to create vc project files. goto exit :upload From 4813a8d15c85f1e15b9d2e0a8e81e91a79a857f9 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 23 Feb 2015 15:55:50 -0800 Subject: [PATCH 2/5] workaround compiler error with zone allocator copy - refs #6 --- deps/v8/src/compiler/graph-builder.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deps/v8/src/compiler/graph-builder.cc b/deps/v8/src/compiler/graph-builder.cc index 9c414f1bf9b1..ad9b9f37438f 100644 --- a/deps/v8/src/compiler/graph-builder.cc +++ b/deps/v8/src/compiler/graph-builder.cc @@ -13,6 +13,7 @@ #include "src/compiler/node-properties-inl.h" #include "src/compiler/operator-properties.h" #include "src/compiler/operator-properties-inl.h" +#include namespace v8 { namespace internal { @@ -113,11 +114,14 @@ void StructuredGraphBuilder::Environment::Merge(Environment* other) { // Resurrect a dead environment by copying the contents of the other one and // placing a singleton merge as the new control dependency. if (this->IsMarkedAsUnreachable()) { + std::clog << "WARNING: StructuredGraphBuilder::Environment::Merge partially disabled\n"; + /* Node* other_control = other->control_dependency_; control_dependency_ = graph()->NewNode(common()->Merge(1), other_control); effect_dependency_ = other->effect_dependency_; values_ = other->values_; return; + */ } // Create a merge of the control dependencies of both environments and update From dfb89fccb83959e34c12a0d7cd91504749c93564 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 23 Feb 2015 20:47:56 -0800 Subject: [PATCH 3/5] don't build with icu refs mapbox/node-cpp11#22 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6c148eb2cdaa..09ad18ee95d6 100644 --- a/Makefile +++ b/Makefile @@ -342,7 +342,7 @@ tar: $(TARBALL) $(BINARYTAR): release-only rm -rf $(BINARYNAME) rm -rf out/deps out/Release - $(PYTHON) ./configure --prefix=/ --download=all --with-intl=small-icu \ + $(PYTHON) ./configure --prefix=/ --download=all --with-intl=none \ --without-snapshot --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS) $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1 cp README.md $(BINARYNAME) From 040ffe761556a90b8f855005dc5bce33e4fddab9 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 12 May 2015 10:05:28 -0700 Subject: [PATCH 4/5] fix 32 vs 2015 compile - applies https://codereview.chromium.org/1084763002 - via https://code.google.com/p/chromium/issues/detail?id=440500 --- deps/v8/src/deoptimizer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deps/v8/src/deoptimizer.h b/deps/v8/src/deoptimizer.h index a0cc6975c3c9..30e03ace8c09 100644 --- a/deps/v8/src/deoptimizer.h +++ b/deps/v8/src/deoptimizer.h @@ -453,9 +453,12 @@ class FrameDescription { return malloc(size + frame_size - kPointerSize); } + // Bug in VS2015 RC, reported fixed in RTM. Microsoft bug: 1153909. + #if !defined(_MSC_FULL_VER) || _MSC_FULL_VER != 190022720 void operator delete(void* pointer, uint32_t frame_size) { free(pointer); } + #endif // _MSC_FULL_VER void operator delete(void* description) { free(description); From e184c9c9669f7b4da08847bcebea2882538fca4a Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Thu, 30 Jul 2015 14:30:18 +0000 Subject: [PATCH 5/5] undo fs.c patch --- deps/uv/src/win/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index 4dad2e00acad..7a1818c564c1 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -802,9 +802,9 @@ void fs__scandir(uv_fs_t* req) { if (len == 0) { fmt = L"./*"; } else if (pathw[len - 1] == L'/' || pathw[len - 1] == L'\\') { - fmt = L"%S*"; + fmt = L"%ls*"; } else { - fmt = L"%S\\*"; + fmt = L"%ls\\*"; } /* Figure out whether path is a file or a directory. */