Hello,
Using Xcode 10.2 (we had no similar issues with Xcode 10.1), carthage succeeds to build framework, but when I build the project with the added framework, some specific symbols are missing by the linker.
To test the fail, I have created two framework :
override final mark. This symbol method is missing by the linker.To trigger the build fail, clone FrameworkImplementingFrameworkTest, carthage boostrap, and build the framework.
We also tried to build the framework with Xcode, copy the .framework from Xcode/DerivedData to Repo/Carthage/Build and the bug doesn't occurs anymore.
which carthage: /usr/local/bin/carthagecarthage version: Carthage 0.32.0 and Carthage masterxcodebuild -version: Xcode 10.2--no-build?--no-use-binaries?--use-submodules?--cache-builds?--new-resolver?Cartfile
github "Nass30/Framework-Test" "master"
Carthage Output
*** Checking out Framework-Test at "883a53567804efe5c2578b487ee0e402de0de7a1"
*** xcodebuild output can be found in /var/folders/yt/hyz_g0957ylc2p2c6m2b5cr9v_3vx9/T/carthage-xcodebuild.uj6X53.log
*** Building scheme "FrameworkTest" in FrameworkTest.xcodeproj
Actual outcome
The carthage build succeed but when we build the project, an error occurs :
Undefined symbols for architecture x86_64:
"FrameworkTest.GenericClassChild.performAction(someModel: A, someInternalInstance: FrameworkTest.InternalClass) -> ()", referenced from:
type metadata for FrameworkImplementingFrameworkTest.ClassImplementingGenericChildClass in ClassImplementingGenericChildClass.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Expected outcome
The build should succeed.
Possibly related to the known issue in Xcode 10.2 Release Note. Maybe Carthage should implement a workaround?
I believe this is a duplicate of this issue: https://github.com/Carthage/Carthage/issues/2718
If so, a PR to resolve this issue has been merged to master and the Carthage team is working on a new release.
Duplicate of #2718
@DavidBrunow @blender
I tried again with the new master version of Carthage, it still fails to build.
Note that so far we use a hack by removing the final mark of the method and the build succeeds.
But yeah, this is certainly a duplicate of the #2718.
@Nass30 If removing the final mark fixes the build I would see that as a separate issue -- I wouldn't think the issue with the header files would impact that.
@DavidBrunow Setting the method as public fixes the build too.
Couldn't reproduce with latest Carthage master (87e21988) —
sudo xcode-select --switch /Applications/Xcode/Xcode_10.1.app
brew uninstall --force carthage
HOMEBREW_VERBOSE=1 brew install --HEAD carthage
# See HEAD is now at 87e21988 Merge pull request #2741 from Carthage/revert-authorization-header-for-redirected-requests
git clone https://github.com/Nass30/Framework-Test
cd Framework-Test
sudo xcode-select --switch /Applications/Xcode/Xcode_10.2.app
carthage build --no-skip-current --verbose
open -a /Applications/Xcode/Xcode_10.2.app
# File → New → Workspace
# File → New → Project → Cocoa Touch Framework
# File → New → File → Swift File
# add `import TestFramework`
# Drag …/Carthage/Build/iOS/FrameworkTest.framework into “Linked Frameworks and Libraries”
# Set `FRAMEWORK_SEARCH_PATH`
# Build in Debug for device and simulator
# Build in Release for device and simulator
@jdhealy
Following the steps you described, adding
struct SomeModel { }
class Test: GenericClassChild<SomeModel> { }
to the new swift file in your framework leads to the error @Nass30 mentioned
To trigger the build fail :
git clone [email protected]:Nass30/Framework-Implementing-FrameworkTest.git
cd Framework-Implementing-FrameworkTest
carthage bootstrap
open FrameworkImplementingFrameworkTest.xcodeproj
build
Hello @jdhealy ,
I upgraded to carthage 0.33.0 and the project still fails to build. Could you please try to trigger the build fail by adding the @manu-d 's code to a new swift file or cloning my repo ?
Following some investigation, the issue seems to come with Swift 5. If I build the framework with Xcode 10.2, but the Swift 4.2.1 toolchain, the issue disappears
(Moreover, using swift 5, enabling testability in release fixes the issue. I think that for testing purposes, with that flag, even internal symbols are exposed in the module, so we won't have the error, but that's not really a solution)
My point being, the issue is not with Carthage, but rather with Swift 5
Most helpful comment
Following some investigation, the issue seems to come with Swift 5. If I build the framework with Xcode 10.2, but the Swift 4.2.1 toolchain, the issue disappears
(Moreover, using swift 5, enabling testability in release fixes the issue. I think that for testing purposes, with that flag, even internal symbols are exposed in the module, so we won't have the error, but that's not really a solution)
My point being, the issue is not with Carthage, but rather with Swift 5