google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.74k stars 1.88k forks source link

Build problem on clang 15.0.7 or 14.0.6 on Arch Linux #6971

Closed dusanx closed 1 year ago

dusanx commented 1 year ago

Describe the bug Trying to build latest filament, main branch, latest commit 0e31d6936, on Arch results in compile error in libs/utils/include/utils/JobSystem.h that prevents building.

To Reproduce Steps to reproduce the behavior:

  1. In empty folder
  2. git clone https://github.com/google/filament.git .
  3. ./build.sh -c
  4. CC=/usr/bin/clang CXX=/usr/bin/clang++ ./build.sh -p desktop -i release
  5. Build crashes with .../filament/libs/utils/include/utils/JobSystem.h:200:35: error: loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Werror,-Wpass-failed=transform-warning] Job* job = create(parent, [](void* user, JobSystem& js, Job* job){

Expected behavior build.sh to finish building desktop/release

Logs

filament > ./build.sh -c

Cleaning build directories...

filament > ./build.sh -p desktop -i release

Building release in out/cmake-release...
-- The C compiler identification is Clang 15.0.7
-- The CXX compiler identification is Clang 15.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /usr/bin/clang
-- DFG LUT size set to 128x128
-- Found Python3: /usr/bin/python3.11 (found version "3.11.3") found components: Interpreter
-- Configuring done (1.1s)
-- Generating done (0.1s)
-- Build files have been written to: /home/dusanx/desktop/xx/git/filament/out/cmake-release
[1235/1376] Building CXX object filament/CMakeFiles/filament.dir/src/details/ColorGrading.cpp.o
FAILED: filament/CMakeFiles/filament.dir/src/details/ColorGrading.cpp.o
/home/dusanx/desktop/xx/git/filament/out/cmake-release/launch-cxx /usr/bin/clang++ -DFILAMENT_DFG_LUT_SIZE=128 -DFILAMENT_DRIVER_SUPPORTS_VULKAN -DFILAMENT_ENABLE_MATDBG=0 -DFILAMENT_IBL_LITE=1 -DFILAMENT_METAL_HANDLE_ARENA_SIZE_IN_MB=8 -DFILAMENT_MIN_COMMAND_BUFFERS_SIZE_IN_MB=2 -DFILAMENT_OPENGL_HANDLE_ARENA_SIZE_IN_MB=4 -DFILAMENT_PER_FRAME_COMMANDS_SIZE_IN_MB=2 -DFILAMENT_PER_RENDER_PASS_ARENA_SIZE_IN_MB=3 -DFILAMENT_SUPPORTS_OPENGL -DFILAMENT_SUPPORTS_X11 -DFILAMENT_SUPPORTS_XCB -DFILAMENT_SUPPORTS_XLIB -DSYSTRACE_TAG=2 -I/home/dusanx/desktop/xx/git/filament/filament/include -I/home/dusanx/desktop/xx/git/filament/out/cmake-release/filament -I/home/dusanx/desktop/xx/git/filament/filament/src -I/home/dusanx/desktop/xx/git/filament/filament/backend/include -I/home/dusanx/desktop/xx/git/filament/libs/math/include -I/home/dusanx/desktop/xx/git/filament/libs/utils/include -I/home/dusanx/desktop/xx/git/filament/third_party/robin-map/tnt/..-I/home/dusanx/desktop/xx/git/filament/libs/bluevk/include -I/home/dusanx/desktop/xx/git/filament/third_party/vkmemalloc/tnt/../include -I/home/dusanx/desktop/xx/git/filament/third_party/smol-v/tnt/../source -I/home/dusanx/desktop/xx/git/filament/libs/filaflat/include -I/home/dusanx/desktop/xx/git/filament/libs/filabridge/include -I/home/dusanx/desktop/xx/git/filament/libs/ibl/include -fno-builtin -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -stdlib=libc++ -fPIC -fcolor-diagnostics -fvisibility=hidden -O3 -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections -Wall -Wextra -Wno-unused-parameter -Wextra-semi -Wnewline-eof -Wdeprecated -Wundef -Wgnu-conditional-omitted-operand -Wweak-vtables -Wnon-virtual-dtor -Wclass-varargs -Wimplicit-fallthrough -Wover-aligned -Werror -ffast-math -fno-finite-math-only -ffp-contract=fast -fvisibility-inlines-hidden -fstrict-vtable-pointers-MD -MT filament/CMakeFiles/filament.dir/src/details/ColorGrading.cpp.o -MF filament/CMakeFiles/filament.dir/src/details/ColorGrading.cpp.o.d -o filament/CMakeFiles/filament.dir/src/details/ColorGrading.cpp.o -c /home/dusanx/desktop/xx/git/filament/filament/src/details/ColorGrading.cpp
In file included from /home/dusanx/desktop/xx/git/filament/filament/src/details/ColorGrading.cpp:19:
In file included from /home/dusanx/desktop/xx/git/filament/filament/src/details/Engine.h:74:
/home/dusanx/desktop/xx/git/filament/libs/utils/include/utils/JobSystem.h:200:35: error: loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Werror,-Wpass-failed=transform-warning]
        Job* job = create(parent, [](void* user, JobSystem& js, Job* job){
                                  ^
1 error generated.
[1248/1376] Building CXX object filament/CMakeFiles/filament.dir/src/details/Scene.cpp.o
ninja: build stopped: subcommand failed.

Desktop (please complete the following information):

Additional context Filament was successfully building on Arch before, so this is caused by Arch clang version or filament progression. Same happens on both latest clang available on Arch (15.0.7) and earlier (14.0.6) which is earliest easy to install on Arch.

romainguy commented 1 year ago

I've never seen this issue before, and there's no problem with clang 14.0.3 on macOS at lest.

dusanx commented 1 year ago

I can't easily downgrade past 14.0.6 on Arch to test. If I comment out that function body at line 200 to test, everything else builds perfectly, so the only issue I have is at libs/utils/include/utils/JobSystem.h:200:35.

If there is something I could test on this end I'd gladly do it.

poweifeng commented 1 year ago

I tried to repro, but was not able to. I used ubuntu and clang-15.

You can try clang-14 by installing clang-14 (no downgrade needed) and then.

CC=/usr/bin/clang-14 CXX=/usr/bin/clang++-14 ./build.sh -p desktop -i release
dusanx commented 1 year ago

I can confirm that pulling latest main branch, git clone on empty folder, currently on commit 626577fe3, now builds well on both 14.0.6 and 15.0.7 on Arch Linux. Thank you.

dusanx commented 1 year ago

I had to debug this to understand, actual reason for that error is my build script sourcing other build script that had

export CXXFLAGS=-fno-builtin

required for other project. That export and nothing else makes filament build to fail, so nothing to do with filament. Thank you for your time, definitely resolved.