This repository has been archived by the owner on Jan 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Framework Versioning to prevent Runtime Duplicate Symbols
Summary: `FBControlCore` has some provisional Framework Version build settings enabled and is the only of the 4 Objective-C Frameworks to do so. `XCTestBootstrap` does not have versioning, but is embedded in both `FBSimulatorControl` and `FBDeviceControl` just like `FBControlCore` is. This poses a problem when `FBSimulatorControl` and `FBDeviceControl` are both loaded into the same process: 1) `fbsimctl` loads `FBSimulatorControl`, `dyld` loads the Frameworks in `FBSimulatorControl.framework/Frameworks` of `FBControlCore` & `XCTestBootstrap`. 2) `fbsimctl` loads `FBDeviceControl`, `dyld` loads the the Frameworks in `FBDeviceControl.framework/Frameworks`. 3) `FBControlCore` is not loaded as it has the same Framework version as was loaded in #1 4) `XCTestBootstrap` is loaded *again* since it has no versioning information 5) `dyld` complains about duplicate symbols at runtime. Adding Versioning to `XCTestBootstrap` has the effect that `dyld` will be smart enough to not complain about duplicate symbols in `XCTestBootstrap`. This means that we can keep `FBSimulatorControl` as being completly (and independently) redistributable as a Framework as it will continue to bundle its dependencies, but also prevent runtime duplicate symbols. Reviewed By: marekcirkos Differential Revision: D3533943 fbshipit-source-id: bf9bc7562a1a4a6275d6d6089bf2da4825c9637e
- Loading branch information
1 parent
bb2d1ec
commit c01ae50
Showing
6 changed files
with
23 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Adding 'Versioning' to the Framework will ensure that Duplicate Symbol Scenarios do not arise when the Frameworks are independently distributed | ||
// Since FBSimulatorControl/FBDeviceControl both embed XCTestBootstrap & FBControlCore, the versioning of these Frameworks will ensure that dyld | ||
// is aware of the embedded Frameworks in these Targets being identical and won't attempt to load them twice. | ||
|
||
CURRENT_PROJECT_VERSION = 1 | ||
DEFINES_MODULE = YES; | ||
DYLIB_COMPATIBILITY_VERSION = 1 | ||
DYLIB_CURRENT_VERSION = 1 | ||
DYLIB_INSTALL_NAME_BASE = @rpath | ||
FRAMEWORK_VERSION = A | ||
VERSIONING_SYSTEM = apple-generic | ||
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
// Import Shared Configuration | ||
// Import Shared & Framework Configuration | ||
#include "../Configuration/Shared.xcconfig" | ||
#include "../Configuration/Framework.xcconfig" | ||
|
||
// Target-Specific Settings | ||
CURRENT_PROJECT_VERSION = 1 | ||
DEFINES_MODULE = YES; | ||
DYLIB_COMPATIBILITY_VERSION = 1 | ||
DYLIB_CURRENT_VERSION = 1 | ||
DYLIB_INSTALL_NAME_BASE = @rpath | ||
FRAMEWORK_VERSION = A | ||
INFOPLIST_FILE = $(SRCROOT)/FBControlCore/FBControlCore-Info.plist | ||
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks | ||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.FBControlCore | ||
PRODUCT_NAME = FBControlCore | ||
VERSIONING_SYSTEM = apple-generic | ||
PRODUCT_NAME = FBControlCore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
// Import Shared Configuration | ||
// Import Shared & Framework Configuration | ||
#include "../Configuration/Shared.xcconfig" | ||
#include "../Configuration/Framework.xcconfig" | ||
|
||
// Weak-Link Xcode Private Frameworks | ||
OTHER_LDFLAGS = $(inherited) -weak_framework DTXConnectionServices -weak_framework DVTFoundation -weak_framework IBAutolayoutFoundation -weak_framework IDEFoundation -weak_framework IDEKit -weak_library $(DEVELOPER_DIR)/../PlugIns/IDEiOSSupportCore.ideplugin/Contents/MacOS/IDEiOSSupportCore -weak_library $(DEVELOPER_DIR)/../PlugIns/IDESourceEditor.ideplugin/Contents/MacOS/IDESourceEditor | ||
|
||
// Target-Specific Settings | ||
DEFINES_MODULE = YES; | ||
INFOPLIST_FILE = $(SRCROOT)/FBDeviceControl/FBDeviceControl-Info.plist | ||
LD_RUNPATH_SEARCH_PATHS = @loader_path/Frameworks | ||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.FBDeviceControl | ||
PRODUCT_NAME = FBDeviceControl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
// Import Shared Configuration | ||
// Import Shared & Framework Configuration | ||
#include "../Configuration/Shared.xcconfig" | ||
#include "../Configuration/Framework.xcconfig" | ||
|
||
// Weak-Link Xcode Private Frameworks | ||
OTHER_LDFLAGS = $(inherited) -weak_framework DVTFoundation -weak_framework DVTiPhoneSimulatorRemoteClient -weak_framework CoreSimulator -weak_framework SimulatorKit | ||
|
||
// Target-Specific Settings | ||
DEFINES_MODULE = YES; | ||
INFOPLIST_FILE = $(SRCROOT)/FBSimulatorControl/FBSimulatorControl-Info.plist; | ||
LD_RUNPATH_SEARCH_PATHS = @loader_path/Frameworks | ||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.FBSimulatorControl | ||
PRODUCT_NAME = FBSimulatorControl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters