ungoogled-software / ungoogled-chromium

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

70.0.3538.77-1 doesn't build on Debian Buster #569

Closed kabo closed 5 years ago

kabo commented 5 years ago

Description

70.0.3538.77-1 doesn't build on Debian Buster

Console output and logs

$ nice -n 19 dpkg-buildpackage -b -uc
[...]
ninja -j4 -C out/Default chrome chrome_sandbox content_shell chromedriver
ninja: Entering directory `out/Default'
[14/19007] CXX obj/base/base_static/base_switches.o
warning: unknown warning option '-Wno-ignored-pragma-optimize'; did you mean '-Wno-ignored-pragma-intrinsic'? [-Wunknown-warning-option]
1 warning generated.
[15/19007] AR obj/base/libbase_static.a
FAILED: obj/base/libbase_static.a
rm -f obj/base/libbase_static.a && "llvm-ar-6.0" -T -r -c -s -D obj/base/libbase_static.a @"obj/base/libbase_static.a.rsp"
llvm-ar-6.0: Unknown command line argument '-r'.  Try: 'llvm-ar-6.0 -help'
llvm-ar-6.0: Did you mean '-M'?
llvm-ar-6.0: Unknown command line argument '-c'.  Try: 'llvm-ar-6.0 -help'
llvm-ar-6.0: Did you mean '-M'?
llvm-ar-6.0: Unknown command line argument '-s'.  Try: 'llvm-ar-6.0 -help'
llvm-ar-6.0: Did you mean '-M'?
llvm-ar-6.0: Unknown command line argument '-D'.  Try: 'llvm-ar-6.0 -help'
llvm-ar-6.0: Did you mean '-M'?
[16/19007] CC obj/base/third_party/dynamic_annotations/dynamic_annotations/dynamic_annotations.o
warning: unknown warning option '-Wno-ignored-pragma-optimize'; did you mean '-Wno-ignored-pragma-intrinsic'? [-Wunknown-warning-option]
1 warning generated.
[17/19007] CXX obj/base/third_party/symbolize/symbolize/demangle.o
warning: unknown warning option '-Wno-ignored-pragma-optimize'; did you mean '-Wno-ignored-pragma-intrinsic'? [-Wunknown-warning-option]
1 warning generated.
[18/19007] CXX obj/base/third_party/symbolize/symbolize/symbolize.o
warning: unknown warning option '-Wno-ignored-pragma-optimize'; did you mean '-Wno-ignored-pragma-intrinsic'? [-Wunknown-warning-option]
1 warning generated.
ninja: build stopped: subcommand failed.
make[1]: *** [debian/rules:89: override_dh_auto_build-arch] Error 1
make[1]: Leaving directory '/home/kabo/Downloads/ungoogled-chromium-70.0.3538.77-1/build/src'
make: *** [debian/rules:68: binary] Error 2

Environment details

I was able to build 69.0.3497.100-1 a while back just fine.

Do I need to upgrade to a newer version of LLVM (7.0)?

Building and packaging steps

I downloaded the .tar.gz, unpacked it, ran

mkdir -p build/src
./get_package.py debian_buster build/src/debian
cd build/src
dpkg-checkbuilddeps # returned with exit code 0
debian/rules setup-local-src
dpkg-buildpackage -b -uc
Eloston commented 5 years ago

Do I need to upgrade to a newer version of LLVM (7.0)?

That might be the solution. It's likely that LLVM 6.0 is too old; aside from the obvious llvm-ar-6.0 errors, it seems clang 6.0 doesn't know about -Wno-ignored-pragma-optimize.

You can try installing clang-7.0, lld-7.0, and llvm-7.0-dev; then, update debian/rules (after generating the packaging) with the 7.0 equivalents of the LLVM commands.

kabo commented 5 years ago

Got a different error at least.

ninja -j4 -C out/Default chrome chrome_sandbox content_shell chromedriver
ninja: Entering directory `out/Default'
[3/19007] CC obj/base/third_party/dynamic_annotations/dynamic_annotations/dynamic_annotations.o
FAILED: obj/base/third_party/dynamic_annotations/dynamic_annotations/dynamic_annotations.o
clang-7 -MMD -MF obj/base/third_party/dynamic_annotations/dynamic_annotations/dynamic_annotations.o.d -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DOFFICIAL_BUILD -DCHROMIUM_BUILD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNO_UNWIND_TABLES -D_GNU_SOURCE -DCR_CLANG_REVISION=\"340925-1\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../.. -Igen -fprofile-sample-use=../../chrome/android/profiles/afdo.prof -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -flto=thin -fwhole-program-vtables -m64 -march=x86-64 -Wall -Wextra -Wimplicit-fallthrough -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-user-defined-warnings -Wno-unused-lambda-capture -Wno-null-pointer-arithmetic -Wno-enum-compare-switch -Wno-ignored-pragma-optimize -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g0 -fsanitize=cfi-vcall -fsanitize-blacklist=../../tools/cfi/blacklist.txt -fsanitize=cfi-icall -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -std=c11 -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/home/kabo/Downloads/ungoogled-chromium-70.0.3538.77-1/build/src=. -fstack-protector-strong -Wformat -Werror=format-security -c ../../base/third_party/dynamic_annotations/dynamic_annotations.c -o obj/base/third_party/dynamic_annotations/dynamic_annotations/dynamic_annotations.o
clang-7: error: no such file or directory: '/usr/lib/clang/7.0.0/share/cfi_blacklist.txt'
[5/19007] CXX obj/base/base_static/base_switches.o
FAILED: obj/base/base_static/base_switches.o
clang++-7 -MMD -MF obj/base/base_static/base_switches.o.d -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DOFFICIAL_BUILD -DCHROMIUM_BUILD -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNO_UNWIND_TABLES -D_GNU_SOURCE -DCR_CLANG_REVISION=\"340925-1\" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../.. -Igen -fprofile-sample-use=../../chrome/android/profiles/afdo.prof -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -flto=thin -fwhole-program-vtables -m64 -march=x86-64 -Wall -Wextra -Wimplicit-fallthrough -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-user-defined-warnings -Wno-unused-lambda-capture -Wno-null-pointer-arithmetic -Wno-enum-compare-switch -Wno-ignored-pragma-optimize -fno-omit-frame-pointer -g0 -fsanitize=cfi-vcall -fsanitize-blacklist=../../tools/cfi/blacklist.txt -fsanitize=cfi-icall -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -O2 -fno-ident -fdata-sections -ffunction-sections -std=c++14 -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -Wdate-time -D_FORTIFY_SOURCE=2 -Wno-pedantic -Wno-unused-function -Wno-unused-variable -Wno-deprecated-declarations  -Wno-return-type  -Wno-pedantic -Wno-unused-function -Wno-unused-variable -Wno-deprecated-declarations  -Wno-return-type  -c ../../base/base_switches.cc -o obj/base/base_static/base_switches.o
clang++-7: error: no such file or directory: '/usr/lib/clang/7.0.0/share/cfi_blacklist.txt'
[6/19007] ACTION //base:base__jumbo_merge(//build/toolchain/linux/unbundle:default)
ninja: build stopped: subcommand failed.
make[1]: *** [debian/rules:89: override_dh_auto_build-arch] Error 1
make[1]: Leaving directory '/home/kabo/Downloads/ungoogled-chromium-70.0.3538.77-1/build/src'
make: *** [debian/rules:68: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
kabo commented 5 years ago

That file seems to be located here for me

/usr/lib/llvm-7/lib/clang/7.0.0/share/cfi_blacklist.txt
ghost commented 5 years ago

I got a similar report a few weeks ago. The solution seems to either create a symlink or pass the environment variable EXTRA_GN="clang_use_default_sample_profile=false is_cfi=false". Personally, I don't recommend the latter.

kabo commented 5 years ago

yup, setting up symlink and editing debian/rules to use llvm and clang 7 seems to work better. letting it compile over night, fingers crossed :)

Eloston commented 5 years ago

@ian-moone Do you know what defines the path to cfi_blacklist.txt? Is it a GN file?

ghost commented 5 years ago

I'm not sure, but if I have to guess, this isn't Chromium's fault (or something that should be defined by it), but it's the Clang/LLVM that is not properly configured.

_Assuming that this is CFI, if you're using a custom build of Clang it's possible that your LLVM build tree does not have a copy of the cfi_blacklist.txt file (its absence would cause a number of binaries to fail like that). To copy it into place you can try building the cfiblackilst target in LLVM, cleaning your Chromium build tree and rebuilding. - source

Here is a blog post that also mention the GN flags I commented earlier.

A side note, the user that reported similar issue, uses same distro as mine and likewise, used the same ebuild, that's why I think he borked his Clang/LLVM somewhere, because so far I haven't experienced that issue.

kabo commented 5 years ago

Next error

In file included from gen/content/test/test_support_jumbo_1.cc:19:
In file included from ./../../content/public/test/browser_test_base.cc:37:
../../content/public/test/browser_test_utils.h:608:24: error: unknown type name 'nullptr_t'; did you mean 'std::nullptr_t'?
inline bool operator==(nullptr_t a, const EvalJsResult& b) {
                       ^~~~~~~~~
                       std::nullptr_t
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8/bits/c++config.h:242:29: note: 'std::nullptr_t' declared here
  typedef decltype(nullptr)     nullptr_t;
                                ^
1 error generated.
ninja: build stopped: subcommand failed.
make[1]: *** [debian/rules:89: override_dh_auto_build-arch] Error 1
make[1]: Leaving directory '/home/kabo/Downloads/ungoogled-chromium-70.0.3538.77-1/build/src'
make: *** [debian/rules:68: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
kabo commented 5 years ago

build/src/build_overrides/build.gni, line 30 has cfi_blacklist_path commented out, presumably one can set a custom path there?

kabo commented 5 years ago

Also, when I try building again I get this error.

$ dpkg-buildpackage -b -uc
dpkg-buildpackage: info: source package ungoogled-chromium-browser
dpkg-buildpackage: info: source version 70.0.3538.77-1~buster
dpkg-buildpackage: info: source distribution buster
dpkg-buildpackage: info: source changed by ungoogled-chromium Authors <maintainer@null>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 debian/rules clean
dh clean
   debian/rules override_dh_auto_clean
make[1]: Entering directory '/home/kabo/Downloads/ungoogled-chromium-70.0.3538.77-1/build/src'
rm -rf out
find . -name \*.pyc -execdir rm -f {} \;
dh_auto_clean
make[1]: Leaving directory '/home/kabo/Downloads/ungoogled-chromium-70.0.3538.77-1/build/src'
   dh_clean
        rm -f debian/debhelper-build-stamp
        cp -an --reflink=auto debian/.debhelper/bucket/files/2e278c39be4815452f1c227f7b1e818267e3c3f25dc95e87868dae2bbba6dae2 debian/.debhelper/bucket/files/2e278c39be4815452f1c227f7b1e818267e3c3f25dc95e87868dae2bbba6dae2.tmp
        mv debian/.debhelper/bucket/files/2e278c39be4815452f1c227f7b1e818267e3c3f25dc95e87868dae2bbba6dae2.tmp third_party/sqlite/src/config.guess
        cp -an --reflink=auto debian/.debhelper/bucket/files/2e278c39be4815452f1c227f7b1e818267e3c3f25dc95e87868dae2bbba6dae2 debian/.debhelper/bucket/files/2e278c39be4815452f1c227f7b1e818267e3c3f25dc95e87868dae2bbba6dae2.tmp
        mv debian/.debhelper/bucket/files/2e278c39be4815452f1c227f7b1e818267e3c3f25dc95e87868dae2bbba6dae2.tmp third_party/sqlite/sqlite-src-3240000/config.guess
        cp -an --reflink=auto debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b.tmp
        mv debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b.tmp third_party/yasm/source/patched-yasm/config/config.guess
dh_clean: mv debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b.tmp third_party/yasm/source/patched-yasm/config/config.guess: No such file or directory
make: *** [debian/rules:68: clean] Error 2
dpkg-buildpackage: error: debian/rules clean subprocess returned exit status 2
kabo commented 5 years ago

Changing nullptr_t to std::nullptr_t worked. Compiled, installs, and runs fine

perfect7gentleman commented 5 years ago

@ian-moone, with what flags have you llvm/clang compiled ?

ghost commented 5 years ago

with what flags have you llvm/clang compiled ?

sys-devel/llvm-7.0.0-r1::gentoo was built with the following:
USE="gold libffi ncurses xml -debug -doc -exegesis -libedit -test -xar" LLVM_TARGETS="AMDGPU BPF (X86) -AArch64 -ARM -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -Sparc -SystemZ -XCore"
CFLAGS="-O3 -march=native -pipe"
CXXFLAGS="-O3 -march=native -pipe -stdlib=libc++"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--icf=all -fuse-ld=lld -rtlib=compiler-rt -lc++abi"

sys-devel/clang-7.0.0::gentoo was built with the following:
USE="static-analyzer xml -debug -default-compiler-rt -default-libcxx -doc -test (-z3)" LLVM_TARGETS="AMDGPU BPF (X86) -AArch64 -ARM -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -Sparc -SystemZ -XCore" PYTHON_TARGETS="python2_7"
CFLAGS="-O3 -march=native -pipe"
CXXFLAGS="-O3 -march=native -pipe -stdlib=libc++"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--icf=all -fuse-ld=lld -rtlib=compiler-rt -lc++abi"
perfect7gentleman commented 5 years ago

I got

sys-devel/llvm-7.0.0-r1::gentoo was built with the following:
USE="gold libffi ncurses -debug -doc -exegesis -libedit -test -xar -xml" LLVM_TARGETS="(X86) -AArch64 -AMDGPU -ARM -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -Sparc -SystemZ -XCore"
CFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer -fno-stack-protector -flto=thin"
CXXFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer -fno-stack-protector -flto=thin -stdlib=libc++"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--strip-debug -flto=thin -Wl,--thinlto-jobs=9 -fuse-ld=lld"

sys-devel/clang-7.0.0::gentoo was built with the following:
USE="default-compiler-rt default-libcxx -debug -doc -static-analyzer -test -xml (-z3)" LLVM_TARGETS="(X86) -AArch64 -AMDGPU -ARM -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -Sparc -SystemZ -XCore" PYTHON_TARGETS="python2_7"
CFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer -fno-stack-protector -flto=thin"
CXXFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer -fno-stack-protector -flto=thin -stdlib=libc++"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--strip-debug -flto=thin -Wl,--thinlto-jobs=9 -fuse-ld=lld"

I think that USE=static-analyzer makes use of cfi possible.

ghost commented 5 years ago

I think that USE=static-analyzer makes use of cfi possible.

Hmm. I'm not so sure. Anyways, this page gives more insight about it: https://clang.llvm.org/docs/ControlFlowIntegrity.html

Edit: Do you have sys-libs/compiler-rt-sanitizers installed? It is pulled by sys-devel/clang-runtime[sanitize], which has the following description "Enable compiler-rt sanitizer (-fsanitize*) support".

perfect7gentleman commented 5 years ago
sys-devel/clang-runtime-7.0.0:7.0.0::gentoo  USE="compiler-rt libcxx openmp -crt -sanitize"

what do you have there?

ghost commented 5 years ago

Please try it and report back. Perhaps that's the culprit.

what do you have there?

USE="compiler-rt libcxx openmp sanitize -crt"

perfect7gentleman commented 5 years ago
x86_64-pc-linux-gnu-clang++: error: no such file or directory: '/usr/lib/llvm/7/bin/../../../../lib/clang/7.0.0/share/cfi_blacklist.txt'
ghost commented 5 years ago

Then do a symlink, as a temporary workaround, like the OP did. Could be a bug in the packaging. IMO, it's much better than disabling cfi altogether, giving the fact that -lto will be used anyway.

perfect7gentleman commented 5 years ago

There is no such file in the system.

ghost commented 5 years ago

There is no such file in the system.

I have it, in the exact path you pointed out. But the strange thing is that, the file do not belong (equery b) to any package. So it was generated outside portage's sandbox. 😕

Perhaps you should file a bug report to Clang/LLVM maintainers in Gentoo's main tree.

perfect7gentleman commented 5 years ago

I don't think it's LLVM/Clang bug as if there is no sanitizer (cfi) support, imo cfi_blacklist.txt should not be generated.

ghost commented 5 years ago

But the strange thing is that, the file do not belong (equery b) to any package. So it was generated outside portage's sandbox.

I don't think it's LLVM/Clang bug as if there is no sanitizer (cfi) support, imo cfi_blacklist.txt should not be generated.

My mistake. I had to install Clang in another machine, I can confirm that cfi_blacklist.txt indeed belongs to sys-libs/compiler-rt-sanitizers:

equery b /usr/lib/clang/7.0.0/share/cfi_blacklist.txt
 * Searching for /usr/lib/clang/7.0.0/share/cfi_blacklist.txt ... 
sys-libs/compiler-rt-sanitizers-7.0.0 (/usr/lib/clang/7.0.0/share/cfi_blacklist.txt)
Eloston commented 5 years ago

So to fix building on Debian Buster, we need to

Is this correct @kabo?

kabo commented 5 years ago

@Eloston I symlinked cfi_blacklist.txt instead of changing the builb_overrides, so can't confirm that. With llvm7, cfi_blacklist.txt symlinked and the std::nullptr_t patch I got it to build.

Eloston commented 5 years ago

@kabo I see, thanks for the info. I'll try setting the GN flag for the next release and see if it works.

Eloston commented 5 years ago

Currently working on 70.0.3538.110 for Debian/Ubuntu, and I suspect current_toolchain != default_toolchain in build/config/sanitizers/BUILD.gn, which is preventing cfi_blacklist_path from being set. I'm not sure why this is the case, because there was another location where set_default_toolchain() is called on custom_toolchain if it is provided (which is the unbundle toolchain in our GN config). Perhaps default_toolchain and set_default_toolchain() are not related?

I'm going to keep experimenting and see what I find.

Eloston commented 5 years ago

This should be fixed. A new tag will come out soon.

bill-mcgonigle commented 5 years ago

After updating 022468b..00fe212, everything is working right except:

dpkg: error processing archive ungoogled-chromium-l10n_70.0.3538.110-1~buster_all.deb (--install):
 trying to overwrite '/usr/lib/chromium/locales/en-US.pak', which is also in package ungoogled-chromium 70.0.3538.110-1~buster

--force overwrite works, and a quick smoketest looks good. Thanks!

Eloston commented 5 years ago

@bill-mcgonigle Thanks for letting me know. I guess my assumptions were wrong; Debian packaging is quite the process.