ninja , compile chromium error ! help ! midl.exe output different from files in gen/chrome/elevation_service, see c:\users\18f\appdata\local\temp\tmpzgxhfb

629 views
Skip to first unread message

吴锦林

unread,
Jun 2, 2023, 11:37:59 AM6/2/23
to Chromium-dev
Hi,  I want to build old chromium for debug old bug.


But seems they are different.

Here is my output:
``` c++
> autoninja -C out\right_fun chrome
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
C:/Python27/python.exe ../../build/toolchain/win/midl.py environment.x64 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\18f\appdata\local\temp\tmpzgxhfb
--- gen/chrome/elevation_service\elevation_service_idl_p.c
+++ c:\users\18f\appdata\local\temp\tmpzgxhfb\elevation_service_idl_p.c
@@ -71,51 +71,141 @@
     } elevation_service_idl_MIDL_EXPR_FORMAT_STRING;


-static const RPC_SYNTAX_IDENTIFIER  _RpcTransferSyntax =
+static const RPC_SYNTAX_IDENTIFIER  _RpcTransferSyntax_2_0 =
 {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}};
```

here is the environment which I try to build the chormium

``` c++
commit:
C:\Users\18f\Desktop\18_floor\source_code\build_chromium_for_debug\src>git show
commit 6c2e672967359ad32d19af8b09873adab2c0beec (HEAD)
Author: Makoto Shimazu <shi...@chromium.org>
Date:   Tue Feb 5 09:54:50 2019 +0000

OS version :
windows 11

VS version:
2017 and 2019(I use 2017 to build this version)
```


So this is my think:
-  [x] The code is old, so the source code support for windows 10. see |static const RPC_SYNTAX_IDENTIFIER  _RpcTransferSyntax| = in |gen/chrome/elevation_service/elevation_service_idl_p.c|
-  [x] but my system is windows 11, the sdk will decide to generate new code |static const RPC_SYNTAX_IDENTIFIER  _RpcTransferSyntax_2_0| which mismatch the source code.

I install old sdk, like 
show_00.png
I think 17763 maybe wrok, so I use this command :

``` c++
gn args out\right_fun --ide=vs --winsdk=10.0.17763.0
```

But it still can't work. I think maybe this is because of this code(build\vs_toolchain.py):
``` c++
      sdk_redist_root = os.path.join(win_sdk_dir, 'bin')
      sdk_bin_sub_dirs = os.listdir(sdk_redist_root)
      # Select the most recent SDK if there are multiple versions installed.
      sdk_bin_sub_dirs.sort(reverse=True)
      for directory in sdk_bin_sub_dirs:
        sdk_redist_root_version = os.path.join(sdk_redist_root, directory)
        if not os.path.isdir(sdk_redist_root_version):
          continue
        if re.match('10\.\d+\.\d+\.\d+', directory):
          source_dir = os.path.join(sdk_redist_root_version, target_cpu, 'ucrt')
          break
```
It will find the most recent sdk. So I use sdk_bin_sub_dirs.pop() to pop "newer" version... but It still can't work.

So, any tips? If I want to build these  version chromium, the only way is reinstall the system to windows? 

Thank you very much!

Bruce Dawson

unread,
Jun 3, 2023, 1:09:16 PM6/3/23
to Chromium-dev, 吴锦林
If the error is that the midl output doesn't match then you could return early before that check. That is, just add an unconditional return here:


However, you may then hit different problems. In general if you want to build an older version of Chromium you should make sure you have the exact same compiler and SDK versions. You can usually see comments saying what is expected near the top of build/vs_toolchain.py. I took a look at the old version:

    git show 6c2e672967359ad32d19af8b09873adab2c0beec:./build/vs_toolchain.py > vs.py

and found this comment:

    # VS 2017 Update 9 (15.9.3) with 10.0.17763.132 SDK, 10.0.17134 version of
    # d3dcompiler_47.dll, with ARM64 libraries.

So, if you use that compiler and SDK version then everything should work (the d3dcompiler_47.dll version probably doesn't matter). However I think that back in 2019 we may not have been rigorous about specifying the SDK version that we want. In recent versions of Chromium in build/toolchain/win/setup_toolchain.py we append SDK_VERSION to the vcvarsall.bat command that we run to set up lib and include paths - you may need to do that.

Good luck.
Reply all
Reply to author
Forward
0 new messages