ungoogled-software / ungoogled-chromium

Google Chromium, sans integration with Google
BSD 3-Clause "New" or "Revised" License
20.8k stars 844 forks source link

error: Linking two modules of different target triples #2949

Closed g7fya closed 2 months ago

g7fya commented 4 months ago

OS/Platform

Portable Linux

Installed

Compiled from source

Version

126.0.6478.126-1

Have you tested that this is not an upstream issue or an issue with your configuration?

Description

error: Linking two modules of different target triples

How to Reproduce?

  1. start building
  2. on last step on ninja [59426/59426] failed.

Actual behaviour

At the ninja [59426/59426] got this error

[59426/59426] LINK ./chrome FAILED: chrome "python3" "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome" -- clang++ -Wl,--version-script=../../build/linux/chrome.map -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics -Wl,-mllvm,-instcombine-lower-dbg-declare=0 -Wl,--thinlto-cache-dir=thinlto-cache -Wl,--thinlto-cache-policy=cache_size=10\%:cache_size_bytes=40g:cache_size_files=100000 -flto=thin -Wl,--thinlto-jobs=all -Wl,-mllvm,-import-instr-limit=30 -Wl,-mllvm,-disable-auto-upgrade-debug-info -fwhole-program-vtables -Wl,--undefined-version -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -Wl,-z,defs -Wl,--as-needed -nostdlib++ -fsanitize=cfi-vcall -fsanitize=cfi-icall -rdynamic -pie -Wl,--disable-new-dtags -Wl,--lto-O2 prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject.rlib -L/usr/lib -o "./chrome" -Wl,--start-group @"./chrome.rsp" -Wl,--end-group /usr/lib/clang/18/lib/linux/libclang_rt.builtins-x86_64.a -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -licui18n -licuuc -licudata -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -ldbus-1 -latk-bridge-2.0 -latk-1.0 -lcups -lgio-2.0 -ldrm -lfontconfig -latomic -lz -latspi -lresolv -lbrotlidec -lexpat -lpng16 -lwebpdemux -lwebpmux -lwebp -lfreetype -ljpeg -lharfbuzz-subset -lharfbuzz -lopus -lm -ldav1d -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrender -lXrandr -lXtst -lgbm -lEGL -lxcb -lxkbcommon -lXi -lpci -lffi -lpangocairo-1.0 -lpango-1.0 -lcairo -lasound -lpulse -lFLAC -lminizip -lxml2 -lxslt -lxshmfence -lstdc++ -lbrotlienc obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib obj/skia/libskia_cbridge_urust_uside.rlib obj/third_party/rust/font_types/v0_5/lib/libfont_types_lib.rlib obj/third_party/rust/bytemuck/v1/lib/libbytemuck_lib.rlib obj/third_party/rust/read_fonts/v0_19/lib/libread_fonts_lib.rlib obj/third_party/rust/skrifa/v0_19/lib/libskrifa_lib.rlib obj/build/rust/chromium_prelude/libchromium.rlib obj/third_party/blink/common/rust_crash/libthird_uparty_sblink_scommon_srust_ucrash_crs.rlib obj/components/qr_code_generator/libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.rlib obj/third_party/rust/qr_code/v2/lib/libqr_code_lib.rlib ld.lld: error: Linking two modules of different target triples: 'obj/skia/libbridge_rust_side_cxx_generated.a(ffi.rs.o at 7524)' is 'x86_64-unknown-linux-gnu' whereas 'obj/skia/libskia_cbridge_urust_uside.rlib(libskia_cbridge_urust_uside.skia_cbridge_urust_uside.5d5f7d4845ed3a7-cgu.0.rcgu.o at 243684)' is 'x86_64-pc-linux-gnu'

Expected behaviour

Linking two modules of different target triples

Relevant log output

[59426/59426] LINK ./chrome
FAILED: chrome 
"python3" "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome" -- clang++ -Wl,--version-script=../../build/linux/chrome.map -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--icf=all -Wl,--color-diagnostics -Wl,-mllvm,-instcombine-lower-dbg-declare=0 -Wl,--thinlto-cache-dir=thinlto-cache -Wl,--thinlto-cache-policy=cache_size=10\%:cache_size_bytes=40g:cache_size_files=100000 -flto=thin -Wl,--thinlto-jobs=all -Wl,-mllvm,-import-instr-limit=30 -Wl,-mllvm,-disable-auto-upgrade-debug-info -fwhole-program-vtables -Wl,--undefined-version -Wl,--no-call-graph-profile-sort -m64 -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -Wl,-z,defs -Wl,--as-needed -nostdlib++ -fsanitize=cfi-vcall -fsanitize=cfi-icall -rdynamic -pie -Wl,--disable-new-dtags -Wl,--lto-O2 prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide.rlib prebuilt_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject.rlib -L/usr/lib -o "./chrome" -Wl,--start-group @"./chrome.rsp"  -Wl,--end-group  /usr/lib/clang/18/lib/linux/libclang_rt.builtins-x86_64.a -ldl -lpthread -lrt -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -licui18n -licuuc -licudata -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -ldbus-1 -latk-bridge-2.0 -latk-1.0 -lcups -lgio-2.0 -ldrm -lfontconfig -latomic -lz -latspi -lresolv -lbrotlidec -lexpat -lpng16 -lwebpdemux -lwebpmux -lwebp -lfreetype -ljpeg -lharfbuzz-subset -lharfbuzz -lopus -lm -ldav1d -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrender -lXrandr -lXtst -lgbm -lEGL -lxcb -lxkbcommon -lXi -lpci -lffi -lpangocairo-1.0 -lpango-1.0 -lcairo -lasound -lpulse -lFLAC -lminizip -lxml2 -lxslt -lxshmfence -lstdc++ -lbrotlienc obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib obj/skia/libskia_cbridge_urust_uside.rlib obj/third_party/rust/font_types/v0_5/lib/libfont_types_lib.rlib obj/third_party/rust/bytemuck/v1/lib/libbytemuck_lib.rlib obj/third_party/rust/read_fonts/v0_19/lib/libread_fonts_lib.rlib obj/third_party/rust/skrifa/v0_19/lib/libskrifa_lib.rlib obj/build/rust/chromium_prelude/libchromium.rlib obj/third_party/blink/common/rust_crash/libthird_uparty_sblink_scommon_srust_ucrash_crs.rlib obj/components/qr_code_generator/libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.rlib obj/third_party/rust/qr_code/v2/lib/libqr_code_lib.rlib
ld.lld: error: Linking two modules of different target triples: 'obj/skia/libbridge_rust_side_cxx_generated.a(ffi.rs.o at 7524)' is 'x86_64-unknown-linux-gnu' whereas 'obj/skia/libskia_cbridge_urust_uside.rlib(libskia_cbridge_urust_uside.skia_cbridge_urust_uside.5d5f7d4845ed3a7-cgu.0.rcgu.o at 243684)' is 'x86_64-pc-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib(libcxx_lib.cxx.d24b038e9b55a7f2-cgu.0.rcgu.o at 747096)' is 'x86_64-pc-linux-gnu' whereas 'obj/build/rust/libcxx_cppdeps.a(cxx.o at 30306)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/skia/libskia_cbridge_urust_uside.rlib(libskia_cbridge_urust_uside.skia_cbridge_urust_uside.5d5f7d4845ed3a7-cgu.0.rcgu.o at 243684)' is 'x86_64-pc-linux-gnu' whereas 'obj/skia/libskia.a(SkTypeface_fontations.o at 1194732)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib(libcxx_lib.cxx.d24b038e9b55a7f2-cgu.0.rcgu.o at 747096)' is 'x86_64-pc-linux-gnu' whereas 'obj/skia/libskia.a(SkTypeface_fontations.o at 1194732)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/build/rust/libcxx_cppdeps.a(cxx.o at 30306)' is 'x86_64-unknown-linux-gnu' whereas 'obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib(libcxx_lib.cxx.d24b038e9b55a7f2-cgu.0.rcgu.o at 747096)' is 'x86_64-pc-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/skia/libskia_cbridge_urust_uside.rlib(libskia_cbridge_urust_uside.skia_cbridge_urust_uside.5d5f7d4845ed3a7-cgu.0.rcgu.o at 243684)' is 'x86_64-pc-linux-gnu' whereas 'obj/skia/libbridge_rust_side_cxx_generated.a(ffi.rs.o at 7524)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib(libcxx_lib.cxx.d24b038e9b55a7f2-cgu.0.rcgu.o at 747096)' is 'x86_64-pc-linux-gnu' whereas 'obj/skia/libbridge_rust_side_cxx_generated.a(ffi.rs.o at 7524)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/blink/common/rust_crash/libthird_uparty_sblink_scommon_srust_ucrash_crs.rlib(libthird_uparty_sblink_scommon_srust_ucrash_crs.third_uparty_sblink_scommon_srust_ucrash_crs.f3ecbd730ddefc28-cgu.0.rcgu.o at 5842)' is 'x86_64-pc-linux-gnu' whereas 'obj/third_party/blink/common/common/chrome_debug_urls.o' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/components/qr_code_generator/libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.rlib(libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.components_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.c6a373c94d64c0b2-cgu.0.rcgu.o at 11754)' is 'x86_64-pc-linux-gnu' whereas 'obj/components/qr_code_generator/qr_code_generator/qr_code_generator.o' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib(libcxx_lib.cxx.d24b038e9b55a7f2-cgu.0.rcgu.o at 747096)' is 'x86_64-pc-linux-gnu' whereas 'obj/components/qr_code_generator/qr_code_generator/qr_code_generator.o' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/build/rust/libcxx_cppdeps.a(cxx.o at 30306)' is 'x86_64-unknown-linux-gnu' whereas 'obj/components/qr_code_generator/libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.rlib(libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.components_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.c6a373c94d64c0b2-cgu.0.rcgu.o at 11754)' is 'x86_64-pc-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/blink/common/rust_crash/librs_cxx_generated.a(lib.rs.o at 308)' is 'x86_64-unknown-linux-gnu' whereas 'obj/third_party/blink/common/rust_crash/libthird_uparty_sblink_scommon_srust_ucrash_crs.rlib(libthird_uparty_sblink_scommon_srust_ucrash_crs.third_uparty_sblink_scommon_srust_ucrash_crs.f3ecbd730ddefc28-cgu.0.rcgu.o at 5842)' is 'x86_64-pc-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/blink/common/rust_crash/libthird_uparty_sblink_scommon_srust_ucrash_crs.rlib(libthird_uparty_sblink_scommon_srust_ucrash_crs.third_uparty_sblink_scommon_srust_ucrash_crs.f3ecbd730ddefc28-cgu.0.rcgu.o at 5842)' is 'x86_64-pc-linux-gnu' whereas 'obj/third_party/blink/common/rust_crash/librs_cxx_generated.a(lib.rs.o at 308)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib(libcxx_lib.cxx.d24b038e9b55a7f2-cgu.0.rcgu.o at 747096)' is 'x86_64-pc-linux-gnu' whereas 'obj/third_party/blink/common/rust_crash/librs_cxx_generated.a(lib.rs.o at 308)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/components/qr_code_generator/libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.rlib(libcomponents_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.components_sqr_ucode_ugenerator_cqr_ucode_ugenerator_uffi_uglue.c6a373c94d64c0b2-cgu.0.rcgu.o at 11754)' is 'x86_64-pc-linux-gnu' whereas 'obj/components/qr_code_generator/libqr_code_generator_ffi_glue_cxx_generated.a(qr_code_generator_ffi_glue.rs.o at 344)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/rust/cxx/v1/lib/libcxx_lib.rlib(libcxx_lib.cxx.d24b038e9b55a7f2-cgu.0.rcgu.o at 747096)' is 'x86_64-pc-linux-gnu' whereas 'obj/components/qr_code_generator/libqr_code_generator_ffi_glue_cxx_generated.a(qr_code_generator_ffi_glue.rs.o at 344)' is 'x86_64-unknown-linux-gnu'

ld.lld: error: Linking two modules of different target triples: 'obj/third_party/blink/common/rust_crash/libthird_uparty_sblink_scommon_srust_ucrash_crs.rlib(libthird_uparty_sblink_scommon_srust_ucrash_crs.third_uparty_sblink_scommon_srust_ucrash_crs.f3ecbd730ddefc28-cgu.0.rcgu.o at 5842)' is 'x86_64-pc-linux-gnu' whereas 'obj/third_party/blink/common/rust_crash/cpp/rust_crash.o' is 'x86_64-unknown-linux-gnu'

clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Additional context

No response

PF4Public commented 4 months ago

Did it work before?

g7fya commented 4 months ago

Did it work before?

I compile an old version 83.0.4103.116 some time ago.

PF4Public commented 4 months ago

@clickot Have you had such issue with portable?

clickot commented 4 months ago

not for quite some time, but i started using the "sysroot" feature at some point, using toolchain and libs from prebuilt debian/bullseye packing provided by google. I the past I sometimes had "strange" compile or linking errors, which I assume came from the fact that the libs and tools versions on your local maschine do not match to what chromium build expects. Another effect of using sysroot is that you can be somewhat sure the build result (despite of bullseye itself of course) runs on "older" linux distros like ubuntu 20.04 and others. @g7fya Do you use the configuration provided in ungoogled-chromium-portable "as is" (using a debian docker image for build and make use of the "sysroot" feature )? If not, maybe you give it a try, or maybe you compare the settings (gn flags etc) with you local build

g7fya commented 4 months ago

@clickot Have you had such issue with portable?

usually

not for quite some time, but i started using the "sysroot" feature at some point, using toolchain and libs from prebuilt debian/bullseye packing provided by google. I the past I sometimes had "strange" compile or linking errors, which I assume came from the fact that the libs and tools versions on your local maschine do not match to what chromium build expects. Another effect of using sysroot is that you can be somewhat sure the build result (despite of bullseye itself of course) runs on "older" linux distros like ubuntu 20.04 and others. @g7fya Do you use the configuration provided in ungoogled-chromium-portable "as is" (using a debian docker image for build and make use of the "sysroot" feature )? If not, maybe you give it a try, or maybe you compare the settings (gn flags etc) with you local build

Well, I use CRUX Linux and the closest Distro is Arch Linux. Therefore, I went and looked at there AUR ungoogled-chromium and try to build again. However, no luck I got the same exact error

Note: building take well over 5 hours.

SRC=~/pkgs.d/ungoogled-chromium

 cd chromium-126.0.6478.126

declare -gA _system_libs=(
    [brotli]=brotli
    [dav1d]=dav1d
    #[ffmpeg]=ffmpeg    # YouTube playback stopped working in Chromium 120
    [flac]=flac
    [fontconfig]=fontconfig
    [freetype]=freetype2
    [harfbuzz-ng]=harfbuzz
    [icu]=icu
    #[jsoncpp]=jsoncpp  # needs libstdc++
    #[libaom]=aom
    #[libavif]=libavif  # needs https://github.com/AOMediaCodec/libavif/commit/5410b23f76
    [libdrm]=
    [libjpeg]=libjpeg
    [libpng]=libpng
    #[libvpx]=libvpx
    [libwebp]=libwebp
    [libxml]=libxml2
    [libxslt]=libxslt
    [opus]=opus
    #[re2]=re2          # needs libstdc++
    #[snappy]=snappy    # needs libstdc++
    #[woff2]=woff2      # needs libstdc++
    [zlib]=minizip
)
_unwanted_bundled_libs=(
    $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/')
)

        # Allow building against system libraries in official builds
        sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
            tools/generate_shim_headers/generate_shim_headers.py

        # https://crbug.com/893950
        sed -i -e 's/\<xmlMalloc\>/malloc/' -e 's/\<xmlFree\>/free/' \
                     -e '1i #include <cstdlib>' \
            third_party/blink/renderer/core/xml/*.cc \
            third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \
            third_party/libxml/chromium/*.cc \
            third_party/maldoca/src/maldoca/ole/oss_utils.h

        # Use the --oauth2-client-id= and --oauth2-client-secret= switches for
        # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
        # runtime -- this allows signing into Chromium without baked-in values
        patch -Np1 -i ../use-oauth2-client-switches-as-default.patch

        # Upstream fixes
        patch -Np1 -i ../allow-ANGLEImplementation-kVulkan.patch

        # Drop compiler flag that needs newer clang
        patch -Np1 -i ../drop-flag-unsupported-by-clang17.patch

        # Allow libclang_rt.builtins from compiler-rt >= 16 to be used
        patch -Np1 -i ../compiler-rt-adjust-paths.patch

        # Fixes for building with libstdc++ instead of libc++
        patch -Np1 -i ../chromium-patches-*/chromium-117-material-color-include.patch

        # Link to system tools required by the build
        mkdir -p third_party/node/linux/node-linux-x64/bin
        ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
        ln -s /usr/bin/java third_party/jdk/current/bin/

        if (( !_system_clang )); then
            # Use prebuilt rust as system rust cannot be used due to the error:
            #   error: the option `Z` is only accepted on the nightly compiler
            ./tools/rust/update_rust.py

            # To link to rust libraries we need to compile with prebuilt clang
            ./tools/clang/scripts/update.py
        fi

        # Ungoogled Chromium changes
        _ungoogled_repo="$SRC/ungoogled-chromium-126.0.6478.126-1"
        _utils="${_ungoogled_repo}/utils"
        echo ': Pruning binaries'
        python3 "$_utils/prune_binaries.py" ./ "$_ungoogled_repo/pruning.list"
        echo ': Applying patches'
        python3 "$_utils/patches.py" apply ./ "$_ungoogled_repo/patches"
        echo ': Applying domain substitution'
        python3 "$_utils/domain_substitution.py" apply -r "$_ungoogled_repo/domain_regex.list" \
            -f "$_ungoogled_repo/domain_substitution.list" -c domainsubcache.tar.gz ./

        # Remove bundled libraries for which we will use the system copies; this
        # *should* do what the remove_bundled_libraries.py script does, with the
        # added benefit of not having to list all the remaining libraries
        local _lib
        for _lib in ${_unwanted_bundled_libs[@]}; do
            find "third_party/$_lib" -type f \
                \! -path "third_party/$_lib/chromium/*" \
                \! -path "third_party/$_lib/google/*" \
                \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \
                \! -regex '.*\.\(gn\|gni\|isolate\)' \
                -delete
        done

        ./build/linux/unbundle/replace_gn_files.py \
            --system-libraries "${!_system_libs[@]}"

    cd $SRC
    make -C chromium-launcher-8

    cd chromium-126.0.6478.126

        if check_buildoption ccache y; then
            # Avoid falling back to preprocessor mode when sources contain time macros
            export CCACHE_SLOPPINESS=time_macros
        fi

        if (( _system_clang )); then
            export CC=clang
            export CXX=clang++
            #export AR=ar
            #export NM=nm
            export AR=llvm-ar
            export NM=llvm-nm
            echo here
            read f
        else
            local _clang_path="$PWD/third_party/llvm-build/Release+Asserts/bin"
            export CC=$_clang_path/clang
            export CXX=$_clang_path/clang++
            export AR=$_clang_path/llvm-ar
            export NM=$_clang_path/llvm-nm
        fi

        local _flags=(
            'custom_toolchain="//build/toolchain/linux/unbundle:default"'
            'host_toolchain="//build/toolchain/linux/unbundle:default"'
            'is_official_build=true' # implies is_cfi=true on x86_64
            'symbol_level=0' # sufficient for backtraces on x86(_64)
            'disable_fieldtrial_testing_config=true'
            'blink_enable_generated_code_formatting=false'
            'ffmpeg_branding="Chrome"'
            'proprietary_codecs=true'
            'rtc_use_pipewire=true'
            'link_pulseaudio=true'
            'use_custom_libcxx=true' # https://github.com/llvm/llvm-project/issues/61705
            'use_sysroot=false'
            'use_system_libffi=true'
            'enable_widevine=true'
            'use_qt6=true'
            'moc_qt6_path="/usr/lib/qt6"'
            'use_vaapi=true'
            'enable_platform_hevc=true'
            'enable_hevc_parser_and_hw_decoder=true'

            'custom_toolchain="//build/toolchain/linux/unbundle:default"'
            'host_toolchain="//build/toolchain/linux/unbundle:default"'
            'is_official_build=true'
            'symbol_level=0'
            'disable_fieldtrial_testing_config=true'
            'blink_enable_generated_code_formatting=false'
            'blink_symbol_level=0'
            'ffmpeg_branding="Chrome"'
            'proprietary_codecs=true'
            'fatal_linker_warnings=false'
            'rtc_use_pipewire=true'
            'is_clang=true'
            'is_debug=false'
            'use_kerberos=false'
            'use_sysroot=true'
            'use_vaapi=true'
            'use_system_libffi=false'
        )

        if [[ -n ${_system_libs[icu]+set} ]]; then
            _flags+=('icu_use_data_file=false')
        fi

        # Append ungoogled chromium flags to _flags array
        _ungoogled_repo="$SRC/ungoogled-chromium-126.0.6478.126-1"
        readarray -t -O ${#_flags[@]} _flags < "${_ungoogled_repo}/flags.gn"

        # See https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123
        CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt"
        CXXFLAGS="$CFLAGS"
        CTARGET="x86_64-pc-linux-gnu"

        if (( _system_clang )); then
            local _clang_version=$(
                clang --version | grep -m1 version | sed 's/.* \([0-9]\+\).*/\1/')

            _flags+=(
                'clang_base_path="/usr"'
                'clang_use_chrome_plugins=false'
                "clang_version=\"$_clang_version\""
                'chrome_pgo_phase=0' # needs newer clang to read the bundled PGO profile
            )

            # Allow the use of nightly features with stable Rust compiler
            # https://github.com/ungoogled-software/ungoogled-chromium/pull/2696#issuecomment-1918173198
            export RUSTC_BOOTSTRAP=1

            _flags+=(
                'rust_sysroot_absolute="/usr"'
                "rustc_version=\"$(rustc --version)\""
            )
        fi

        # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn)
        CFLAGS+='   -Wno-builtin-macro-redefined'
        CXXFLAGS+=' -Wno-builtin-macro-redefined'
        CPPFLAGS+=' -D__DATE__=  -D__TIME__=  -D__TIMESTAMP__='

        # Do not warn about unknown warning options
        CFLAGS+='   -Wno-unknown-warning-option'
        CXXFLAGS+=' -Wno-unknown-warning-option'

        # Let Chromium set its own symbol level
        CFLAGS=${CFLAGS/-g }
        CXXFLAGS=${CXXFLAGS/-g }
        # -fvar-tracking-assignments is not recognized by clang
        CFLAGS=${CFLAGS/-fvar-tracking-assignments}
        CXXFLAGS=${CXXFLAGS/-fvar-tracking-assignments}

        # https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123
        CFLAGS=${CFLAGS/-fexceptions}
        CFLAGS=${CFLAGS/-fcf-protection}
        CXXFLAGS=${CXXFLAGS/-fexceptions}
        CXXFLAGS=${CXXFLAGS/-fcf-protection}

        # This appears to cause random segfaults when combined with ThinLTO
        # https://bugs.archlinux.org/task/73518
        CFLAGS=${CFLAGS/-fstack-clash-protection}
        CXXFLAGS=${CXXFLAGS/-fstack-clash-protection}

        # https://crbug.com/957519#c122
        CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}

        echo ': Configuring Chromium'
        gn gen out/Release --args="${_flags[*]}"
    #gn gen out/Release --args="$(paste -d= <(printf "%s\n" "${!_flags[@]}") <(printf "%s\n" "${_flags[@]}") |tr '\n' ' ')" --script-executable=/usr/bin/python2

        echo ': Building Chromium'
        ninja -C out/Release chrome chrome_sandbox chromedriver
PF4Public commented 4 months ago

@networkException maybe you have any idea on what this may be?

networkException commented 4 months ago

I fear not really, I'm happy when I don't have to deal with build system issues and if I have to its usually in familiar territory.

Perhaps our generic build instructions would work on CRUX? I rarely use those tbh

Ahrotahn commented 4 months ago

I'm not familiar with your setup, but is setting CTARGET necessary?
If so you may also need to change the rust target to match:

--- a/build/config/rust.gni
+++ b/build/config/rust.gni
@@ -189,7 +189,7 @@
   } else if (current_cpu == "x86") {
     rust_abi_target = "i686-unknown-linux-gnu"
   } else if (current_cpu == "x64") {
-    rust_abi_target = "x86_64-unknown-linux-gnu"
+    rust_abi_target = "x86_64-pc-linux-gnu"
   } else if (current_cpu == "arm") {
     if (arm_float_abi == "hard") {
       float_suffix = "hf"
g7fya commented 4 months ago

I fear not really, I'm happy when I don't have to deal with build system issues and if I have to its usually in familiar territory.

Perhaps our generic build instructions would work on CRUX? I rarely use those tbh

my first try was the generic build instructions and when it did not work i looked into Archlinux and I got the same exact error.

g7fya commented 4 months ago

I'm not familiar with your setup, but is setting CTARGET necessary? If so you may also need to change the rust target to match:

--- a/build/config/rust.gni
+++ b/build/config/rust.gni
@@ -189,7 +189,7 @@
   } else if (current_cpu == "x86") {
     rust_abi_target = "i686-unknown-linux-gnu"
   } else if (current_cpu == "x64") {
-    rust_abi_target = "x86_64-unknown-linux-gnu"
+    rust_abi_target = "x86_64-pc-linux-gnu"
   } else if (current_cpu == "arm") {
     if (arm_float_abi == "hard") {
       float_suffix = "hf"

no luck and got the same error.

PF4Public commented 4 months ago

Could the binaries be pre-built (with incompatible arch) and downloaded as a part of build process?

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale as there has been no recent activity in response to our request for more information. Please respond so that we can proceed with this issue.

github-actions[bot] commented 2 months ago

This issue has been automatically closed as sufficient information hasn't been provided on the issue for further actions to be taken. Feel free to add more information.