Compilation Error

67 views
Skip to first unread message

Noreen Hasan

unread,
Feb 23, 2023, 1:59:50 PM2/23/23
to Chromium-dev
Hi All. I'm compiling chromium old version i.e. 81.0.4044.156. I have compiled new versions as well and they are working perfectly fine. But when I downgraded the chromium version its throwing me these errors.

[593/40126] ACTION //chrome/elevation_service:elevation_service_idl_idl_action(//build/toolchain/win:win_clang_x64)
FAILED: gen/chrome/elevation_service/elevation_service_idl.h gen/chrome/elevation_service/elevation_service_idl.dlldata.c gen/chrome/elevation_service/elevation_service_idl_i.c gen/chrome/elevation_service/elevation_service_idl_p.c gen/chrome/elevation_service/elevation_service_idl.tlb
C:/src/depot_tools/bootstrap-2@3_8_10_chromium_26_bin/python/bin/python.exe ../../build/toolchain/win/midl.py environment.x64 D:/ChromiumNew/src/third_party/win_build_output/midl/chrome/elevation_service gen/chrome/elevation_service none elevation_service_idl.tlb elevation_service_idl.h elevation_service_idl.dlldata.c elevation_service_idl_i.c elevation_service_idl_p.c ../../chrome/elevation_service/elevation_service_idl.idl /char signed /env x64 /Oicf
midl.exe output different from files in gen/chrome/elevation_service, see c:\users\abdulw~1\appdata\local\temp\tmpzvwp2i
--- gen/chrome/elevation_service\elevation_service_idl_p.c
+++ c:\users\abdulw~1\appdata\local\temp\tmpzvwp2i\elevation_service_idl_p.c
@@ -73,6 +73,58 @@

 static const RPC_SYNTAX_IDENTIFIER  _RpcTransferSyntax =
 {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
+
+#if defined(_CONTROL_FLOW_GUARD_XFG)
+#define XFG_TRAMPOLINES(ObjectType)\
+static unsigned long ObjectType ## _UserSize_XFG(unsigned long * pFlags, unsigned long Offset, void * pObject)\
+{\
+return  ObjectType ## _UserSize(pFlags, Offset, pObject);\
+}\
+static unsigned char * ObjectType ## _UserMarshal_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\
+{\
+return ObjectType ## _UserMarshal(pFlags, pBuffer, pObject);\
+}\
+static unsigned char * ObjectType ## _UserUnmarshal_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\
+{\
+return ObjectType ## _UserUnmarshal(pFlags, pBuffer, pObject);\
+}\
+static void ObjectType ## _UserFree_XFG(unsigned long * pFlags, void * pObject)\
+{\
+ObjectType ## _UserFree(pFlags, pObject);\
+}
+#define XFG_TRAMPOLINES64(ObjectType)\
+static unsigned long ObjectType ## _UserSize64_XFG(unsigned long * pFlags, unsigned long Offset, void * pObject)\
+{\
+return  ObjectType ## _UserSize64(pFlags, Offset, pObject);\
+}\
+static unsigned char * ObjectType ## _UserMarshal64_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\
+{\
+return ObjectType ## _UserMarshal64(pFlags, pBuffer, pObject);\
+}\
+static unsigned char * ObjectType ## _UserUnmarshal64_XFG(unsigned long * pFlags, unsigned char * pBuffer, void * pObject)\
+{\
+return ObjectType ## _UserUnmarshal64(pFlags, pBuffer, pObject);\
+}\
+static void ObjectType ## _UserFree64_XFG(unsigned long * pFlags, void * pObject)\
+{\
+ObjectType ## _UserFree64(pFlags, pObject);\
+}
+#define XFG_BIND_TRAMPOLINES(HandleType, ObjectType)\
+static void* ObjectType ## _bind_XFG(HandleType pObject)\
+{\
+return ObjectType ## _bind((ObjectType) pObject);\
+}\
+static void ObjectType ## _unbind_XFG(HandleType pObject, handle_t ServerHandle)\
+{\
+ObjectType ## _unbind((ObjectType) pObject, ServerHandle);\
+}
+#define XFG_TRAMPOLINE_FPTR(Function) Function ## _XFG
+#else
+#define XFG_TRAMPOLINES(ObjectType)
+#define XFG_TRAMPOLINES64(ObjectType)
+#define XFG_BIND_TRAMPOLINES(HandleType, ObjectType)
+#define XFG_TRAMPOLINE_FPTR(Function) Function
+#endif


 extern const elevation_service_idl_MIDL_TYPE_FORMAT_STRING elevation_service_idl__MIDL_TypeFormatString;
@@ -571,7 +623,7 @@
     1, /* -error bounds_check flag */
     0x50002, /* Ndr library version */
     0,
-    0x801026e, /* MIDL Version 8.1.622 */
+    0x8010272, /* MIDL Version 8.1.626 */
     0,
     0,
     0,  /* notify & notify_flag routine table */

--- gen/chrome/elevation_service\elevation_service_idl.h
+++ c:\users\abdulw~1\appdata\local\temp\tmpzvwp2i\elevation_service_idl.h
@@ -43,6 +43,14 @@
 #pragma once
 #endif

+#ifndef DECLSPEC_XFGVIRT
+#if _CONTROL_FLOW_GUARD_XFG
+#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func))
+#else
+#define DECLSPEC_XFGVIRT(base, func)
+#endif
+#endif
+
 /* Forward Declarations */

 #ifndef __IElevator_FWD_DEFINED__
@@ -170,18 +178,22 @@
     {
         BEGIN_INTERFACE

+        DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
         HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
             IElevator * This,
             /* [in] */ REFIID riid,
             /* [annotation][iid_is][out] */
             _COM_Outptr_  void **ppvObject);

+        DECLSPEC_XFGVIRT(IUnknown, AddRef)
         ULONG ( STDMETHODCALLTYPE *AddRef )(
             IElevator * This);

+        DECLSPEC_XFGVIRT(IUnknown, Release)
         ULONG ( STDMETHODCALLTYPE *Release )(
             IElevator * This);

+        DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated)
         HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )(
             IElevator * This,
             /* [string][in] */ const WCHAR *crx_path,
@@ -252,18 +264,22 @@
     {
         BEGIN_INTERFACE

+        DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
         HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
             IElevatorChromium * This,
             /* [in] */ REFIID riid,
             /* [annotation][iid_is][out] */
             _COM_Outptr_  void **ppvObject);

+        DECLSPEC_XFGVIRT(IUnknown, AddRef)
         ULONG ( STDMETHODCALLTYPE *AddRef )(
             IElevatorChromium * This);

+        DECLSPEC_XFGVIRT(IUnknown, Release)
         ULONG ( STDMETHODCALLTYPE *Release )(
             IElevatorChromium * This);

+        DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated)
         HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )(
             IElevatorChromium * This,
             /* [string][in] */ const WCHAR *crx_path,
@@ -335,18 +351,22 @@
     {
         BEGIN_INTERFACE

+        DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
         HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
             IElevatorChrome * This,
             /* [in] */ REFIID riid,
             /* [annotation][iid_is][out] */
             _COM_Outptr_  void **ppvObject);

+        DECLSPEC_XFGVIRT(IUnknown, AddRef)
         ULONG ( STDMETHODCALLTYPE *AddRef )(
             IElevatorChrome * This);

+        DECLSPEC_XFGVIRT(IUnknown, Release)
         ULONG ( STDMETHODCALLTYPE *Release )(
             IElevatorChrome * This);

+        DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated)
         HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )(
             IElevatorChrome * This,
             /* [string][in] */ const WCHAR *crx_path,
@@ -418,18 +438,22 @@
     {
         BEGIN_INTERFACE

+        DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
         HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
             IElevatorChromeBeta * This,
             /* [in] */ REFIID riid,
             /* [annotation][iid_is][out] */
             _COM_Outptr_  void **ppvObject);

+        DECLSPEC_XFGVIRT(IUnknown, AddRef)
         ULONG ( STDMETHODCALLTYPE *AddRef )(
             IElevatorChromeBeta * This);

+        DECLSPEC_XFGVIRT(IUnknown, Release)
         ULONG ( STDMETHODCALLTYPE *Release )(
             IElevatorChromeBeta * This);

+        DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated)
         HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )(
             IElevatorChromeBeta * This,
             /* [string][in] */ const WCHAR *crx_path,
@@ -501,18 +525,22 @@
     {
         BEGIN_INTERFACE

+        DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
         HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
             IElevatorChromeDev * This,
             /* [in] */ REFIID riid,
             /* [annotation][iid_is][out] */
             _COM_Outptr_  void **ppvObject);

+        DECLSPEC_XFGVIRT(IUnknown, AddRef)
         ULONG ( STDMETHODCALLTYPE *AddRef )(
             IElevatorChromeDev * This);

+        DECLSPEC_XFGVIRT(IUnknown, Release)
         ULONG ( STDMETHODCALLTYPE *Release )(
             IElevatorChromeDev * This);

+        DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated)
         HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )(
             IElevatorChromeDev * This,
             /* [string][in] */ const WCHAR *crx_path,
@@ -584,18 +612,22 @@
     {
         BEGIN_INTERFACE

+        DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
         HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
             IElevatorChromeCanary * This,
             /* [in] */ REFIID riid,
             /* [annotation][iid_is][out] */
             _COM_Outptr_  void **ppvObject);

+        DECLSPEC_XFGVIRT(IUnknown, AddRef)
         ULONG ( STDMETHODCALLTYPE *AddRef )(
             IElevatorChromeCanary * This);

+        DECLSPEC_XFGVIRT(IUnknown, Release)
         ULONG ( STDMETHODCALLTYPE *Release )(
             IElevatorChromeCanary * This);

+        DECLSPEC_XFGVIRT(IElevator, RunRecoveryCRXElevated)
         HRESULT ( STDMETHODCALLTYPE *RunRecoveryCRXElevated )(
             IElevatorChromeCanary * This,
             /* [string][in] */ const WCHAR *crx_path,

To rebaseline:
  copy /y c:\users\abdulw~1\appdata\local\temp\tmpzvwp2i\* D:\ChromiumNew\src\third_party\win_build_output\midl\chrome\elevation_service\x64
[598/40125] CXX obj/components/chrome_cleaner/public/constants/constants/constants.obj
ninja: build stopped: subcommand failed.

Can anyone please help me out in building this as stuck there, tried different things. TIA

Bruce Dawson

unread,
Feb 23, 2023, 2:18:57 PM2/23/23
to Chromium-dev, Noreen Hasan
M81 is pretty old and while it definitely should be possible to build it, there can be challenges to getting the right environment set up if you don't have access to the prepackaged toolchains.

There are a few things you can check, and an easy hack solution.

If you look in build\toolchain\win\setup_toolchain.py at the end of _LoadToolchainEnv you may see a reference to a specific SDK version. That is the version that that version of Chrome expects to be built with. But, M81 may be too far back for that to be enforced. If the SDK version isn't specified there then specifying it will save you a lot of trouble, since M81 may not build with any other version and you probably want to have multiple SDK versions installed.

If you look in build\vs_toolchain.py for the toolchain hash you should see a comment saying what SDK is used to build that version of Chrome. You can use that together with specifying it in _LoadToolchainEnv.

If docs/windows_build_instructions.md exists then it should also list the SDK used. All the places that get modified when we change the toolchain are listed in crrev.com/c/4072083

The suggestions above are all the "correct" solution to your problem. However if the rebaseline errors are the only problem that you are having then you can work around them by making the "return 0" here be unconditional:

That disables the IDL output checking. Good luck.
Reply all
Reply to author
Forward
0 new messages