Local android builds failing on spirv-cross

This issue has been tracked since 2022-09-23.

Not sure why this TU is even getting compiled for Android:

[2660/3293] CXX clang_arm64/obj/third_party/vulkan-deps/spirv-tools/src/source/opt/libspvtools_opt.scalar_replacement_pass.o
FAILED: clang_arm64/obj/third_party/vulkan-deps/spirv-tools/src/source/opt/libspvtools_opt.scalar_replacement_pass.o 
/Users/dnfield/goma/gomacc  ../../buildtools/mac-x64/clang/bin/clang++ -MD -MF clang_arm64/obj/third_party/vulkan-deps/spirv-tools/src/source/opt/libspvtools_opt.scalar_replacement_pass.o.d -DUSE_OPENSSL=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_LIBCPP_DISABLE_AVAILABILITY=1 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../.. -Iclang_arm64/gen -I../../third_party/libcxx/include -I../../third_party/libcxxabi/include -I../../build/secondary/third_party/libcxx/config -I../../third_party/vulkan-deps/spirv-tools/src -I../../third_party/vulkan-deps/spirv-headers/src/include -I../../third_party/vulkan-deps/spirv-tools/src/include -Iclang_arm64/gen/third_party/vulkan-deps/spirv-tools/src -isysroot /Users/dnfield/src/flutter/engine/src/out/android_debug/gen/SDKs/MacOSX13.sdk -mmacosx-version-min=10.13.0 -fno-strict-aliasing -fstack-protector-all -arch arm64 -fno-aligned-allocation -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-deprecated-copy -Wno-psabi -Wno-unqualified-std-cast-call -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -Wunguarded-availability -fvisibility=hidden -stdlib=libc++ -Wstring-conversion -Wnewline-eof -O2 -fno-ident -fdata-sections -ffunction-sections -g2 -Wno-implicit-fallthrough -Wno-newline-eof -Wno-unreachable-code-break -Wno-unreachable-code-return -fvisibility-inlines-hidden -std=c++17 -fno-rtti -nostdinc++ -nostdinc++ -fvisibility=hidden -fno-exceptions  -c ../../third_party/vulkan-deps/spirv-tools/src/source/opt/scalar_replacement_pass.cpp -o clang_arm64/obj/third_party/vulkan-deps/spirv-tools/src/source/opt/libspvtools_opt.scalar_replacement_pass.o
In file included from ../../third_party/vulkan-deps/spirv-tools/src/source/opt/scalar_replacement_pass.cpp:15:
../../third_party/vulkan-deps/spirv-tools/src/source/opt/scalar_replacement_pass.h:42:5: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
    sprintf(&name_[strlen(name_)], "%d", max_num_elements_);
    ^
/Users/dnfield/src/flutter/engine/src/out/android_debug/gen/SDKs/MacOSX13.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Users/dnfield/src/flutter/engine/src/out/android_debug/gen/SDKs/MacOSX13.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))

@chinmaygarde do you know?

chinmaygarde wrote this answer on 2022-09-23

Seems to be a host build. Perhaps of ImpellerC. Is this on an Apple Silicon Mac? That would explain the arch flags.

Seems like the Mac 13 SDK libc is deprecating certain methods like sprintf.

chinmaygarde wrote this answer on 2022-09-23

I found this in the headers on my local machine.

#if !defined(_POSIX_C_SOURCE)
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")
#endif

We should define _POSIX_C_SOURCE since this is a POSIX call and the deprecation would be a compliance violation.

dnfield wrote this answer on 2022-09-23

...but why is impellerc getting built for Android? Will dig.

chinmaygarde wrote this answer on 2022-09-23

It needs to be built so we can generate the GLSL for the Android backend so we can support the --enable-impeller flag in go/try-impeller.

dnfield wrote this answer on 2022-09-23

Yes, but this is in my out/android_debug directory.

dnfield wrote this answer on 2022-09-23

It's coming from the flutter_shell_native_unittests.

dnfield wrote this answer on 2022-09-23

...maybe

dnfield wrote this answer on 2022-09-23

Ahh I see now. Ok. Need to figure out where/how to get that _POSIX_C_SOURCE define.

chinmaygarde wrote this answer on 2022-09-23

gn refs out/android_debug //flutter/impeller/compiler:impellerc

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-10-04
Star Count 145499
Watcher Count 3567
Fork Count 23393
Issue Count 11206

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date