onivim / oni2

Native, lightweight modal code editor
https://v2.onivim.io
MIT License
7.76k stars 274 forks source link

Failed to compile on Ubuntu20.04 with Clang14 due to skia #3850

Closed zchrissirhcz closed 2 years ago

zchrissirhcz commented 2 years ago

Short Description

When executing esy bootstrap, it will compile skia, and my machine support avx, but it failed to compile. Key error message:

    In file included from ../../src/opts/SkOpts_avx.cpp:11:
    ../../src/opts/SkRasterPipeline_opts.h:1029:1: error: identifier 'plus__channel' is reserved because it contains '__' [-Werror,-Wreserved-identifier]
    BLEND_MODE(plus_)    { return min(s + d, 1.0f); }  // We can clamp to either 1 or sa.

Seems like a coding style issue, shouldn't use __ (double underscore) for identifier since they are reserved. However, I browse the official skia source code, there isn't __ in the reported file. I don't know how to specify/change the skia version in oni2 project's source code.

reproduce

esy install
esy bootstrap
    [9/1230] compile ../../src/opts/SkOpts_avx.cpp
    FAILED: obj/src/opts/avx.SkOpts_avx.o 
    clang++ -MMD -MF obj/src/opts/avx.SkOpts_avx.o.d -DNDEBUG -DSK_SAMPLES_FOR_X -DSK_GAMMA_APPLY_TO_A8 -DSK_ENABLE_DISCRETE_GPU -DGR_TEST_UTILS=1 -DSKIA_IMPLEMENTATION=1 -I../../include/android -I../../include/c -I../../include/codec -I../../include/config -I../../include/core -I../../include/effects -I../../include/encode -I../../include/gpu -I../../include/atlastext -I../../include/pathops -I../../include/ports -I../../include/svg -I../../include/utils -I../../include/utils/mac -I../../include/private -I../../src/c -I../../src/codec -I../../src/core -I../../src/effects -I../../src/fonts -I../../src/image -I../../src/images -I../../src/lazy -I../../src/opts -I../../src/pathops -I../../src/pdf -I../../src/ports -I../../src/sfnt -I../../src/shaders -I../../src/shaders/gradients -I../../src/sksl -I../../src/utils -I../../src/utils/win -I../../src/xml -I../../third_party/gif -I../../experimental/svg/model -I../../src/gpu -mavx -fstrict-aliasing -fPIC -fvisibility=hidden -O3 -fdata-sections -ffunction-sections -g -Werror -Wall -Wextra -Winit-self -Wpointer-arith -Wsign-compare -Wvla -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-extra-semi-stmt -Weverything -Wno-unknown-warning-option -Wno-anon-enum-enum-conversion -Wno-sizeof-array-div -Wno-psabi -Wno-suggest-destructor-override -Wno-suggest-override -Wno-uninitialized-const-reference -Wno-poison-system-directories -Wno-nonportable-include-path -Wno-nonportable-system-include-path -Wno-cast-align -Wno-cast-qual -Wno-conversion -Wno-disabled-macro-expansion -Wno-documentation -Wno-documentation-unknown-command -Wno-double-promotion -Wno-exit-time-destructors -Wno-float-equal -Wno-format-nonliteral -Wno-global-constructors -Wno-missing-prototypes -Wno-missing-variable-declarations -Wno-pedantic -Wno-reserved-id-macro -Wno-shadow -Wno-shift-sign-overflow -Wno-signed-enum-bitfield -Wno-switch-enum -Wno-undef -Wno-unreachable-code -Wno-unreachable-code-break -Wno-unreachable-code-return -Wno-unused-macros -Wno-unused-member-function -Wno-unused-template -Wno-zero-as-null-pointer-constant -Wno-bad-function-cast -Wno-covered-switch-default -Wno-deprecated -Wno-missing-noreturn -Wno-old-style-cast -Wno-padded -Wno-newline-eof -Wno-implicit-fallthrough -Wno-unused-parameter -I/home/zz/.esy/3______________________________________________________________________/i/esy_libjpeg_turbo-e4385a3b/include -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Wnon-virtual-dtor -Wno-noexcept-type -Wno-abstract-vbase-init -Wno-weak-vtables -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-undefined-func-template -c ../../src/opts/SkOpts_avx.cpp -o obj/src/opts/avx.SkOpts_avx.o
    In file included from ../../src/opts/SkOpts_avx.cpp:11:
    ../../src/opts/SkRasterPipeline_opts.h:1029:1: error: identifier 'plus__channel' is reserved because it contains '__' [-Werror,-Wreserved-identifier]
    BLEND_MODE(plus_)    { return min(s + d, 1.0f); }  // We can clamp to either 1 or sa.
    ^
    ../../src/opts/SkRasterPipeline_opts.h:1004:10: note: expanded from macro 'BLEND_MODE'
        SI F name##_channel(F s, F d, F sa, F da); \
             ^
    <scratch space>:19:1: note: expanded from here
    plus__channel
    ^
    In file included from ../../src/opts/SkOpts_avx.cpp:11:
    ../../src/opts/SkRasterPipeline_opts.h:1029:1: error: identifier 'plus__k' is reserved because it contains '__' [-Werror,-Wreserved-identifier]
    ../../src/opts/SkRasterPipeline_opts.h:1005:5: note: expanded from macro 'BLEND_MODE'
        STAGE(name, Ctx::None) {                   \
        ^
    ../../src/opts/SkRasterPipeline_opts.h:785:17: note: expanded from macro 'STAGE'
            SI void name##_k(__VA_ARGS__, size_t dx, size_t dy, size_t tail,             \
                    ^
    <scratch space>:20:1: note: expanded from here
    plus__k
    ^
    In file included from ../../src/opts/SkOpts_avx.cpp:11:
    ../../src/opts/SkRasterPipeline_opts.h:1031:1: error: identifier 'xor__channel' is reserved because it contains '__' [-Werror,-Wreserved-identifier]
    BLEND_MODE(xor_)     { return s*inv(da) + d*inv(sa); }
    ^
    ../../src/opts/SkRasterPipeline_opts.h:1004:10: note: expanded from macro 'BLEND_MODE'
        SI F name##_channel(F s, F d, F sa, F da); \
             ^
zchrissirhcz commented 2 years ago

Related file is located in /home/zz/.esy/3/b/esy_skia-3d7edf69/src/opts/SkOpts_avx.cpp

Et7f3 commented 2 years ago

Seems like a coding style issue, shouldn't use (double underscore) for identifier since they are reserved. However, I browse the official skia source code, there isn't in the reported file. I don't know how to specify/change the skia version in oni2 project's source code.

Esy-skia is a older fork we need to rebase some patch on a more recent version.

someone patched yesterday https://github.com/danvonk/revery/blob/124dad33bbf7eca3164a2f707601a2357464e596/package.json#L59 just add this in resolutions fields (it refer to his fork)

source of esy-skia: https://github.com/revery-ui/esy-skia