Comments (5)
Here is my patch which workarounds the issue by disabling usage of PCH for all files that have tags:
diff orig/build-binary.mk build-binary.mk
443,444c443,454
< # All obj files are dependent on the PCH
< $(foreach src,$(filter $(all_cpp_patterns),$(LOCAL_SRC_FILES)),\
---
> # Filter obj files that are dependent on the PCH (only those without tags)
> ifeq (true,$(LOCAL_ARM_NEON))
> TAGS_TO_FILTER=arm
> else
> TAGS_TO_FILTER=arm neon
> endif
>
> allowed_src := $(foreach src,$(filter $(all_cpp_patterns),$(LOCAL_SRC_FILES)),\
> $(if $(filter $(TAGS_TO_FILTER),$(LOCAL_SRC_FILES_TAGS.$(src))),,$(src))\
> )
> # All files without tags depend on PCH
> $(foreach src,$(allowed_src),\
447,449c457,458
<
< # Files from now on build with PCH
< LOCAL_CPPFLAGS += -Winvalid-pch -include $(LOCAL_OBJS_DIR)/$(LOCAL_BUILT_PCH)
---
> # Make sure those files are built with PCH
> $(call add-src-files-target-cflags,$(allowed_src),-Winvalid-pch -include $(LOCAL_OBJS_DIR)/$(LOCAL_BUILT_PCH))
from ndk.
Thanks for the patch. I added a test case and uploaded for review:https://android-review.googlesource.com/207977
from ndk.
@DanAlbert, thank you for accepting the patch. I would only like to note that this patch works by disabling PCH for tagged files (i.e. files tagged with arm or neon will not use PCH). While this works fine for our use case when such files are minority, the real fix would actually be to create a separate PCH for each tag combination in use (I believe this is what Xcode does when compiling iOS projects).
from ndk.
Yeah, I had considered that. There are bigger problems to chase right now, so I figure something is better than nothing :)
One thing that can be done to avoid this is to use a separate (intermediate) static library for the sources that would normally be tagged. This way you can set LOCAL_ARM_MODE
and LOCAL_ARM_NEON
correctly for each static lib and the LOCAL_PCH
will automatically be built with the right flags for each lib. Then you just use them via LOCAL_WHOLE_STATIC_LIBRARIES
to ensure you get the full library included.
from ndk.
Thanks @DanAlbert, that is a good idea.
from ndk.
Related Issues (20)
- [FR] push/pop required policies in cmake toolchain file HOT 16
- [DOC] Clarification on 16k page size support for x86_64 devices HOT 3
- [DOC] `system_fonts.h` HOT 7
- [Bug]: Lambda segfaults in Clang HOT 11
- [FR] Official NDK release for Linux arm64 HOT 1
- [Bug]: fatal error: error in backend: Cannot select: 0x10ba8ace0: nxv4f32 = BUILD_VECTOR 0x133163a90, 0x1330f4800, 0x133108d20, 0x1248b9e60 HOT 6
- [BUG] Compilation Error with std::execution in C++17 HOT 3
- [BUG] CLEAR_VARS does not clear LOCAL_STRIP_MODE variable HOT 2
- [Bug]: Android NDK r27 rc2 miscompiles code with inderect gotos HOT 13
- [Bug] NDK's openmp test crashing on x86 with latest LLVM update HOT 4
- Please provide maintainable list of NDK codename-revision pairs HOT 3
- [Bug]: clang compile with -D_FORTIFY_SOURCE=2 -Dstatic= cause undefined symbol: snprintf HOT 7
- [BUG] android-ndk-r26c use -pg ld.lld: error: undefined symbol: _mcount HOT 7
- [Bug]: Compiler Crash HOT 5
- [FR] support libclang? HOT 1
- [BUG] investigate odd find_package behavior HOT 3
- [BUG] NDK 27 no longer supports passing in `CMAKE_SYSTEM_PROCESSOR` to CMake to set the arch HOT 7
- [Bug]: Unable to disable a builtin with -fno-builtin-wmemchr HOT 17
- [BUG] sysroot wrongly includes tflite_support_libz.a? HOT 3
- [BUG] Build error of ncnn for Android 'x86_64' ABI with NDK r27 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ndk.