HandBrake icon indicating copy to clipboard operation
HandBrake copied to clipboard

Unable to build Handbrake with llvm-15/clang-15 on linux

Open StatusCode404 opened this issue 3 years ago • 3 comments

Problem Description

Unable to build Handbrake with llvm-15/clang-15 on linux.

I'm able to build it without problems on llvm-14/clang-14 on linux.

I'm building to generate FDO/PGO data

These are my build options in the custom.defs file: GCC.args.O.speed = -fasynchronous-unwind-tables -fno-semantic-interposition -fno-trapping-math -ffat-lto-objects -march=native -mtune=native -pipe -O3 GCC.args.extra = -w -feliminate-unused-debug-types -fstack-protector-strong -fstack-clash-protection -D_FORTIFY_SOURCE=2 -fPIE -pie -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wp,-D_GLIBCXX_ASSERTIONS -fprofile-instr-generate=<path-hidden>/HandBrake/clangFDO/default_%m.profraw -fprofile-update=atomic -flto=thin

This is my build command line: LDFLAGS="-fuse-ld=lld" ./configure --ld /usr/bin/ld.lld --ar /usr/bin/llvm-ar --ranlib /usr/bin/llvm-ranlib --strip /usr/bin/llvm-strip --cc /usr/bin/clang --optimize=speed --enable-fdk-aac --disable-nvenc --build=build-v1.5.1-CLANG && cd ./build-v1.5.1-CLANG && time LDFLAGS="-fuse-ld=lld" make -j$(( $(nproc) + 2 ));

With llvm-14 and clang-14 as mentioned, I can build smoothly using the options and command line above. However with version 15 I get the following errors: bfd plugin: LLVM gold plugin has failed to create LTO module: Not an int attribute (Producer: 'LLVM15.0.3' Reader: 'LLVM 13.0.1') LLVM ERROR: Type mismatch in constant table!

Also not sure why bfd plugin is triggering the use of the gold linker. I've explicitly added "-fuse-ld=lld". Any help here would be greatly appreciated thanks in advance!

Activity Log, Crash Log or any other details

bfd plugin: LLVM gold plugin has failed to create LTO module: Not an int attribute (Producer: 'LLVM15.0.3' Reader: 'LLVM 13.0.1')
bfd plugin: LLVM gold plugin has failed to create LTO module: Not an int attribute (Producer: 'LLVM15.0.3' Reader: 'LLVM 13.0.1')
LLVM ERROR: Type mismatch in constant table!
./libtool: line 1733: 1964324 Aborted

What Operating System are you running?

Ubuntu 22.04

What version of HandBrake are you running?

1.5.1

Where did you download HandBrake from?

github

StatusCode404 avatar Nov 08 '22 04:11 StatusCode404

This reminds me to the Clang error I'm seeing if I try to build with -flto=thin on macOS with current Xcode. If its the same reason, then its because x264 does set -mstack-alignment=64 in configure, FFmpeg does set -mstack-alignment=16 and this seems to be a conflict when linking. There was a change in the recent Clang/LLVM which does makes this now an error.

Can you try to build with your build options and build commands from this branch: https://github.com/Nomis101/HandBrake/tree/mstack-test

It this does fix your issue, it is the same reason, if not, its a different one.

Nomis101 avatar Nov 11 '22 08:11 Nomis101

May very well be! I can't build with the fork atm as I'm in the midst of doing a FDO generation of several videos of various qualities with llvm-14. Takes several days. Once done I'll try llvm-15 again.

If it does the trick then perhaps you should try and get it into upstream to at least get the discussion going.

StatusCode404 avatar Nov 12 '22 05:11 StatusCode404

Still relevant ?

luzpaz avatar Jan 13 '24 11:01 luzpaz