ungoogled-chromium: BUILD.gn error during compilation on Windows

Description

Error during patching:

patching file chrome/BUILD.gn
Hunk #2 FAILED at 83.

Environment details

  • ungoogled-chromium version: all tried versions starting 69.*
  • Configuration bundle: windows
  • Packaging type (if applicable): windows
  • OS and version for building: Windows 7 x64
  • Compiler toolchain: VS 2017

Building and packaging steps

py ungoogled_packaging\build.py

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 39 (25 by maintainers)

Most upvoted comments

That patch came in handy for the “tlb” issue, since now I don’t need to open a Native Tools cmd for that, but this happens:

FAILED: obj/chrome/common/safe_browsing/file_type_policies/file_type_policies.obj

../../chrome/common/safe_browsing/file_type_policies.cc(53,29):  error: use of undeclared identifier 'IDR_DOWNLOAD_FILE_TYPES_PB'
  bundle.GetRawDataResource(IDR_DOWNLOAD_FILE_TYPES_PB).CopyToString(binary_pb);
                            ^
1 error generated.

Here’s another build error, just after the 90% mark:

FAILED: chrome.dll chrome.dll.lib
ninja -t msvc -e environment.x64 -- ../../third_party/llvm-build/Release+Asserts/bin/lld-link.exe /nologo /IMPLIB:./chrome.dll.lib /DLL /OUT:./chrome.dll /PDB:./chrome.dll.pdb @./chrome.dll.rsp
lld-link.exe: error: undefined symbol: ?GetMainText@SettingsResetPromptController@safe_browsing@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(??0SettingsResetPromptDialog@@QEAA@PEAVSettingsResetPromptController@safe_browsing@@@Z)


lld-link.exe: error: undefined symbol: ?GetMainTextUrlRange@SettingsResetPromptController@safe_browsing@@QEBA?AVRange@gfx@@XZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(??0SettingsResetPromptDialog@@QEAA@PEAVSettingsResetPromptController@safe_browsing@@@Z)


lld-link.exe: error: undefined symbol: ?DialogShown@SettingsResetPromptController@safe_browsing@@QEAAXXZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(?Show@SettingsResetPromptDialog@@QEAAXPEAVBrowser@@@Z)


lld-link.exe: error: undefined symbol: ?Close@SettingsResetPromptController@safe_browsing@@QEAAXXZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(??1SettingsResetPromptDialog@@UEAA@XZ)
>>> referenced by ui.lib(ui_jumbo_9.obj):(?Close@SettingsResetPromptDialog@@UEAA_NXZ)


lld-link.exe: error: undefined symbol: ?GetWindowTitle@SettingsResetPromptController@safe_browsing@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(?GetWindowTitle@SettingsResetPromptDialog@@UEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ)


lld-link.exe: error: undefined symbol: ?GetButtonLabel@SettingsResetPromptController@safe_browsing@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(?GetDialogButtonLabel@SettingsResetPromptDialog@@UEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@W4DialogButton@ui@@@Z)


lld-link.exe: error: undefined symbol: ?Accept@SettingsResetPromptController@safe_browsing@@QEAAXXZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(?Accept@SettingsResetPromptDialog@@UEAA_NXZ)


lld-link.exe: error: undefined symbol: ?Cancel@SettingsResetPromptController@safe_browsing@@QEAAXXZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(?Cancel@SettingsResetPromptDialog@@UEAA_NXZ)


lld-link.exe: error: undefined symbol: ?GetInstance@ChromeCleanerController@safe_browsing@@SAPEAV12@XZ
>>> referenced by ui.lib(ui_jumbo_9.obj):(??0ChromeCleanupHandler@settings@@QEAA@PEAVProfile@@@Z)


lld-link.exe: error: undefined symbol: ?FetchExtensionNames@ChromeCleanerScannerResults@safe_browsing@@QEBAXPEAVProfile@@PEAV?$set@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@U?$less@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@V?$allocator@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@@std@@@Z
>>> referenced by ui.lib(ui_jumbo_9.obj):(?GetScannerResultsAsDictionary@?A@settings@@YA?AVDictionaryValue@base@@AEBVChromeCleanerScannerResults@safe_browsing@@PEAVProfile@@@Z)


lld-link.exe: error: undefined symbol: ?OnUserAction@ChromePasswordProtectionService@safe_browsing@@QEAAXPEAVWebContents@content@@W4LoginReputationClientRequest_PasswordReuseEvent_ReusedPasswordType@2@W4WarningUIType@2@W4WarningAction@2@@Z
>>> referenced by ui.lib(ui_jumbo_7.obj):(?HandleChangePassword@ChangePasswordHandler@settings@@AEAAXPEBVListValue@base@@@Z)


lld-link.exe: error: undefined symbol: ?ShouldShowChangePasswordSettingUI@ChromePasswordProtectionService@safe_browsing@@SA_NPEAVProfile@@@Z
>>> referenced by ui.lib(ui_jumbo_7.obj):(?UpdateChangePasswordCardVisibility@ChangePasswordHandler@settings@@AEAAXXZ)

[3387/4273] CXX obj/v8/src/inspector/inspector/inspector_jumbo_1.obj
ninja: build stopped: subcommand failed.

That patch came in handy for the “tlb” issue, since now I don’t need to open a Native Tools cmd for that, but this happens:

chrome\browser\browser_resources.grd

@@ -148,9 +148,7 @@
       <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_HTML" file="resources\domain_reliability_internals.html" compress="gzip" type="BINDATA" />
       <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_CSS" file="resources\domain_reliability_internals.css" compress="gzip" type="BINDATA" />
       <include name="IDR_DOMAIN_RELIABILITY_INTERNALS_JS" file="resources\domain_reliability_internals.js" compress="gzip" type="BINDATA" />
-      <if expr="safe_browsing_mode != 0">
-        <include name="IDR_DOWNLOAD_FILE_TYPES_PB" file="${root_gen_dir}\chrome\browser\resources\safe_browsing\download_file_types.pb" use_base_dir="false" type="BINDATA" />
-      </if>
+      <include name="IDR_DOWNLOAD_FILE_TYPES_PB" file="${root_gen_dir}\chrome\browser\resources\safe_browsing\download_file_types.pb" use_base_dir="false" type="BINDATA" />
       <include name="IDR_DOWNLOAD_INTERNALS_HTML" file="resources\download_internals\download_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
       <include name="IDR_DOWNLOAD_INTERNALS_CSS" file="resources\download_internals\download_internals.css" type="BINDATA" compress="gzip" />
       <include name="IDR_DOWNLOAD_INTERNALS_JS" file="resources\download_internals\download_internals.js" type="BINDATA" compress="gzip" />

One question about patch that must fix building with safe browsing disabled: is it really needed? I’m asking this because in no one folder for other distributions I see identical patch. So maybe it must be rewritten from scratch?

Thanks to @r4sas patches the goal is close, but I’m still getting errors.

Can you provide full error info?

Thanks to @r4sas patches the goal is close, but I’m still getting errors.

[15871/20080] CXX obj/chrome/common/media_router/mojo/media_router/media_router_jumbo_1.obj
ninja: build stopped: subcommand failed.

Looks like something wrong with gn output…

rule __chrome_elevation_service_elevation_service_idl_idl_action___build_toolchain_win_win_clang_x64__rule
  command = D$:/devel/Python27/python.exe ../../build/toolchain/win/midl.py environment.x64 gen/chrome/elevation_service none ${source_name_part}.tlb ${source_name_part}.h ${source_name_part}.dlldata.c ${source_name_part}_i.c ${source_name_part}_p.c ${in} /char signed /env x64 /Oicf
  description = ACTION //chrome/elevation_service:elevation_service_idl_idl_action(//build/toolchain/win:win_clang_x64)
  restat = 1
  pool = build_toolchain_action_pool

I’m about ${source_name_part}, ${in} in command line.

add: If someone understand GN’s scripts, please help with build\toolchain\win\midl.gni and build\win\message_compiler.gni.

add2: In gni scripts all correct. Problem in build/toolchain/win/midl.py which store all processed files in temp directory. Will add in this post patch later.

patch for testing

--- a/build/toolchain/win/midl.py
+++ b/build/toolchain/win/midl.py
@@ -171,12 +171,6 @@
   if sys.platform != 'win32':
     return 0
 
-  # On Windows, run midl.exe on the input and check that its outputs are
-  # identical to the checked-in outputs (after possibly replacing their main
-  # class guid).
-  tmp_dir = tempfile.mkdtemp()
-  delete_tmp_dir = True
-
   # Read the environment block from the file. This is stored in the format used
   # by CreateProcess. Drop last 2 NULs, one for list terminator, one for
   # trailing vs. separator.
@@ -184,13 +178,14 @@
   env_dict = dict([item.split('=', 1) for item in env_pairs])
 
   args = ['midl', '/nologo'] + list(flags) + [
-      '/out', tmp_dir,
+      '/out', outdir,
       '/tlb', tlb,
       '/h', h,
       '/dlldata', dlldata,
       '/iid', iid,
       '/proxy', proxy,
       idl]
+
   try:
     popen = subprocess.Popen(args, shell=True, env=env_dict,
                              stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
@@ -209,29 +204,11 @@
     if popen.returncode != 0:
       return popen.returncode
 
-    for f in os.listdir(tmp_dir):
-      ZapTimestamp(os.path.join(tmp_dir, f))
-
-    # Now compare the output in tmp_dir to the copied-over outputs.
-    diff = filecmp.dircmp(tmp_dir, outdir)
-    if diff.diff_files:
-      print 'midl.exe output different from files in %s, see %s' \
-          % (outdir, tmp_dir)
-      for f in diff.diff_files:
-        if f.endswith('.tlb'): continue
-        fromfile = os.path.join(outdir, f)
-        tofile = os.path.join(tmp_dir, f)
-        print ''.join(difflib.unified_diff(open(fromfile, 'U').readlines(),
-                                           open(tofile, 'U').readlines(),
-                                           fromfile, tofile))
-      delete_tmp_dir = False
-      print 'To rebaseline:'
-      print '  copy /y %s\* %s' % (tmp_dir, source)
-      sys.exit(1)
+    for f in os.listdir(outdir):
+      ZapTimestamp(os.path.join(outdir, f))
     return 0
   finally:
-    if os.path.exists(tmp_dir) and delete_tmp_dir:
-      shutil.rmtree(tmp_dir)
+    return 0
 
 
 if __name__ == '__main__':

I also stopped here, thats why I said about need for additional patching.

Tried 72.0.3626.122-1:

2019-03-14 22:54:14,811 - INFO: * Applying windows-disable-reorder-fix-linking.patch (115/124)
2019-03-14 22:54:14,811 - DEBUG: C:\ungoogled-chromium\build\src\third_party\git\usr\bin\patch.exe -p1 --ignore-whitespace -i C:\ungoogled-chromium\build\src\ungoogled_packaging\patches\ungoogled-chromium\windows\windows-disable-reorder-fix-linking.patch -d C:\ungoogled-chromium\build\src --no-backup-if-mismatch --forward
(Stripping trailing CRs from patch; use --binary to disable.)
patching file chrome/BUILD.gn
Hunk #2 FAILED at 83.
Hunk #3 succeeded at 309 (offset -3 lines).
1 out of 3 hunks FAILED -- saving rejects to file chrome/BUILD.gn.rej
(Stripping trailing CRs from patch; use --binary to disable.)
patching file tools/perf/chrome_telemetry_build/BUILD.gn
Hunk #1 succeeded at 36 (offset 4 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file chrome/test/chromedriver/BUILD.gn
Hunk #1 succeeded at 364 (offset 7 lines).

Tried on master:

(Stripping trailing CRs from patch; use --binary to disable.)
patching file chrome/BUILD.gn
Hunk #2 FAILED at 83.
Hunk #3 succeeded at 309 (offset -3 lines).
1 out of 3 hunks FAILED -- saving rejects to file chrome/BUILD.gn.rej
(Stripping trailing CRs from patch; use --binary to disable.)
patching file tools/perf/chrome_telemetry_build/BUILD.gn
Hunk #1 succeeded at 36 (offset 4 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file chrome/test/chromedriver/BUILD.gn
Hunk #1 succeeded at 364 (offset 7 lines).
Traceback (most recent call last):
  File "ungoogled_packaging\build.py", line 187, in <module>
    main()
  File "ungoogled_packaging\build.py", line 164, in main
    buildkit.patches.patch_paths_by_bundle(bundle), source_tree, patch_bin_path=None)

Ahhh, no luck yet. Thanks, bro. On Sunday, March 10, 2019, 2:56:42 AM GMT+2, Maxim notifications@github.com wrote:

@hardhub hardhub can you try again with latest version?

master: subprocess.CalledProcessError: Command ‘[‘C:\ungoogled-chromium\build\src\third_party\git\usr\bin\patch.exe’, ‘-p1’, ‘–ignore-whitespace’, ‘-i’, ‘C:\ungoogled-chromium\build\src\ungoogled_packaging\patches
\ungoogled-chromium\windows\windows-disable-reorder-fix-linking.patch’, ‘-d’, ‘C:\ungoogled-chromium\build\src’, ‘–no-backup-if-mismatch’, ‘–forward’]’ returned non-zero exit status 1.

72.0.3626.122-1 (Stripping trailing CRs from patch; use --binary to disable.) patching file chrome/BUILD.gn Hunk #2 FAILED at 83. Hunk #3 succeeded at 309 (offset -3 lines).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

@hardhub hardhub can you try again with latest version?

master:

subprocess.CalledProcessError: Command '['C:\\ungoogled-chromium\\build\\src\\third_party\\git\\usr\\bin\\patch.exe', '-p1', '--ignore-whitespace', '-i', 'C:\\ungoogled-chromium\\build\\src\\ungoogled_packaging\\patches\
\ungoogled-chromium\\windows\\windows-disable-reorder-fix-linking.patch', '-d', 'C:\\ungoogled-chromium\\build\\src', '--no-backup-if-mismatch', '--forward']' returned non-zero exit status 1.

72.0.3626.122-1

(Stripping trailing CRs from patch; use --binary to disable.)
patching file chrome/BUILD.gn
Hunk #2 FAILED at 83.
Hunk #3 succeeded at 309 (offset -3 lines).

Thanks bro. Sad day for fans. On Saturday, March 9, 2019, 1:37:07 PM GMT+2, warmaster345 notifications@github.com wrote:

@hardhub hardhub can you try again with latest version? I have tried with the latest version, the same error occurred. Windows 10 x64, VS 2017

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Sorry if 71 is still the latest one. I believed chromium has the same version like chrome, in this case, 72. On Saturday, March 9, 2019, 12:07:18 PM GMT+2, TCB13 notifications@github.com wrote:

@hardhub hardhub can you try again with latest version?

@lipici what do you mean by “latest version”, a specific tag or master? Either way, is it even possible to build above 71.0.3578.98-2 under Windows? Seems like there is a lot of broken stuff…

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

@hardhub can you try again with latest version? I have tried with the latest version, the same error occurred. Windows 10 x64, VS 2017

@TN0X thank you for the answer, can you tell us the exact steps to disable safe browsing in 71.0.3578.98-x and to add the build-flag? I tried to do this and failed (not very well versed in chromium).

see: https://github.com/TN0X/ungoogled-chromium/compare/master...TN0X:test1

you have to change these files: config_bundles/windows/patch_order.list config_bundles/common/patch_order.list config_bundles/common/gn_flags.map

Description

Error during patching:

patching file chrome/BUILD.gn
Hunk #2 FAILED at 83.

The problem arises due to problems in some patches for windows since chromium 72.0.72.0.3626.xx. So there is not only the known issue with all safe-browsing patches since 71.0.3578.98-x, which could be solved by disabling these patches and setting the approriate build-flag. Since ungoogled-chromium 72.0.3626.96-1 there are new issues with other patches for windows. These patches in ungoogled-chromium does not fit to the source code of chromium 72.0.xxx:

windows-disable-reorder-fix-linking.patch: patching file chrome/BUILD.gn Hunk #2 FAILED at 83.

windows-disable-rcpy.patch: patching file build/toolchain/win/tool_wrapper.py Hunk #1 FAILED at 195. Hunk #2 FAILED at 227.

last working build with disabled safe-browsing patches is 71.0.3578.98-3

@TCB13

Not exactly so…

  1. 7z was already installed. Just checked version - 16.04 (but nor sure it is so important).
* python-3.6.5-amd64.exe (don't add to path; enable py launcher)

both are in PATH but 27 before 37 (not 3.6.5) and py launcher is also in PATH

  1. Yes, I did

  2. I have Visual Studio 2017 Enterprise latest update (I am working on some .Net projects). So I just installed all C++ features including MFC library. I have list of all installed packages, but it is 36 KB (I cannot simply paste it here).

  3. I have installed lastest Windows 10 SDK 1809: 17763.132.181022-1834.rs5_release_svc_prod1_WindowsSDK

Debugging Tools was also installed with this SDK.

  1. No… I did this:
mkdir build\src
py get_package.py windows build\src\ungoogled_packaging
cd build\src
py ungoogled_packaging\build.py
py ungoogled_packaging\package.py

I think get_package.py does that.

  1. Yes
C:\>set | findstr DEPOT
DEPOT_TOOLS_WIN_TOOLCHAIN=0
  1. Yes as described above.

@TCB13

I simply made all as specified in instructions.
Maybe you used different version of chromium source.
To be honest I do not know exactly.