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

webgl build appears to be failing again #7013

Closed unicomp21 closed 1 year ago

unicomp21 commented 1 year ago

1352.0 [ 7%] Linking CXX static library libibl-lite.a 1352.2 [ 7%] Built target ibl-lite 1352.2 [ 7%] Building CXX object filament/backend/CMakeFiles/backend.dir/src/BackendUtils.cpp.o 1352.8 In file included from /filament/filament/backend/src/BackendUtils.cpp:17: 1352.8 In file included from /filament/filament/backend/include/private/backend/BackendUtils.h:20: 1352.8 In file included from /filament/filament/backend/include/backend/DriverEnums.h:29: 1352.8 In file included from /filament/libs/math/include/math/vec4.h:20: 1352.8 /filament/libs/math/include/math/half.h:163:35: error: identifier '_h' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator] 1352.8 163 | inline constexpr half operator "" _h(long double v) { 1352.8 | ~~~~^~ 1352.8 | operator""_h 1352.9 1 error generated. 1352.9 em++: error: '/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN --sysroot=/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -DFILAMENT_DFG_LUT_SIZE=64 -DFILAMENT_ENABLE_MATDBG=0 -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_TARGET_MOBILE=1 -DSYSTRACE_TAG=2 -I/filament/filament/include -I/filament/out/cmake-webgl-release/filament -I/filament/filament/src -I/filament/filament/backend/include -I/filament/filament/backend/src -I/filament/out/cmake-webgl-release/filament/backend -I/filament/libs/math/include -I/filament/libs/utils/include -I/filament/third_party/robin-map/tnt/.. -std=c++17 -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations -fvisibility=hidden -O3 -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables -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 -fvisibility-inlines-hidden -MD -MT filament/backend/CMakeFiles/backend.dir/src/BackendUtils.cpp.o -MF CMakeFiles/backend.dir/src/BackendUtils.cpp.o.d -c /filament/filament/backend/src/BackendUtils.cpp -o CMakeFiles/backend.dir/src/BackendUtils.cpp.o' failed (returned 1) 1352.9 make[2]: [filament/backend/CMakeFiles/backend.dir/build.make:77: filament/backend/CMakeFiles/backend.dir/src/BackendUtils.cpp.o] Error 1 1352.9 make[1]: [CMakeFiles/Makefile2:1583: filament/backend/CMakeFiles/backend.dir/all] Error 2 1352.9 make: *** [Makefile:136: all] Error 2

failed to solve: process "/bin/sh -c ./build.sh -p webgl release" did not complete successfully: exit code: 2

unicomp21 commented 1 year ago

Start from a Ubuntu image with the latest version of Ubuntu

FROM debian:latest

Update and upgrade Ubuntu packages

RUN apt-get update && apt-get upgrade -y

Install necessary packages (libglu1-mesa-dev vs libgl-dev)

RUN apt-get install -y git python3 cmake build-essential clang llvm libc++-dev libc++abi-dev libgl-dev

Set Clang as default C and C++ compiler

RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100

Clone and build Emscripten

WORKDIR / RUN git clone https://github.com/emscripten-core/emsdk.git WORKDIR /emsdk RUN ./emsdk install latest RUN ./emsdk activate latest

Set up Emscripten environment variables

ENV EMSDK=/emsdk ENV EM_CONFIG=/emsdk/.emscripten ENV EM_CACHE=/emsdk/cache ENV EM_PORTS=/emsdk/ports

Add emscripten to PATH

ENV PATH="/emsdk:${PATH}" ENV PATH="/emsdk/upstream/emscripten:${PATH}" ENV PATH="/emsdk/node/16.20.0_64bit/bin:${PATH}"

Copy Filament into the Docker container

COPY ./filament /filament

Build Filament

WORKDIR /filament RUN ./build.sh -p webgl release

unicomp21 commented 1 year ago

here is a link to the dockerfile for repro, it appears emscripten has deprecated something?

https://gist.github.com/unicomp21/0cf25c49e2c9f22caf8ee1b32d5d8cbd

poweifeng commented 1 year ago

Can you try building outside of docker? I just did and had no issue building for web. If it works outside of docker, I'd check what is the difference between the two. Thanks.

unicomp21 commented 1 year ago

What clang, emscripten versions, etc. were being used? I'm seeing the break w/ newer versions.

On Mon, Jul 31, 2023 at 5:05 PM Powei Feng @.***> wrote:

Can you try building outside of docker? I just did and had no issue building for web. If it works outside of docker, I'd check what is the difference between the two. Thanks.

— Reply to this email directly, view it on GitHub https://github.com/google/filament/issues/7013#issuecomment-1659253273, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFL7IM7GXHEQGC6V4STIDXTAT2NANCNFSM6AAAAAA23PH7JY . You are receiving this because you authored the thread.Message ID: @.***>

unicomp21 commented 1 year ago

@poweifeng are you able to run the dockerfile an repro? if not, let me know and i'll help.

in a directory containing dockerfile: docker build -t filament .

poweifeng commented 1 year ago

Here's a working dockerfile: https://gist.github.com/poweifeng/d1be776a94b1c426dc492c95a96ea3a8

One additional comment is that we're not really resourced to debug docker issues, but if you follow the linux build instructions, you should be able to set up a build in a container with little effort.

unicomp21 commented 1 year ago

Would it save both of us, and others, time to simply track the dockerfile in the repo? Like many other projects do? We could schedule it to run once a week on some cron?

poweifeng commented 1 year ago

Feel free to make a pull request to BUILD.md and we can bring the issue to other team members.

However, my feeling is that we're not actively using docker for any purpose, and maintaining a path (even if it's just documentation and a Dockerfile) is overhead that perhaps we can do without.

unicomp21 commented 1 year ago

@romainguy thoughts? should i should keep circling back around when something breaks? looking at the godot engine stuff, they have dockerfile's for just about everything? perhaps that makes it a good practice?

unicomp21 commented 1 year ago

@poweifeng looking at how the new dockerfile pins the emscripten version to 3.1.15 instead of using the latest 3.1.44, does this mean filament does not support newer c/c++ compilers rolling out?

suzp1984 commented 1 year ago

Same error met, I use 3.1.44 emsdk.

filament/libs/math/include/math/half.h:163:35: error: identifier '_h' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
163 | inline constexpr half operator "" _h(long double v) {
      |                       ~~~~~~~~~~~~^~
      |                       operator""_h
1 error generated.

the clang version of emsdk is 17.0.0.

emsdk/upstream/bin/clang++ --version
clang version 17.0.0 (https://github.com/llvm/llvm-project a8cbd27d1f238e104a5d5ca345d93bc1f4d4ab1f)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Users/jacob/hack/emscripten/emsdk/upstream/bin