From patchwork Tue Sep 22 19:53:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alin Serdean X-Patchwork-Id: 521400 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id E40E11401AD for ; Wed, 23 Sep 2015 05:56:08 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 3E707109A4; Tue, 22 Sep 2015 12:56:08 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 36BFB109A3 for ; Tue, 22 Sep 2015 12:56:07 -0700 (PDT) Received: from bar2.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id ADECF1E0382 for ; Tue, 22 Sep 2015 13:56:06 -0600 (MDT) X-ASG-Debug-ID: 1442951765-03dc537fe14a45e0001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar2.cudamail.com with ESMTP id THTaoAD3j7kvhyob (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 22 Sep 2015 13:56:05 -0600 (MDT) X-Barracuda-Envelope-From: aserdean@cloudbasesolutions.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO cbssmtp1.cloudbase.local) (91.232.152.5) by mx1-pf2.cudamail.com with SMTP; 22 Sep 2015 19:56:05 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at cloudbasesolutions.com designates 91.232.152.5 as permitted sender) X-Barracuda-Apparent-Source-IP: 91.232.152.5 X-Barracuda-RBL-IP: 91.232.152.5 Received: from localhost (localhost [127.0.0.1]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 2A430425F9 for ; Tue, 22 Sep 2015 22:56:03 +0300 (EEST) X-Virus-Scanned: amavisd-new at cloudbasesolutions.com Received: from cbssmtp1.cloudbase.local ([127.0.0.1]) by localhost (cbssmtp1.cloudbase.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pgsEqnxtU5GS for ; Tue, 22 Sep 2015 22:55:42 +0300 (EEST) Received: from CBSEX1.cloudbase.local (unknown [10.77.78.3]) by cbssmtp1.cloudbase.local (Postfix) with ESMTP id 4029F42285 for ; Tue, 22 Sep 2015 22:53:33 +0300 (EEST) Received: from CBSEX1.cloudbase.local ([10.77.78.3]) by CBSEX1.cloudbase.local ([10.77.78.3]) with mapi id 14.03.0224.002; Tue, 22 Sep 2015 21:53:33 +0200 X-CudaMail-Envelope-Sender: aserdean@cloudbasesolutions.com From: Alin Serdean To: "dev@openvswitch.org" X-CudaMail-MID: CM-E2-921083210 X-CudaMail-DTE: 092215 X-CudaMail-Originating-IP: 91.232.152.5 Thread-Topic: [PATCH 7/7] Add build system for compiling under MSVC x64 X-ASG-Orig-Subj: [##CM-E2-921083210##][PATCH 7/7] Add build system for compiling under MSVC x64 Thread-Index: AQHQ9XBc/lcuS0l+zUKXPDMWqT14QA== Date: Tue, 22 Sep 2015 19:53:32 +0000 Message-ID: <1442951618-13080-8-git-send-email-aserdean@cloudbasesolutions.com> References: <1442951618-13080-1-git-send-email-aserdean@cloudbasesolutions.com> In-Reply-To: <1442951618-13080-1-git-send-email-aserdean@cloudbasesolutions.com> Accept-Language: en-US, it-IT Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.77.78.1] MIME-Version: 1.0 X-GBUdb-Analysis: 0, 91.232.152.5, Ugly c=0.291963 p=-0.529412 Source Normal X-MessageSniffer-Rules: 0-0-0-13084-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1442951765 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_RULE7568M, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.22796 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS Subject: [ovs-dev] [PATCH 7/7] Add build system for compiling under MSVC x64 X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" This patch adds the modifications needed to compile under x64 under Windows: - created a new macro for testing if we are compiling under x64. this will define the linker flag: "/MACHINE:X64" as per documentation (https://msdn.microsoft.com/en-us/library/9yb4317s.aspx). - added x64 pthread libraries under the pthread defines - add documentation on how to build under x64 Signed-off-by: Alin Gabriel Serdean --- INSTALL.Windows.md | 13 +++++++++++-- Makefile.am | 1 + configure.ac | 1 + m4/openvswitch.m4 | 33 +++++++++++++++++++++++++++++++-- windows/automake.mk | 2 +- 5 files changed, 45 insertions(+), 5 deletions(-) diff --git a/INSTALL.Windows.md b/INSTALL.Windows.md index 889bb0b..a9ceb57 100644 --- a/INSTALL.Windows.md +++ b/INSTALL.Windows.md @@ -34,10 +34,19 @@ will also need to install Windows Driver Kit (WDK) 8.1 Update. It is important to get the Visual Studio related environment variables and to have the $PATH inside the bash to point to the proper compiler and linker. One -easy way to achieve this is to get into the "Developer Command prompt for visual -studio" and through it enter into the bash shell available from msys by typing +easy way to achieve this is to get into the "VS2013 x86 Native Tools Command +Prompt"(in a default installation of Visual Studio this can be found under the +following location: +C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts) +and through it enter into the bash shell available from msys by typing 'bash --login'. +We also support compiling on 64 bit. To compile everything under x64 open the +"VS2013 x64 Native Tools Command Prompt"(if your current running OS is 64 bit) +or "VS2013 x64 Cross Tools Command Prompt"(if your current running OS is 64 +bit) instead of opening its x86 variant. This will point the compiler and the +linker to their 64 bit equivalent. + If after the above step, a 'which link' inside MSYS's bash says, "/bin/link.exe", rename /bin/link.exe to something else so that the Visual studio's linker is used. You should also see a 'which sort' report diff --git a/Makefile.am b/Makefile.am index a659814..ab1a135 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,7 @@ AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include AM_CPPFLAGS += $(PTHREAD_INCLUDES) AM_CPPFLAGS += $(MSVC_CFLAGS) AM_LDFLAGS += $(PTHREAD_LDFLAGS) +AM_LDFLAGS += $(MSVC64_LDFLAGS) endif AM_CPPFLAGS += -I $(top_srcdir)/include diff --git a/configure.ac b/configure.ac index 36387a1..fd04929 100644 --- a/configure.ac +++ b/configure.ac @@ -85,6 +85,7 @@ AC_SEARCH_LIBS([pthread_create], [pthread]) AC_FUNC_STRERROR_R OVS_CHECK_ESX +OVS_CHECK_WIN64 OVS_CHECK_WIN32 OVS_CHECK_VISUAL_STUDIO_DDK OVS_CHECK_COVERAGE diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4 index 087c7e5..98e5ce9 100644 --- a/m4/openvswitch.m4 +++ b/m4/openvswitch.m4 @@ -70,6 +70,22 @@ AC_DEFUN([OVS_CHECK_ESX], AC_DEFINE([ESX], [1], [Define to 1 if building on ESX.]) fi]) +dnl Checks for MSVC x64 compiler. +AC_DEFUN([OVS_CHECK_WIN64], + [AC_CACHE_CHECK( + [for MSVC x64 compiler], + [cl_cv_x64], + [dnl "cl" writes x64 output to stdin: + if (cl) 2>&1 | grep 'x64' >/dev/null 2>&1; then + cl_cv_x64=yes + MSVC64_LDFLAGS=" /MACHINE:X64 " + else + cl_cv_x64=no + MSVC64_LDFLAGS="" + fi]) + AC_SUBST([MSVC64_LDFLAGS]) +]) + dnl Checks for WINDOWS. AC_DEFUN([OVS_CHECK_WIN32], [AC_CHECK_HEADER([windows.h], @@ -86,11 +102,24 @@ AC_DEFUN([OVS_CHECK_WIN32], AC_MSG_ERROR([Invalid --with-pthread value]) ;; *) - PTHREAD_WIN32_DIR=$withval/lib/x86 - PTHREAD_WIN32_DIR_DLL=/${withval/:/}/dll/x86 + if (cl) 2>&1 | grep 'x64' >/dev/null 2>&1; then + cl_cv_x64=yes + else + cl_cv_x64=no + fi + if test "$cl_cv_x64" = yes; then + PTHREAD_WIN32_DIR=$withval/lib/x64 + PTHREAD_WIN32_DIR_DLL=/${withval/:/}/dll/x64 + PTHREAD_WIN32_DIR_DLL_WIN_FORM=$withval/dll/x64 + else + PTHREAD_WIN32_DIR=$withval/lib/x86 + PTHREAD_WIN32_DIR_DLL=/${withval/:/}/dll/x86 + PTHREAD_WIN32_DIR_DLL_WIN_FORM=$withval/dll/x86 + fi PTHREAD_INCLUDES=-I$withval/include PTHREAD_LDFLAGS=-L$PTHREAD_WIN32_DIR PTHREAD_LIBS="-lpthreadVC2" + AC_SUBST([PTHREAD_WIN32_DIR_DLL_WIN_FORM]) AC_SUBST([PTHREAD_WIN32_DIR_DLL]) AC_SUBST([PTHREAD_INCLUDES]) AC_SUBST([PTHREAD_LDFLAGS]) diff --git a/windows/automake.mk b/windows/automake.mk index c8165a4..fa610ec 100644 --- a/windows/automake.mk +++ b/windows/automake.mk @@ -26,7 +26,7 @@ windows_installer: all cp -f $(top_srcdir)/ovsdb/ovsdb-client.pdb windows/ovs-windows-installer/Symbols/ cp -f $(top_srcdir)/ovsdb/ovsdb-tool.pdb windows/ovs-windows-installer/Symbols/ #Third party files needed by the installer - cp -f $(PTHREAD_TEMP_DIR)/../../dll/x86/*.dll windows/ovs-windows-installer/Binaries/ + cp -f $(PTHREAD_WIN32_DIR_DLL_WIN_FORM)/*.dll windows/ovs-windows-installer/Binaries/ cp -f "/c/Program Files (x86)/Common Files/Merge Modules/Microsoft_VC120_CRT_x86.msm" windows/ovs-windows-installer/Redist/Microsoft_VC120_CRT_x86.msm #Forwarding extension files needed for the installer cp -f $(top_srcdir)/datapath-windows/x64/Win8$(VSTUDIO_CONFIG)/package/ovsext.cat windows/ovs-windows-installer/Driver/Win8/ovsext.cat