Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Add -fvisibility=hidden to iOS #7604

Merged
merged 2 commits into from
Jul 13, 2017
Merged

Conversation

kkaefer
Copy link
Member

@kkaefer kkaefer commented Jan 5, 2017

Same as #7509, but this time for iOS.

@kkaefer kkaefer added build iOS Mapbox Maps SDK for iOS labels Jan 5, 2017
@mention-bot
Copy link

@kkaefer, thanks for your PR! By analyzing this pull request, we identified @1ec5, @friedbunny and @boundsj to be potential reviewers.

@kkaefer kkaefer mentioned this pull request Jan 5, 2017
5 tasks
Copy link
Contributor

@1ec5 1ec5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Make sure to check the static library to make sure an application can link to it. We should also make sure crash symbolication continues to work after this change, since that's been quite fragile lately.

/cc @friedbunny @boundsj

@1ec5
Copy link
Contributor

1ec5 commented Jan 9, 2017

The build is failing where MGLStyleTests refers to some constants defined in mbgl-core:

▸ Linking test

❌  Undefined symbols for architecture x86_64
> Symbol: mbgl::util::default_styles::satelliteStreets
> Referenced from: -[MGLStyleTests testVersionedStyleURLs] in MGLStyleTests.o



❌  ld: symbol(s) not found for architecture x86_64



❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

GIven #6301 (comment), we might need to rework these tests by hardcoding the version numbers in platform-specific code instead of centralizing them in mbgl.

@kkaefer
Copy link
Member Author

kkaefer commented Jan 9, 2017

Alternatively, we could move all of those information to the header so that it doesn't need to be exported as symbols in the core library itself.

@kkaefer kkaefer force-pushed the 7604-ios-sdk-symbol-visibility branch from 70760ac to 2b4e88b Compare March 24, 2017 13:39
@kkaefer kkaefer force-pushed the 7604-ios-sdk-symbol-visibility branch from 2b4e88b to 1ba3945 Compare April 24, 2017 12:48
@kkaefer kkaefer force-pushed the 7604-ios-sdk-symbol-visibility branch from 1ba3945 to e0f5755 Compare June 14, 2017 20:50
@kkaefer
Copy link
Member Author

kkaefer commented Jun 14, 2017

Pushed an update to this

@friedbunny
Copy link
Contributor

Thanks @kkaefer, I’ll give this a try with the different iOS build flavors.

@friedbunny friedbunny force-pushed the 7604-ios-sdk-symbol-visibility branch from e0f5755 to 819824f Compare July 7, 2017 22:15
@friedbunny
Copy link
Contributor

friedbunny commented Jul 7, 2017

@kkaefer I’ve pushed up a rebase that includes the recently merged iOS v3.6.0 release branch. I also fixed an issue with the static build not having header search paths completely set (819824f).

It looks like -fvisibility=hidden gets us a 12% reduction in binary size for dynamic builds, bringing release, symbol-stripped, no-bitcode slices to 3.45MB (armv7) and 3.9MB (arm64); ~500KB smaller.

The static builds see no changes in binary size, so it appears that the GCC_GENERATE_DEBUGGING_SYMBOLS portion of #9022 will need more investigation.

After testing the dynamic and static builds in iOS apps, I’m reasonably confident this PR is 👍.

Binary size metrics.

ios-v3.6.0

make ipackage BUILDTYPE=Release SYMBOLS=NO

DYNAMIC
* Measured  4,057,152 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/dynamic/Mapbox-stripped-armv7)
* Measured  4,251,356 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/dynamic/Mapbox-stripped-arm64)
* Measured  4,616,640 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/dynamic/Mapbox-stripped-i386)
* Measured  4,528,336 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/dynamic/Mapbox-stripped-x86_64)
* Measured 17,440,476 bytes for 'Platform=iOS,Arch=Dynamic' (build/ios/pkg/dynamic/Mapbox-stripped)

STATIC
* Measured 20,421,212 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/static/Mapbox-stripped-armv7)
* Measured 23,161,104 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/static/Mapbox-stripped-arm64)
* Measured 22,993,684 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/static/Mapbox-stripped-i386)
* Measured 25,081,592 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/static/Mapbox-stripped-x86_64)
* Measured 91,657,560 bytes for 'Platform=iOS,Arch=static' (build/ios/pkg/static/Mapbox-stripped)
make ipackage BUILDTYPE=Release SYMBOLS=YES

DYNAMIC
* Measured  7,327,596 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/dynamic/Mapbox-stripped-armv7)
* Measured  7,799,060 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/dynamic/Mapbox-stripped-arm64)
* Measured  7,919,136 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/dynamic/Mapbox-stripped-i386)
* Measured  7,947,648 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/dynamic/Mapbox-stripped-x86_64)
* Measured 30,982,420 bytes for 'Platform=iOS,Arch=Dynamic' (build/ios/pkg/dynamic/Mapbox-stripped)

STATIC
* Measured 23,720,404 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/static/Mapbox-stripped-armv7)
* Measured 26,710,392 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/static/Mapbox-stripped-arm64)
* Measured 26,292,036 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/static/Mapbox-stripped-i386)
* Measured 28,634,600 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/static/Mapbox-stripped-x86_64)
* Measured 105,357,400 bytes for 'Platform=iOS,Arch=static' (build/ios/pkg/static/Mapbox-stripped)

master @ b87816a

make ipackage BUILDTYPE=Release SYMBOLS=NO

DYNAMIC
* Measured  4,086,220 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/dynamic/Mapbox-stripped-armv7)
* Measured  4,252,112 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/dynamic/Mapbox-stripped-arm64)
* Measured  4,658,336 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/dynamic/Mapbox-stripped-i386)
* Measured  4,557,936 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/dynamic/Mapbox-stripped-x86_64)
* Measured 17,539,536 bytes for 'Platform=iOS,Arch=Dynamic' (build/ios/pkg/dynamic/Mapbox-stripped)

STATIC
* Measured 20,645,148 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/static/Mapbox-stripped-armv7)
* Measured 23,461,720 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/static/Mapbox-stripped-arm64)
* Measured 23,256,628 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/static/Mapbox-stripped-i386)
* Measured 25,532,728 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/static/Mapbox-stripped-x86_64)
* Measured 92,896,192 bytes for 'Platform=iOS,Arch=static' (build/ios/pkg/static/Mapbox-stripped)
make ipackage BUILDTYPE=Release SYMBOLS=YES

DYNAMIC
* Measured  7,359,756 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/dynamic/Mapbox-stripped-armv7)
* Measured  7,806,208 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/dynamic/Mapbox-stripped-arm64)
* Measured  7,972,864 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/dynamic/Mapbox-stripped-i386)
* Measured  7,967,136 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/dynamic/Mapbox-stripped-x86_64)
* Measured 31,087,872 bytes for 'Platform=iOS,Arch=Dynamic' (build/ios/pkg/dynamic/Mapbox-stripped)

STATIC
* Measured 23,934,788 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/static/Mapbox-stripped-armv7)
* Measured 27,002,816 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/static/Mapbox-stripped-arm64)
* Measured 26,545,316 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/static/Mapbox-stripped-i386)
* Measured 29,076,832 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/static/Mapbox-stripped-x86_64)
* Measured 106,559,720 bytes for 'Platform=iOS,Arch=static' (build/ios/pkg/static/Mapbox-stripped)

7604-ios-sdk-symbol-visibility @ 819824f

make ipackage BUILDTYPE=Release SYMBOLS=NO

DYNAMIC
* Measured  3,450,028 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/dynamic/Mapbox-stripped-armv7)
* Measured  3,879,164 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/dynamic/Mapbox-stripped-arm64)
* Measured  4,021,984 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/dynamic/Mapbox-stripped-i386)
* Measured  4,043,392 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/dynamic/Mapbox-stripped-x86_64)
* Measured 15,380,732 bytes for 'Platform=iOS,Arch=Dynamic' (build/ios/pkg/dynamic/Mapbox-stripped)

STATIC
* Measured 20,635,252 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/static/Mapbox-stripped-armv7)
* Measured 23,458,680 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/static/Mapbox-stripped-arm64)
* Measured 23,246,492 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/static/Mapbox-stripped-i386)
* Measured 25,527,704 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/static/Mapbox-stripped-x86_64)
* Measured 92,868,096 bytes for 'Platform=iOS,Arch=static' (build/ios/pkg/static/Mapbox-stripped)
make ipackage BUILDTYPE=Release SYMBOLS=YES

DYNAMIC
* Measured  6,987,308 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/dynamic/Mapbox-stripped-armv7)
* Measured  7,734,244 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/dynamic/Mapbox-stripped-arm64)
* Measured  7,590,528 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/dynamic/Mapbox-stripped-i386)
* Measured  7,770,912 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/dynamic/Mapbox-stripped-x86_64)
* Measured 30,065,636 bytes for 'Platform=iOS,Arch=Dynamic' (build/ios/pkg/dynamic/Mapbox-stripped)

STATIC
* Measured 23,924,796 bytes for 'Platform=iOS,Arch=armv7' (build/ios/pkg/static/Mapbox-stripped-armv7)
* Measured 26,999,672 bytes for 'Platform=iOS,Arch=arm64' (build/ios/pkg/static/Mapbox-stripped-arm64)
* Measured 26,535,244 bytes for 'Platform=iOS,Arch=i386' (build/ios/pkg/static/Mapbox-stripped-i386)
* Measured 29,071,560 bytes for 'Platform=iOS,Arch=x86_64' (build/ios/pkg/static/Mapbox-stripped-x86_64)
* Measured 106,531,240 bytes for 'Platform=iOS,Arch=static' (build/ios/pkg/static/Mapbox-stripped)

@kkaefer
Copy link
Member Author

kkaefer commented Jul 10, 2017

Looks great! Why do we need the polylabel headers specifically?

@friedbunny
Copy link
Contributor

@kkaefer The direct polylabel dependency was added by @fabian-guerra in #8713 for getting the pole of inaccessibility of a polygon annotation. If there’s a way to streamline/remove the polylabel header inclusion, that’d also be great.

@friedbunny
Copy link
Contributor

Proposed changing how polylabel is included in the iOS/macOS projects in #9469.

@friedbunny friedbunny force-pushed the 7604-ios-sdk-symbol-visibility branch from 819824f to 808bca8 Compare July 11, 2017 06:19
@friedbunny
Copy link
Contributor

Rebased again — was able to get rid of 819824f after #9469. I think this should be ready to go.

@friedbunny friedbunny force-pushed the 7604-ios-sdk-symbol-visibility branch from 808bca8 to f426969 Compare July 12, 2017 21:10
@friedbunny friedbunny force-pushed the 7604-ios-sdk-symbol-visibility branch from f426969 to 73869d1 Compare July 13, 2017 04:23
@friedbunny friedbunny merged commit 73869d1 into master Jul 13, 2017
@friedbunny friedbunny deleted the 7604-ios-sdk-symbol-visibility branch July 13, 2017 05:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants