Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Compiling SwiftUi for desktop when using cocoaPods fails #3134

Closed
luca992 opened this issue Jun 29, 2019 · 11 comments
Closed

Compiling SwiftUi for desktop when using cocoaPods fails #3134

luca992 opened this issue Jun 29, 2019 · 11 comments

Comments

@luca992
Copy link
Contributor

luca992 commented Jun 29, 2019

The following error is thrown:

ld: in /<path>/app/build/cocoapods/framework/app.framework/app(combined.o), 
building for UIKitForMac, but linking in object file built for macOS, file 
'//<path>/app/build/cocoapods/framework/app.framework/app' for architecture x86_64

Looks related to this
Libraries coming into the UIKit for Mac environment need to be compiled for the iOS platform, not the macOS platform.

@artdfel
Copy link
Contributor

artdfel commented Jul 1, 2019

Hello! Thank you for the report.
Can you please provide an additional information on the project?
What was the target you were building for? Is this issue reproducible for some simple project, or you cannot get it outside of the current one?

@luca992
Copy link
Contributor Author

luca992 commented Jul 1, 2019

In the kotlin project I am targeting macosX64, iosX64, iosArm64. I think it should be reproducible with any simple project. I can make one if you would like.

@artdfel
Copy link
Contributor

artdfel commented Jul 1, 2019

Okay, I see. If it is possible to have an accurate way to reproduce this, it would be very helpful.

@luca992
Copy link
Contributor Author

luca992 commented Jul 1, 2019

https://github.com/luca992/SwiftUi-Destop-Test-Project

Just open SwiftUi Kotlin Native Test/SwiftUi Kotlin Native Test.xcworkspace

Running on iphone simulator works.
Running on desktop fails with the error I reported

@michallaskowski
Copy link

FYI: CocoaPods/CocoaPods#8877 (comment)

So the code needs to be compiled with extra CFLAGS and LDFLAGS. I am yet unsure if this can be done easily in build.gradle for Kotlin Native or Multiplatform, or a bigger change is needed.

@luca992
Copy link
Contributor Author

luca992 commented Aug 2, 2019

Is there anyway to workaround this?
I tried replacing $OTHER_CFLAGS with -target x86_64-apple-ios-macabi -miphoneos-version-min=13.0 in the generated podspec file, and running pod install again. That did not help

@SvyatoslavScherbina
Copy link
Contributor

I tried replacing $OTHER_CFLAGS with -target x86_64-apple-ios-macabi -miphoneos-version-min=13.0 in the generated podspec file

This is not supposed to work.

Is there anyway to workaround this?

I'm not aware of any.

@luca992
Copy link
Contributor Author

luca992 commented Aug 6, 2019

So does a new target for swiftui desktop need to be created?
similar to this commit adding linux/arm64 support?
c3638e4

@SvyatoslavScherbina
Copy link
Contributor

This should help, but I'm not sure that this is the only option.

@luca992
Copy link
Contributor Author

luca992 commented Oct 14, 2019

related:
#3383

@SvyatoslavScherbina
Copy link
Contributor

According to migrating issue tracking to YouTrack, closing this issue in favour of https://youtrack.jetbrains.com/issue/KT-40442

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants