-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support-flto
#310
Comments
Eigen won't support
|
All NDK toolchains shown below report "plugin needed to handle lto object". Sorting through various posts to understand this.
See: android/ndk#108 |
Reading android/ndk#108, and android/ndk#137 As a starting point, it would be useful to create any working build of drishti w/ LTO using a Both
|
Note: Errors now from ranlib step. May be useful: http://stackoverflow.com/a/39256013 |
Possible solution here: https://bugs.archlinux.org/task/43367
|
Testing this now. Build is about 1/2 way through. Seems to resolve some of the basic setup issues for gcc + ndk. Could probably be done cleaner.
The build is much closer but does hit a few errors. |
|
From GCC documentation:
So instead of '/usr/bin/true' it should be |
Non of those is Android + Clang. What toolchain have you tried? |
I tried a few versions. These could be a starting point: android-ndk-r10e-api-16-armeabi-v7a-neon-clang-35-hid-sections-lto.cmake |
In some cases, I believe toolchains that maintain a specific |
Note: Updated experiment after cleaning the hunter cache w/ shared OpenCV + Experiment 8: TOOLCHAIN=android-ndk-r10e-api-19-armeabi-v7a-neon-hid-sections-lto (i.e., gcc) w/ MinSizerel and opencv CMAKE_ARGS BUILD_SHARED_LIBS=ON + OpenCV LTO and
|
Experiment 9: TOOLCHAIN=android-ndk-r10e-api-19-armeabi-v7a-neon-hid-sections-lto (i.e., gcc) w/ MinSizerel and opencv CMAKE_ARGS BUILD_SHARED_LIBS=OFF + OpenCV LTO and -flto -Os -ffunction-sections -fdata-sectionsSame as above but with static opencv:
|
For NDK
|
Experiment 10: TOOLCHAIN=android-ndk-r10e-api-19-armeabi-v7a-neon-hid-sections-lto (i.e., gcc) w/ MinSizerel and opencv CMAKE_ARGS BUILD_SHARED_LIBS=ON + OpenCV LTO and -flto -Os -ffunction-sections -fdata-sectionsNote: Full build w/ real-time + face api:
|
Experiment 11: TOOLCHAIN=android-ndk-r10e-api-19-armeabi-v7a-neon-hid-sections-lto (i.e., gcc) w/ MinSizerel and opencv CMAKE_ARGS BUILD_SHARED_LIBS=OFF + OpenCV LTO and -flto -Os -ffunction-sections -fdata-sectionsNote: Full build w/ real-time + face api (same as 10 above but w/ static OpenCV):
|
I think this main issue can be closed w/ the addition of the polly Caveats:
|
They have it as an optimization choice as far as I remember, like no-optimization, agressive-optimization, size-optimization, lto-optimization. |
Closing this main issue since the core feature is implemented. |
UPDATE 2/21/17:
clang
toolchains seems to work for iOS and OS X builds. Android NDK toolchains (bothclang
andgcc
hit various roadblocks. See discussion belowSee: http://stackoverflow.com/a/25649861 :
-flto -O3
may optimize further but increase size, while-flto -Os
should reduce size. Also,-flto -Os
(or whatever optimization setting is used) must be used consistently for compilation and linking within the project and all external (Hunter) dependencies. Thus,-flto
belongs in the toolchain, and we must specify aCMAKE_BUILD_TYPE
ofMinSizeRel
, which can be achieved for the internal project and hunter dependencies using the followingpolly
flags respectively:Relates: https://github.com/ruslo/hunter/issues/22
Note: Polly toolchain requires
HUNTER_TOOLCHAIN_UNDETECTABLE_ID
flag:Experiment 1:
-O3 -ffunction-sections -fdata-sections
$ du -sh _install/xcode-hid-sections/{bin,lib}/*
Experiment 2:
-flto -O3 -ffunction-sections -fdata-sections
du -sh _install/xcode-hid-sections-lto/{bin,lib}/*
Experiment 3:
-flto -Os -ffunction-sections -fdata-sections
Note: needs Eigen patch for
MinSizeRel
Experiment 4:
-flto -Os -ffunction-sections -fdata-sections
w/ cerealThe text was updated successfully, but these errors were encountered: