public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools/Build: Fix Structured PCD app host env issues
@ 2020-01-30  2:37 Michael D Kinney
  2020-01-31  8:27 ` Liming Gao
  0 siblings, 1 reply; 6+ messages in thread
From: Michael D Kinney @ 2020-01-30  2:37 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Liming Gao

https://bugzilla.tianocore.org/show_bug.cgi?id=2495
https://bugzilla.tianocore.org/show_bug.cgi?id=2496

Structured PCD processing requires a host POSIX build
environment.  If the Structure PCD application can not
be built using the default environment under Windows, then
retry the build after setting up the host environment for
the current tool chain tag.

Also reduce the build dependencies for the Structured PCD
application to increase compiler compatibility.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../Source/Python/Workspace/DscBuildData.py   | 35 +++++++++++++++----
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index c65a0dd346..bc3f32bb1d 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -91,9 +91,6 @@ WindowsCFLAGS = 'CFLAGS = $(CFLAGS) /wd4200 /wd4034 /wd4101 '
 LinuxCFLAGS = 'BUILD_CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable '
 PcdMakefileEnd = '''
 !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common
-
-LIBS = $(LIB_PATH)\Common.lib
-
 !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
 '''
 
@@ -2637,10 +2634,10 @@ class DscBuildData(PlatformBuildClassObject):
 
         MakeApp = PcdMakefileHeader
         if sys.platform == "win32":
-            MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj\n' % (self.OutputPath, PcdValueInitName) + 'INC = '
+            MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + 'INC = '
         else:
             MakeApp = MakeApp + PcdGccMakefile
-            MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o\n' % (self.OutputPath, PcdValueInitName) + \
+            MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName, os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + \
                       'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
 
         IncSearchList = []
@@ -2723,8 +2720,8 @@ class DscBuildData(PlatformBuildClassObject):
                     IncludeFileFullPaths.append(os.path.normpath(includefullpath))
                     break
         SearchPathList = []
-        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gWorkspace, "BaseTools/Source/C/Include")))
-        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gWorkspace, "BaseTools/Source/C/Common")))
+        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "BaseTools/Source/C/Include")))
+        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "BaseTools/Source/C/Common")))
         SearchPathList.extend(str(item) for item in IncSearchList)
         IncFileList = GetDependencyList(IncludeFileFullPaths, SearchPathList)
         for include_file in IncFileList:
@@ -2743,9 +2740,33 @@ class DscBuildData(PlatformBuildClassObject):
         else:
             Dest_PcdValueInitExe = os.path.join(self.OutputPath, PcdValueInitName) +".exe"
         Messages = ''
+
+        VsDevCmd = {
+            "VS2019"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"',
+            "VS2017"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"',
+            "VS2015"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\VsDevCmd.bat"',
+            "VS2015x86": '"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\VsDevCmd.bat"',
+            "VS2013"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\VsDevCmd.bat"',
+            "VS2013x86": '"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\VsDevCmd.bat"',
+            "VS2012"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\Tools\\VsDevCmd.bat"',
+            "VS2012x86": '"C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\Tools\\VsDevCmd.bat"',
+            "VS2010"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat" x86',
+            "VS2010x86": '"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat" x86'
+        }
+
         if sys.platform == "win32":
             MakeCommand = 'nmake -f %s' % (MakeFileName)
             returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand)
+            if returncode != 0:
+                #
+                # If the nmake command failed, then lookup and run the VS
+                # Development Environment script for the current ToolChain and
+                # try the nmake command again.
+                #
+                if self._Toolchain in VsDevCmd:
+                    MakeCommand = VsDevCmd[self._Toolchain] + '&' + MakeCommand
+                    if os.path.exists (MakeCommand.split('"')[1]):
+                        returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand)
             Messages = StdOut
         else:
             MakeCommand = 'make -f %s' % (MakeFileName)
-- 
2.21.0.windows.1


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

* Re: [Patch] BaseTools/Build: Fix Structured PCD app host env issues
  2020-01-30  2:37 [Patch] BaseTools/Build: Fix Structured PCD app host env issues Michael D Kinney
@ 2020-01-31  8:27 ` Liming Gao
  2020-01-31 16:42   ` Michael D Kinney
  0 siblings, 1 reply; 6+ messages in thread
From: Liming Gao @ 2020-01-31  8:27 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io; +Cc: Feng, Bob C

Mike:
  I suggest to call BaseTools\set_vsprefix_envs.bat to setup VS environment. Its input parameter is VS2012, VS2013, VS2015, VS2017, VS2019. If so, we don't need to add VS installation path in Build python script. 

Thanks
Liming
> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Thursday, January 30, 2020 10:38 AM
> To: devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [Patch] BaseTools/Build: Fix Structured PCD app host env issues
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=2495
> https://bugzilla.tianocore.org/show_bug.cgi?id=2496
> 
> Structured PCD processing requires a host POSIX build
> environment.  If the Structure PCD application can not
> be built using the default environment under Windows, then
> retry the build after setting up the host environment for
> the current tool chain tag.
> 
> Also reduce the build dependencies for the Structured PCD
> application to increase compiler compatibility.
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../Source/Python/Workspace/DscBuildData.py   | 35 +++++++++++++++----
>  1 file changed, 28 insertions(+), 7 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
> index c65a0dd346..bc3f32bb1d 100644
> --- a/BaseTools/Source/Python/Workspace/DscBuildData.py
> +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
> @@ -91,9 +91,6 @@ WindowsCFLAGS = 'CFLAGS = $(CFLAGS) /wd4200 /wd4034 /wd4101 '
>  LinuxCFLAGS = 'BUILD_CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable '
>  PcdMakefileEnd = '''
>  !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common
> -
> -LIBS = $(LIB_PATH)\Common.lib
> -
>  !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
>  '''
> 
> @@ -2637,10 +2634,10 @@ class DscBuildData(PlatformBuildClassObject):
> 
>          MakeApp = PcdMakefileHeader
>          if sys.platform == "win32":
> -            MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' %
> (PcdValueInitName) + 'OBJECTS = %s\%s.obj\n' % (self.OutputPath, PcdValueInitName) + 'INC = '
> +            MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' %
> (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName,
> os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + 'INC = '
>          else:
>              MakeApp = MakeApp + PcdGccMakefile
> -            MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName)
> + 'OBJECTS = %s/%s.o\n' % (self.OutputPath, PcdValueInitName) + \
> +            MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' %
> (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName,
> os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + \
>                        'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
> 
>          IncSearchList = []
> @@ -2723,8 +2720,8 @@ class DscBuildData(PlatformBuildClassObject):
>                      IncludeFileFullPaths.append(os.path.normpath(includefullpath))
>                      break
>          SearchPathList = []
> -        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gWorkspace, "BaseTools/Source/C/Include")))
> -        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gWorkspace, "BaseTools/Source/C/Common")))
> +        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"],
> "BaseTools/Source/C/Include")))
> +        SearchPathList.append(os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"],
> "BaseTools/Source/C/Common")))
>          SearchPathList.extend(str(item) for item in IncSearchList)
>          IncFileList = GetDependencyList(IncludeFileFullPaths, SearchPathList)
>          for include_file in IncFileList:
> @@ -2743,9 +2740,33 @@ class DscBuildData(PlatformBuildClassObject):
>          else:
>              Dest_PcdValueInitExe = os.path.join(self.OutputPath, PcdValueInitName) +".exe"
>          Messages = ''
> +
> +        VsDevCmd = {
> +            "VS2019"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"',
> +            "VS2017"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"',
> +            "VS2015"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\VsDevCmd.bat"',
> +            "VS2015x86": '"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\VsDevCmd.bat"',
> +            "VS2013"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\VsDevCmd.bat"',
> +            "VS2013x86": '"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\VsDevCmd.bat"',
> +            "VS2012"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\Tools\\VsDevCmd.bat"',
> +            "VS2012x86": '"C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\Tools\\VsDevCmd.bat"',
> +            "VS2010"   : '"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat" x86',
> +            "VS2010x86": '"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat" x86'
> +        }
> +
>          if sys.platform == "win32":
>              MakeCommand = 'nmake -f %s' % (MakeFileName)
>              returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand)
> +            if returncode != 0:
> +                #
> +                # If the nmake command failed, then lookup and run the VS
> +                # Development Environment script for the current ToolChain and
> +                # try the nmake command again.
> +                #
> +                if self._Toolchain in VsDevCmd:
> +                    MakeCommand = VsDevCmd[self._Toolchain] + '&' + MakeCommand
> +                    if os.path.exists (MakeCommand.split('"')[1]):
> +                        returncode, StdOut, StdErr = DscBuildData.ExecuteCommand (MakeCommand)
>              Messages = StdOut
>          else:
>              MakeCommand = 'make -f %s' % (MakeFileName)
> --
> 2.21.0.windows.1


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

* Re: [Patch] BaseTools/Build: Fix Structured PCD app host env issues
  2020-01-31  8:27 ` Liming Gao
@ 2020-01-31 16:42   ` Michael D Kinney
  2020-02-01  0:33     ` [edk2-devel] " Sean
  2020-02-03  2:19     ` Liming Gao
  0 siblings, 2 replies; 6+ messages in thread
From: Michael D Kinney @ 2020-01-31 16:42 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io, Kinney, Michael D; +Cc: Feng, Bob C

Liming,

That script does not set everything up to build
host apps for all VS20xx tool chains.  It works
for VS2017, VS2019, but not any of the others.
It sets env vars for those other tool chains but
Does not run the VS environment setup script that 
updates PATH and sets LIBS and INC to support 
build of POSIX apps.

Mike

> -----Original Message-----
> From: Gao, Liming <liming.gao@intel.com>
> Sent: Friday, January 31, 2020 12:27 AM
> To: Kinney, Michael D <michael.d.kinney@intel.com>;
> devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch] BaseTools/Build: Fix Structured
> PCD app host env issues
> 
> Mike:
>   I suggest to call BaseTools\set_vsprefix_envs.bat to
> setup VS environment. Its input parameter is VS2012,
> VS2013, VS2015, VS2017, VS2019. If so, we don't need to
> add VS installation path in Build python script.
> 
> Thanks
> Liming
> > -----Original Message-----
> > From: Kinney, Michael D <michael.d.kinney@intel.com>
> > Sent: Thursday, January 30, 2020 10:38 AM
> > To: devel@edk2.groups.io
> > Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> > Subject: [Patch] BaseTools/Build: Fix Structured PCD
> app host env issues
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=2495
> > https://bugzilla.tianocore.org/show_bug.cgi?id=2496
> >
> > Structured PCD processing requires a host POSIX build
> > environment.  If the Structure PCD application can
> not
> > be built using the default environment under Windows,
> then
> > retry the build after setting up the host environment
> for
> > the current tool chain tag.
> >
> > Also reduce the build dependencies for the Structured
> PCD
> > application to increase compiler compatibility.
> >
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Signed-off-by: Michael D Kinney
> <michael.d.kinney@intel.com>
> > ---
> >  .../Source/Python/Workspace/DscBuildData.py   | 35
> +++++++++++++++----
> >  1 file changed, 28 insertions(+), 7 deletions(-)
> >
> > diff --git
> a/BaseTools/Source/Python/Workspace/DscBuildData.py
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > index c65a0dd346..bc3f32bb1d 100644
> > ---
> a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > +++
> b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > @@ -91,9 +91,6 @@ WindowsCFLAGS = 'CFLAGS = $(CFLAGS)
> /wd4200 /wd4034 /wd4101 '
> >  LinuxCFLAGS = 'BUILD_CFLAGS += -Wno-pointer-to-int-
> cast -Wno-unused-variable '
> >  PcdMakefileEnd = '''
> >  !INCLUDE
> $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common
> > -
> > -LIBS = $(LIB_PATH)\Common.lib
> > -
> >  !INCLUDE
> $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
> >  '''
> >
> > @@ -2637,10 +2634,10 @@ class
> DscBuildData(PlatformBuildClassObject):
> >
> >          MakeApp = PcdMakefileHeader
> >          if sys.platform == "win32":
> > -            MakeApp = MakeApp + 'APPFILE =
> %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) +
> 'APPNAME = %s\n' %
> > (PcdValueInitName) + 'OBJECTS = %s\%s.obj\n' %
> (self.OutputPath, PcdValueInitName) + 'INC = '
> > +            MakeApp = MakeApp + 'APPFILE =
> %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) +
> 'APPNAME = %s\n' %
> > (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' %
> (self.OutputPath, PcdValueInitName,
> >
> os.path.normpath(mws.join(GlobalData.gGlobalDefines["ED
> K_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) +
> 'INC = '
> >          else:
> >              MakeApp = MakeApp + PcdGccMakefile
> > -            MakeApp = MakeApp + 'APPFILE = %s/%s\n'
> % (self.OutputPath, PcdValueInitName) + 'APPNAME =
> %s\n' % (PcdValueInitName)
> > + 'OBJECTS = %s/%s.o\n' % (self.OutputPath,
> PcdValueInitName) + \
> > +            MakeApp = MakeApp + 'APPFILE = %s/%s\n'
> % (self.OutputPath, PcdValueInitName) + 'APPNAME =
> %s\n' %
> > (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' %
> (self.OutputPath, PcdValueInitName,
> >
> os.path.normpath(mws.join(GlobalData.gGlobalDefines["ED
> K_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + \
> >                        'include
> $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
> >
> >          IncSearchList = []
> > @@ -2723,8 +2720,8 @@ class
> DscBuildData(PlatformBuildClassObject):
> >
> IncludeFileFullPaths.append(os.path.normpath(includeful
> lpath))
> >                      break
> >          SearchPathList = []
> > -
> SearchPathList.append(os.path.normpath(mws.join(GlobalD
> ata.gWorkspace, "BaseTools/Source/C/Include")))
> > -
> SearchPathList.append(os.path.normpath(mws.join(GlobalD
> ata.gWorkspace, "BaseTools/Source/C/Common")))
> > +
> SearchPathList.append(os.path.normpath(mws.join(GlobalD
> ata.gGlobalDefines["EDK_TOOLS_PATH"],
> > "BaseTools/Source/C/Include")))
> > +
> SearchPathList.append(os.path.normpath(mws.join(GlobalD
> ata.gGlobalDefines["EDK_TOOLS_PATH"],
> > "BaseTools/Source/C/Common")))
> >          SearchPathList.extend(str(item) for item in
> IncSearchList)
> >          IncFileList =
> GetDependencyList(IncludeFileFullPaths, SearchPathList)
> >          for include_file in IncFileList:
> > @@ -2743,9 +2740,33 @@ class
> DscBuildData(PlatformBuildClassObject):
> >          else:
> >              Dest_PcdValueInitExe =
> os.path.join(self.OutputPath, PcdValueInitName) +".exe"
> >          Messages = ''
> > +
> > +        VsDevCmd = {
> > +            "VS2019"   : '"C:\\Program Files
> (x86)\\Microsoft Visual
> Studio\\2019\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"
> ',
> > +            "VS2017"   : '"C:\\Program Files
> (x86)\\Microsoft Visual
> Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"
> ',
> > +            "VS2015"   : '"C:\\Program Files
> (x86)\\Microsoft Visual Studio
> 14.0\\Common7\\Tools\\VsDevCmd.bat"',
> > +            "VS2015x86": '"C:\\Program Files
> (x86)\\Microsoft Visual Studio
> 14.0\\Common7\\Tools\\VsDevCmd.bat"',
> > +            "VS2013"   : '"C:\\Program Files
> (x86)\\Microsoft Visual Studio
> 12.0\\Common7\\Tools\\VsDevCmd.bat"',
> > +            "VS2013x86": '"C:\\Program Files
> (x86)\\Microsoft Visual Studio
> 12.0\\Common7\\Tools\\VsDevCmd.bat"',
> > +            "VS2012"   : '"C:\\Program Files
> (x86)\\Microsoft Visual Studio
> 11.0\\Common7\\Tools\\VsDevCmd.bat"',
> > +            "VS2012x86": '"C:\\Program Files
> (x86)\\Microsoft Visual Studio
> 11.0\\Common7\\Tools\\VsDevCmd.bat"',
> > +            "VS2010"   : '"C:\\Program Files
> (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat"
> x86',
> > +            "VS2010x86": '"C:\\Program Files
> (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat"
> x86'
> > +        }
> > +
> >          if sys.platform == "win32":
> >              MakeCommand = 'nmake -f %s' %
> (MakeFileName)
> >              returncode, StdOut, StdErr =
> DscBuildData.ExecuteCommand (MakeCommand)
> > +            if returncode != 0:
> > +                #
> > +                # If the nmake command failed, then
> lookup and run the VS
> > +                # Development Environment script for
> the current ToolChain and
> > +                # try the nmake command again.
> > +                #
> > +                if self._Toolchain in VsDevCmd:
> > +                    MakeCommand =
> VsDevCmd[self._Toolchain] + '&' + MakeCommand
> > +                    if os.path.exists
> (MakeCommand.split('"')[1]):
> > +                        returncode, StdOut, StdErr =
> DscBuildData.ExecuteCommand (MakeCommand)
> >              Messages = StdOut
> >          else:
> >              MakeCommand = 'make -f %s' %
> (MakeFileName)
> > --
> > 2.21.0.windows.1


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

* Re: [edk2-devel] [Patch] BaseTools/Build: Fix Structured PCD app host env issues
  2020-01-31 16:42   ` Michael D Kinney
@ 2020-02-01  0:33     ` Sean
  2020-02-01 16:49       ` Michael D Kinney
  2020-02-03  2:19     ` Liming Gao
  1 sibling, 1 reply; 6+ messages in thread
From: Sean @ 2020-02-01  0:33 UTC (permalink / raw)
  To: Michael D Kinney, devel

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

Mike,
The hardcoded vs paths are not a safe assumption.
I would rather see agreement of how the environment should be configured prior to calling edk2 build and if being capable of building host os specific binaries is the requirement then that should be clarified and the scripts can be updated.  That way this type of stuff is contained within environment specific scripts rather than the edk2 build system.

thanks
Sean

[-- Attachment #2: Type: text/html, Size: 473 bytes --]

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

* Re: [edk2-devel] [Patch] BaseTools/Build: Fix Structured PCD app host env issues
  2020-02-01  0:33     ` [edk2-devel] " Sean
@ 2020-02-01 16:49       ` Michael D Kinney
  0 siblings, 0 replies; 6+ messages in thread
From: Michael D Kinney @ 2020-02-01 16:49 UTC (permalink / raw)
  To: Sean, devel@edk2.groups.io, Kinney, Michael D

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

Sean,

I agree the hard coded paths are not good.  This was a quick workaround to see if I could get the Azure Pipeline agents to function.  It we continue this path, we would have to migrate those out to something like toolsdef.txt or other mechanism that is more flexible.

There is a fundamental assumption that all edk2 build environments support a host POSIX build.  It would be better to update Azure Pipelines config to meet this assumption, and I can abandon this patch with the hard coded paths.

Do you have a suggestion for a patch to the Azure Pipelines YAML files to setup the VS host env?

Thanks,

Mike

From: sean.brogan via [] <sean.brogan=microsoft.com@[]>
Sent: Friday, January 31, 2020 4:33 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io
Subject: Re: [edk2-devel] [Patch] BaseTools/Build: Fix Structured PCD app host env issues

Mike,
The hardcoded vs paths are not a safe assumption.
I would rather see agreement of how the environment should be configured prior to calling edk2 build and if being capable of building host os specific binaries is the requirement then that should be clarified and the scripts can be updated.  That way this type of stuff is contained within environment specific scripts rather than the edk2 build system.

thanks
Sean

[-- Attachment #2: Type: text/html, Size: 41296 bytes --]

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

* Re: [Patch] BaseTools/Build: Fix Structured PCD app host env issues
  2020-01-31 16:42   ` Michael D Kinney
  2020-02-01  0:33     ` [edk2-devel] " Sean
@ 2020-02-03  2:19     ` Liming Gao
  1 sibling, 0 replies; 6+ messages in thread
From: Liming Gao @ 2020-02-03  2:19 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io, Bi, Dandan
  Cc: Feng, Bob C, Gao, Liming

Mike:
  Sorry. This edk2\BaseTools\get_vsvars.bat can set VS host env. 

Thanks
Liming
> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Saturday, February 1, 2020 12:43 AM
> To: Gao, Liming <liming.gao@intel.com>; devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com>
> Cc: Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [Patch] BaseTools/Build: Fix Structured PCD app host env issues
> 
> Liming,
> 
> That script does not set everything up to build
> host apps for all VS20xx tool chains.  It works
> for VS2017, VS2019, but not any of the others.
> It sets env vars for those other tool chains but
> Does not run the VS environment setup script that
> updates PATH and sets LIBS and INC to support
> build of POSIX apps.
> 
> Mike
> 
> > -----Original Message-----
> > From: Gao, Liming <liming.gao@intel.com>
> > Sent: Friday, January 31, 2020 12:27 AM
> > To: Kinney, Michael D <michael.d.kinney@intel.com>;
> > devel@edk2.groups.io
> > Cc: Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [Patch] BaseTools/Build: Fix Structured
> > PCD app host env issues
> >
> > Mike:
> >   I suggest to call BaseTools\set_vsprefix_envs.bat to
> > setup VS environment. Its input parameter is VS2012,
> > VS2013, VS2015, VS2017, VS2019. If so, we don't need to
> > add VS installation path in Build python script.
> >
> > Thanks
> > Liming
> > > -----Original Message-----
> > > From: Kinney, Michael D <michael.d.kinney@intel.com>
> > > Sent: Thursday, January 30, 2020 10:38 AM
> > > To: devel@edk2.groups.io
> > > Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming
> > <liming.gao@intel.com>
> > > Subject: [Patch] BaseTools/Build: Fix Structured PCD
> > app host env issues
> > >
> > > https://bugzilla.tianocore.org/show_bug.cgi?id=2495
> > > https://bugzilla.tianocore.org/show_bug.cgi?id=2496
> > >
> > > Structured PCD processing requires a host POSIX build
> > > environment.  If the Structure PCD application can
> > not
> > > be built using the default environment under Windows,
> > then
> > > retry the build after setting up the host environment
> > for
> > > the current tool chain tag.
> > >
> > > Also reduce the build dependencies for the Structured
> > PCD
> > > application to increase compiler compatibility.
> > >
> > > Cc: Bob Feng <bob.c.feng@intel.com>
> > > Cc: Liming Gao <liming.gao@intel.com>
> > > Signed-off-by: Michael D Kinney
> > <michael.d.kinney@intel.com>
> > > ---
> > >  .../Source/Python/Workspace/DscBuildData.py   | 35
> > +++++++++++++++----
> > >  1 file changed, 28 insertions(+), 7 deletions(-)
> > >
> > > diff --git
> > a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > index c65a0dd346..bc3f32bb1d 100644
> > > ---
> > a/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > +++
> > b/BaseTools/Source/Python/Workspace/DscBuildData.py
> > > @@ -91,9 +91,6 @@ WindowsCFLAGS = 'CFLAGS = $(CFLAGS)
> > /wd4200 /wd4034 /wd4101 '
> > >  LinuxCFLAGS = 'BUILD_CFLAGS += -Wno-pointer-to-int-
> > cast -Wno-unused-variable '
> > >  PcdMakefileEnd = '''
> > >  !INCLUDE
> > $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common
> > > -
> > > -LIBS = $(LIB_PATH)\Common.lib
> > > -
> > >  !INCLUDE
> > $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
> > >  '''
> > >
> > > @@ -2637,10 +2634,10 @@ class
> > DscBuildData(PlatformBuildClassObject):
> > >
> > >          MakeApp = PcdMakefileHeader
> > >          if sys.platform == "win32":
> > > -            MakeApp = MakeApp + 'APPFILE =
> > %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) +
> > 'APPNAME = %s\n' %
> > > (PcdValueInitName) + 'OBJECTS = %s\%s.obj\n' %
> > (self.OutputPath, PcdValueInitName) + 'INC = '
> > > +            MakeApp = MakeApp + 'APPFILE =
> > %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) +
> > 'APPNAME = %s\n' %
> > > (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' %
> > (self.OutputPath, PcdValueInitName,
> > >
> > os.path.normpath(mws.join(GlobalData.gGlobalDefines["ED
> > K_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) +
> > 'INC = '
> > >          else:
> > >              MakeApp = MakeApp + PcdGccMakefile
> > > -            MakeApp = MakeApp + 'APPFILE = %s/%s\n'
> > % (self.OutputPath, PcdValueInitName) + 'APPNAME =
> > %s\n' % (PcdValueInitName)
> > > + 'OBJECTS = %s/%s.o\n' % (self.OutputPath,
> > PcdValueInitName) + \
> > > +            MakeApp = MakeApp + 'APPFILE = %s/%s\n'
> > % (self.OutputPath, PcdValueInitName) + 'APPNAME =
> > %s\n' %
> > > (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' %
> > (self.OutputPath, PcdValueInitName,
> > >
> > os.path.normpath(mws.join(GlobalData.gGlobalDefines["ED
> > K_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + \
> > >                        'include
> > $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
> > >
> > >          IncSearchList = []
> > > @@ -2723,8 +2720,8 @@ class
> > DscBuildData(PlatformBuildClassObject):
> > >
> > IncludeFileFullPaths.append(os.path.normpath(includeful
> > lpath))
> > >                      break
> > >          SearchPathList = []
> > > -
> > SearchPathList.append(os.path.normpath(mws.join(GlobalD
> > ata.gWorkspace, "BaseTools/Source/C/Include")))
> > > -
> > SearchPathList.append(os.path.normpath(mws.join(GlobalD
> > ata.gWorkspace, "BaseTools/Source/C/Common")))
> > > +
> > SearchPathList.append(os.path.normpath(mws.join(GlobalD
> > ata.gGlobalDefines["EDK_TOOLS_PATH"],
> > > "BaseTools/Source/C/Include")))
> > > +
> > SearchPathList.append(os.path.normpath(mws.join(GlobalD
> > ata.gGlobalDefines["EDK_TOOLS_PATH"],
> > > "BaseTools/Source/C/Common")))
> > >          SearchPathList.extend(str(item) for item in
> > IncSearchList)
> > >          IncFileList =
> > GetDependencyList(IncludeFileFullPaths, SearchPathList)
> > >          for include_file in IncFileList:
> > > @@ -2743,9 +2740,33 @@ class
> > DscBuildData(PlatformBuildClassObject):
> > >          else:
> > >              Dest_PcdValueInitExe =
> > os.path.join(self.OutputPath, PcdValueInitName) +".exe"
> > >          Messages = ''
> > > +
> > > +        VsDevCmd = {
> > > +            "VS2019"   : '"C:\\Program Files
> > (x86)\\Microsoft Visual
> > Studio\\2019\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"
> > ',
> > > +            "VS2017"   : '"C:\\Program Files
> > (x86)\\Microsoft Visual
> > Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"
> > ',
> > > +            "VS2015"   : '"C:\\Program Files
> > (x86)\\Microsoft Visual Studio
> > 14.0\\Common7\\Tools\\VsDevCmd.bat"',
> > > +            "VS2015x86": '"C:\\Program Files
> > (x86)\\Microsoft Visual Studio
> > 14.0\\Common7\\Tools\\VsDevCmd.bat"',
> > > +            "VS2013"   : '"C:\\Program Files
> > (x86)\\Microsoft Visual Studio
> > 12.0\\Common7\\Tools\\VsDevCmd.bat"',
> > > +            "VS2013x86": '"C:\\Program Files
> > (x86)\\Microsoft Visual Studio
> > 12.0\\Common7\\Tools\\VsDevCmd.bat"',
> > > +            "VS2012"   : '"C:\\Program Files
> > (x86)\\Microsoft Visual Studio
> > 11.0\\Common7\\Tools\\VsDevCmd.bat"',
> > > +            "VS2012x86": '"C:\\Program Files
> > (x86)\\Microsoft Visual Studio
> > 11.0\\Common7\\Tools\\VsDevCmd.bat"',
> > > +            "VS2010"   : '"C:\\Program Files
> > (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat"
> > x86',
> > > +            "VS2010x86": '"C:\\Program Files
> > (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat"
> > x86'
> > > +        }
> > > +
> > >          if sys.platform == "win32":
> > >              MakeCommand = 'nmake -f %s' %
> > (MakeFileName)
> > >              returncode, StdOut, StdErr =
> > DscBuildData.ExecuteCommand (MakeCommand)
> > > +            if returncode != 0:
> > > +                #
> > > +                # If the nmake command failed, then
> > lookup and run the VS
> > > +                # Development Environment script for
> > the current ToolChain and
> > > +                # try the nmake command again.
> > > +                #
> > > +                if self._Toolchain in VsDevCmd:
> > > +                    MakeCommand =
> > VsDevCmd[self._Toolchain] + '&' + MakeCommand
> > > +                    if os.path.exists
> > (MakeCommand.split('"')[1]):
> > > +                        returncode, StdOut, StdErr =
> > DscBuildData.ExecuteCommand (MakeCommand)
> > >              Messages = StdOut
> > >          else:
> > >              MakeCommand = 'make -f %s' %
> > (MakeFileName)
> > > --
> > > 2.21.0.windows.1


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

end of thread, other threads:[~2020-02-03  2:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-30  2:37 [Patch] BaseTools/Build: Fix Structured PCD app host env issues Michael D Kinney
2020-01-31  8:27 ` Liming Gao
2020-01-31 16:42   ` Michael D Kinney
2020-02-01  0:33     ` [edk2-devel] " Sean
2020-02-01 16:49       ` Michael D Kinney
2020-02-03  2:19     ` Liming Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox