개발/Kotlin
코틀린 멀티플랫폼: iOS 빌드 시 CTFont* 오류 해결
귀염둥이 팡무
2023. 10. 3. 13:35
코틀린 멀티플랫폼으로 처음 iOS를 만나 빌드하는 경우 아래와 같은 오류를 만날 수 있습니다.
Undefined symbols for architecture arm64:
"_CTFontCollectionCreateFromAvailableFonts", referenced from:
SkFontMgr_Mac::SkFontMgr_Mac(__CTFontCollection const*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_CTFontCollectionCreateMatchingFontDescriptors", referenced from:
(anonymous namespace)::SkCopyAvailableFontFamilyNames(__CTFontCollection const*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_CTFontCopyAttribute", referenced from:
SkCTFontCreateExactCopy(__CTFont const*, double, OpszVariation) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onOpenStream(int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
... 중략
이를 해결하기 하는 방법은 매우 간단합니다.
shared - gradle의 cocoapods 설정에서 framework에 isStatic = true를 추가해 주시면 됩니다.
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "14.1"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "shared"
isStatic = true
}
}
이후 다시 iOS로 빌드하면 정상적으로 실행되는 모습을 확인하실 수 있으실 겁니다.
아래는 전체 오류 내용입니다.
Undefined symbols for architecture arm64:
"_CTFontCollectionCreateFromAvailableFonts", referenced from:
SkFontMgr_Mac::SkFontMgr_Mac(__CTFontCollection const*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_CTFontCollectionCreateMatchingFontDescriptors", referenced from:
(anonymous namespace)::SkCopyAvailableFontFamilyNames(__CTFontCollection const*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_CTFontCopyAttribute", referenced from:
SkCTFontCreateExactCopy(__CTFont const*, double, OpszVariation) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onOpenStream(int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyAvailableTables", referenced from:
SkTypeface_Mac::onGetTableTags(unsigned int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyCharacterSet", referenced from:
SkTypeface_Mac::getGlyphToUnicodeMap(int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyFamilyName", referenced from:
SkTypeface_Mac::onGetFamilyName(SkString*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetFontDescriptor(SkFontDescriptor*, bool*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyFontDescriptor", referenced from:
SkTypeface_Mac::Make(std::__1::unique_ptr<__CTFont const, SkOverloadedFunctionObject<void (void const*), &CFRelease>>, OpszVariation, std::__1::unique_ptr<SkStreamAsset, std::__1::default_delete<SkStreamAsset>>)::$_0::operator()() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkCTFontGetDataFontWeightMapping() in libskia.a(libskia.SkCTFont.o)
"_CTFontCopyFullName", referenced from:
SkTypeface_Mac::onGetFontDescriptor(SkFontDescriptor*, bool*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyGraphicsFont", referenced from:
SkTypeface_Mac::onGetUPEM() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetTableData(unsigned int, unsigned long, unsigned long, void*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onCopyTableData(unsigned int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkScalerContext_Mac::SkScalerContext_Mac(sk_sp<SkTypeface_Mac>, SkScalerContextEffects const&, SkDescriptor const*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontCopyLocalizedName", referenced from:
SkTypeface_Mac::onCreateFamilyNameIterator() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyPostScriptName", referenced from:
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetPostScriptName(SkString*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetFontDescriptor(SkFontDescriptor*, bool*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyTable", referenced from:
SkTypeface_Mac::onGetTableData(unsigned int, unsigned long, unsigned long, void*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onCopyTableData(unsigned int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyVariation", referenced from:
SkTypeface_Mac::onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkCTVariationFromSkFontArguments(__CTFont const*, __CFArray const*, SkFontArguments const&) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCopyVariationAxes", referenced from:
SkFontMgr_Mac::onMakeFromStreamArgs(std::__1::unique_ptr<SkStreamAsset, std::__1::default_delete<SkStreamAsset>>, SkFontArguments const&) const in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::getVariationAxes() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onMakeClone(SkFontArguments const&) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetVariationDesignParameters(SkFontParameters::Variation::Axis*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCreateCopyWithAttributes", referenced from:
SkFontMgr_Mac::onMakeFromStreamArgs(std::__1::unique_ptr<SkStreamAsset, std::__1::default_delete<SkStreamAsset>>, SkFontArguments const&) const in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontCreateExactCopy(__CTFont const*, double, OpszVariation) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onMakeClone(SkFontArguments const&) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontCreateCopyWithSymbolicTraits", referenced from:
create_from_name(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_CTFontCreateForString", referenced from:
SkFontMgr_Mac::onMatchFamilyStyleCharacter(char const*, SkFontStyle const&, char const**, int, int) const in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_CTFontCreatePathForGlyph", referenced from:
SkScalerContext_Mac::generateMetrics(SkGlyph*, SkArenaAlloc*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
SkScalerContext_Mac::generatePath(SkGlyph const&, SkPath*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontCreateWithFontDescriptor", referenced from:
SkFontMgr_Mac::onMatchFamilyStyle(char const*, SkFontStyle const&) const in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkFontMgr_Mac::onMatchFamilyStyleCharacter(char const*, SkFontStyle const&, char const**, int, int) const in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
(anonymous namespace)::SkFontStyleSet_Mac::createTypeface(int) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
(anonymous namespace)::SkFontStyleSet_Mac::matchStyle(SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
(anonymous namespace)::ctfont_from_skdata(sk_sp<SkData>, int) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
create_from_name(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontGetSmoothBehavior() in libskia.a(libskia.SkCTFont.o)
...
"_CTFontDescriptorCopyAttribute", referenced from:
(anonymous namespace)::SkCopyAvailableFontFamilyNames(__CTFontCollection const*)::$_2::__invoke(void const*, void*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
(anonymous namespace)::SkFontStyleSet_Mac::getStyle(int, SkFontStyle*, SkString*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontDescriptorGetSkFontStyle(__CTFontDescriptor const*, bool) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkCTFontGetDataFontWeightMapping() in libskia.a(libskia.SkCTFont.o)
"_CTFontDescriptorCreateMatchingFontDescriptors", referenced from:
SkFontMgr_Mac::CreateSet(__CFString const*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_CTFontDescriptorCreateWithAttributes", referenced from:
SkFontMgr_Mac::onMakeFromStreamArgs(std::__1::unique_ptr<SkStreamAsset, std::__1::default_delete<SkStreamAsset>>, SkFontArguments const&) const in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkFontMgr_Mac::CreateSet(__CFString const*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
create_descriptor(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontCreateExactCopy(__CTFont const*, double, OpszVariation) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onMakeClone(SkFontArguments const&) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontDrawGlyphs", referenced from:
SkCTFontGetSmoothBehavior() in libskia.a(libskia.SkCTFont.o)
SkScalerContext_Mac::Offscreen::getCG(SkScalerContext_Mac const&, SkGlyph const&, unsigned short, unsigned long*, bool) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetAdvancesForGlyphs", referenced from:
SkScalerContext_Mac::generateMetrics(SkGlyph*, SkArenaAlloc*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetAscent", referenced from:
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetBoundingBox", referenced from:
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetBoundingRectsForGlyphs", referenced from:
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkScalerContext_Mac::generateMetrics(SkGlyph*, SkArenaAlloc*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetCapHeight", referenced from:
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetDescent", referenced from:
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetGlyphCount", referenced from:
SkTypeface_Mac::getGlyphToUnicodeMap(int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onCountGlyphs() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontGetGlyphsForCharacters", referenced from:
SkTypeface_Mac::getGlyphToUnicodeMap(int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onCharsToGlyphs(int const*, int, unsigned short*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
get_plane_glyph_map(unsigned char const*, __CTFont const*, long, int*, unsigned char) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontGetLeading", referenced from:
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetSize", referenced from:
SkCTFontCreateExactCopy(__CTFont const*, double, OpszVariation) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetSlantAngle", referenced from:
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontGetSymbolicTraits", referenced from:
create_from_name(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkTypeface_Mac::Make(std::__1::unique_ptr<__CTFont const, SkOverloadedFunctionObject<void (void const*), &CFRelease>>, OpszVariation, std::__1::unique_ptr<SkStreamAsset, std::__1::default_delete<SkStreamAsset>>)::$_0::operator()() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_CTFontGetUnderlinePosition", referenced from:
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetUnderlineThickness", referenced from:
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetUnitsPerEm", referenced from:
SkTypeface_Mac::getGlyphToUnicodeMap(int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetAdvancedMetrics() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontGetXHeight", referenced from:
SkScalerContext_Mac::generateFontMetrics(SkFontMetrics*) in libskia.a(fontmgr_mac_ct.SkScalerContext_mac_ct.o)
"_CTFontManagerCreateFontDescriptorFromData", referenced from:
(anonymous namespace)::ctfont_from_skdata(sk_sp<SkData>, int) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontGetSmoothBehavior() in libskia.a(libskia.SkCTFont.o)
SkCTFontGetDataFontWeightMapping() in libskia.a(libskia.SkCTFont.o)
"_kCTFontFamilyNameAttribute", referenced from:
(anonymous namespace)::SkCopyAvailableFontFamilyNames(__CTFontCollection const*)::$_2::__invoke(void const*, void*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkFontMgr_Mac::CreateSet(__CFString const*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
create_descriptor(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_kCTFontFamilyNameKey", referenced from:
SkTypeface_Mac::onCreateFamilyNameIterator() const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontFormatAttribute", referenced from:
SkTypeface_Mac::onOpenStream(int*) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontSlantTrait", referenced from:
create_descriptor(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontDescriptorGetSkFontStyle(__CTFontDescriptor const*, bool) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontStyleNameAttribute", referenced from:
(anonymous namespace)::SkFontStyleSet_Mac::getStyle(int, SkFontStyle*, SkString*) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
"_kCTFontTraitsAttribute", referenced from:
create_descriptor(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontDescriptorGetSkFontStyle(__CTFontDescriptor const*, bool) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkCTFontGetDataFontWeightMapping() in libskia.a(libskia.SkCTFont.o)
"_kCTFontVariationAttribute", referenced from:
SkFontMgr_Mac::onMakeFromStreamArgs(std::__1::unique_ptr<SkStreamAsset, std::__1::default_delete<SkStreamAsset>>, SkFontArguments const&) const in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkTypeface_Mac::onMakeClone(SkFontArguments const&) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontVariationAxisDefaultValueKey", referenced from:
SkTypeface_Mac::onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkCTVariationFromSkFontArguments(__CTFont const*, __CFArray const*, SkFontArguments const&) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetVariationDesignParameters(SkFontParameters::Variation::Axis*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontVariationAxisIdentifierKey", referenced from:
SkTypeface_Mac::onGetVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkCTVariationFromSkFontArguments(__CTFont const*, __CFArray const*, SkFontArguments const&) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetVariationDesignParameters(SkFontParameters::Variation::Axis*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontVariationAxisMaximumValueKey", referenced from:
SkCTVariationFromSkFontArguments(__CTFont const*, __CFArray const*, SkFontArguments const&) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetVariationDesignParameters(SkFontParameters::Variation::Axis*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontVariationAxisMinimumValueKey", referenced from:
SkCTVariationFromSkFontArguments(__CTFont const*, __CFArray const*, SkFontArguments const&) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkTypeface_Mac::onGetVariationDesignParameters(SkFontParameters::Variation::Axis*, int) const in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
"_kCTFontWeightTrait", referenced from:
create_descriptor(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontDescriptorGetSkFontStyle(__CTFontDescriptor const*, bool) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
SkCTFontGetDataFontWeightMapping() in libskia.a(libskia.SkCTFont.o)
"_kCTFontWidthTrait", referenced from:
create_descriptor(char const*, SkFontStyle const&) in libskia.a(fontmgr_mac_ct.SkFontMgr_mac_ct.o)
SkCTFontDescriptorGetSkFontStyle(__CTFontDescriptor const*, bool) in libskia.a(fontmgr_mac_ct.SkTypeface_mac_ct.o)
ld: symbol(s) not found for architecture arm64
> Task :shared:linkPodDebugFrameworkIosSimulatorArm64 FAILED
error: Compilation finished with errors
FAILURE: Build failed with an exception.