Open Bug 2047963 Opened 1 month ago Updated 14 days ago

gn_processor.py does not distinguish between macOS and iOS targets

Categories

(Firefox Build System :: General, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: jnicol, Unassigned)

Details

gn_processor iterates through various target_oses to generate configs here, and it generates for "mac" but not "ios". When generating moz.build files it uses the condition CONFIG[OS_TARGET] == "Darwin" here, which applies to both macOS and iOS.

This causes problems in bug 2035541 when we attempt to build ANGLE using gn_processor-generated moz.build files. The ANGLE build system pulls in the file FunctionsCGL.cpp for mac builds here. Meaning our moz.build file includes it in UNIFIED_SOURCES if CONFIG["OS_TARGET"] == "Darwin", which includes iOS. And then we get a compiler error when building for iOS:

14:44:35     INFO -  gmake[4]: Entering directory '/builds/worker/workspace/obj-build/third_party/angle/angle_common_gn'
14:44:35     INFO -  /builds/worker/fetches/sccache/sccache /builds/worker/fetches/clang/bin/clang++ -isysroot /builds/worker/fetches/iPhoneOS18.4.sdk -mios-version-min=18.4 -std=gnu++20 --target=aarch64-apple-ios -o Unified_cpp_angle_common_gn1.o -c  -I/builds/worker/workspace/obj-build/dist/stl_wrappers -fvisibility=hidden -fvisibility-inlines-hidden -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstrict-flex-arrays=1 -DNDEBUG -DTRIMMED=1 -DANGLE_DISABLE_POOL_ALLOC -DANGLE_ENABLE_CONTEXT_MUTEX=1 -UANGLE_ENABLE_DEBUG_ANNOTATIONS -DANGLE_ENABLE_KEYEDMUTEX -DANGLE_ENABLE_SHARE_CONTEXT_LOCK=1 -DANGLE_PLATFORM_EXPORT= -DANGLE_SKIP_DXGI_1_2_CHECK -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DNVALGRIND -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__ARM_NEON__=1 -I/builds/worker/checkouts/gecko/third_party/angle/angle_common_gn -I/builds/worker/workspace/obj-build/third_party/angle/angle_common_gn -I/builds/worker/workspace/obj-build/ipc/ipdl/_ipdlheaders -I/builds/worker/checkouts/gecko/ipc/chromium/src -I/builds/worker/checkouts/gecko/third_party/angle/include -I/builds/worker/checkouts/gecko/third_party/angle/src -I/builds/worker/checkouts/gecko/third_party/angle/src/common/base -I/builds/worker/checkouts/gecko/third_party/angle/src/common/third_party/xxhash -I/builds/worker/checkouts/gecko/tools/profiler/public -I/builds/worker/workspace/obj-build/dist/include -DMOZILLA_CLIENT -include /builds/worker/workspace/obj-build/mozilla-config.h -fno-rtti -pthread -fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sections -fno-math-errno -fno-exceptions -fdiagnostics-absolute-paths -fPIC -gdwarf-4 -gsimple-template-names --start-no-unused-arguments -mllvm=-dwarf-linkage-names=Abstract --end-no-unused-arguments -Xclang -load -Xclang /builds/worker/workspace/obj-build/build/clang-plugin/libclang-plugin.so -Xclang -add-plugin -Xclang moz-check -O3 -fno-omit-frame-pointer -funwind-tables -Wall -Wbitfield-enum-conversion -Wempty-body -Wformat-type-confusion -Wignored-qualifiers -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtautological-constant-in-range-compare -Wtype-limits -Wno-error=tautological-type-limit-compare -Wunreachable-code -Wunreachable-code-return -Wunused-but-set-parameter -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wdeprecated-literal-operator -Winvalid-utf8 -Wcomma -Wimplicit-fallthrough -Wduplicate-method-arg -Wduplicate-method-match -Wmissing-method-return-type -Wobjc-signed-char-bool -Wsemicolon-before-method-body -Wsuper-class-method-mismatch -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wformat -Wformat-security -Wno-psabi -Wthread-safety -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -Wno-character-conversion -fno-strict-aliasing -ffp-contract=off  -MD -MP -MF .deps/Unified_cpp_angle_common_gn1.o.pp   Unified_cpp_angle_common_gn1.cpp
14:44:35     INFO -  gmake[4]: Leaving directory '/builds/worker/workspace/obj-build/third_party/angle/angle_common_gn'
14:44:35     INFO -  /builds/worker/checkouts/gecko/third_party/angle/src/common/gl/cgl/FunctionsCGL.h:12:10: fatal error: 'OpenGL/OpenGL.h' file not found
14:44:35     INFO -     12 | #include <OpenGL/OpenGL.h>
14:44:35     INFO -        |          ^~~~~~~~~~~~~~~~~
14:44:35     INFO -  1 error generated.
14:44:35    ERROR -  gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:668: Unified_cpp_angle_common_gn1.o] Error 1

Note this library is depended upon by the angle shader translator, so we encounter this problem just by switching the current ANGLE build to using gn_processor, even before attempting to additionally build the Metal backend in bug 2027951.

I had a go at making gn_processor generate separate configs for "mac" and "ios", but encountered a ton of errors. So my plan for bug 2035541 is to patch the ANGLE .gni file to remove the problematic files (we don't need to build ANGLE's CGL backend so this is fine). But thought I should get a bug on file.

The severity field is not set for this bug.
:ahochheiden, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(ahochheiden)
Severity: -- → S3
Flags: needinfo?(ahochheiden)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.