https://kotlinlang.org logo
#compose-ios
Title
# compose-ios
a

Ahmad Hassan

03/17/2023, 9:56 AM
Hi, I'm facing this issue while trying to run on iOS 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, SkFunctionWrapper<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 x86_64
Task sharedlinkDebugFrameworkIosX64 FAILED
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task 'sharedlinkDebugFrameworkIosX64'.
Compilation finished with errors
🧵 6
🧵 9
p

Pablichjenkov

03/17/2023, 1:36 PM
Are all you Composable marked
internal
? Are you using cocoapods or manually pulling the xcframework?
s

SrSouza

03/17/2023, 7:11 PM
Just curios, there any different between cocoapods and xcframework when using Compose? 👀
p

Pablichjenkov

03/17/2023, 8:08 PM
For some reason I tried to use compose-multiplatform with XC-Framework and started getting these type of build errors related to missing libskia.a symbols. Soon as I move to cocoapods the problems disappeared. All the official experimental examples use cocoapods for some reason. But I couldn’t tell other than that practical experience. Hopefully someone maintainer could better explain why. There is no official documentation for compose-multiplatform yet. The Jetbrain documentation is meant for kotlin multiplatform without compose.
Perhaps some of us should open an issue in the repo asking for an example that uses xcframework directly and not cocoapods. Perhaps one using SPM(swift package manager) too
s

SrSouza

03/17/2023, 9:24 PM
xcframework is a requirement here for me 👀 We don’t use cocoapods. @Dima Avdeev do you have any idea about this?
a

Ahmad Hassan

03/18/2023, 6:42 AM
@Pablichjenkov Yes, all composables are marked internal and using CocaPods
p

Pablichjenkov

03/18/2023, 8:23 PM
Ok, do you remember the time or change where it started to happen? Try downloading one of the templates from the experimental examples and move your code there. Also make sure kdoctor confirms your environment is properly setup
d

darkmoon_uk

03/18/2023, 11:51 PM
Please place long logs/source code in either a Slack Text Snippet or a code-block in a thread. Dumping them as regular text in the main channel is considered bad etiquette and will discourage replies. Just FYI.
d

Dima Avdeev

03/20/2023, 5:32 AM
For now, we have some limitations for Compose on iOS: • You can use a Compose library only as a static framework (in gradle isStatic=true) https://github.com/JetBrains/compose-multiplatform-template/blob/aaa6a9f7b98d4d7cd8ec95112ebe2c455fa3f688/shared/build.gradle.kts#L27 • You should add
kotlin.native.cacheKind=none
https://github.com/JetBrains/compose-multiplatform-template/blob/aaa6a9f7b98d4d7cd8ec95112ebe2c455fa3f688/gradle.properties#L9 • You should use internal
@Composable internal fun
t

tylerwilson

04/13/2023, 4:56 PM
I ran into the same build error when building our XCFramework after adding the compose for iOS common libs. Setting the isStatic flag appears to have helped. Thank you!
Now to figure out how to build it into my ios and macos targets, but not my watchos targets...
p

Pablichjenkov

04/13/2023, 5:55 PM
Just don't add watchOs, don't add iOS as target but add targets directly like iOSArm64, iOSimulatorArm64 or so
18 Views