Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating binaries from SDK for wrapping into XCFramework fails #60

Open
mindthefish opened this issue Jun 13, 2024 · 8 comments
Open

Creating binaries from SDK for wrapping into XCFramework fails #60

mindthefish opened this issue Jun 13, 2024 · 8 comments

Comments

@mindthefish
Copy link
Contributor

I am working on a fork of the SDK with some closed-source additions. I need the ability to deploy the SDK as a binary. So far I am using the pre-SPM version which I can compile using xcodebuild archive, xcodebuild -create-xcframework or Carthage. Since the switch to SPM, this option is no longer available, so I try to build the current version (main branch) via swift build or swift create-xc-framework. Unfortunately I encounter errors when building the dependencies.

Steps to Trigger Behavior

  1. checkout the main branch of this repo
  2. archive the targets specified in the Package.swift using xcodebuild or swift commands
  3. bundle the archives to a XCFramework

Expected Behavior

Build / archive command should complete without errors

Actual Behavior

I.e. swift build leads to error: ".../maplibre-navigation-ios/MapboxNavigationObjC/MLNMapView+MLNNavigationAdditions.h:1:9: fatal error: 'MapLibre/Mapbox.h' file not found
#import <MapLibre/Mapbox.h>
^~~~~~~~~~~~~~~~~~~
1 error generated."

Version(s) affected

  • main branch at (commit eaee92b), but I think this applies to all versions since change to SPM.

Has anyone ever tried to build maplibre-navigation-ios as a binary? I want to deploy it as XCFramework binary as part of a Swift package.

@michaelkirk
Copy link
Collaborator

I hit a similar error when trying to generate documentation: #52 (comment)

@mindthefish
Copy link
Contributor Author

Sounds like the same problem.

@mr-rick
Copy link

mr-rick commented Jul 17, 2024

I'm seeing the same thing as well

@mr-rick
Copy link

mr-rick commented Jul 31, 2024

Can you give me a hint or lead me in the right direction to get this going? I'm happy to help here... I'm just not an expert on the subject matter.

This will help us in the flutter world.

Thanks!

-Rick

@brandub
Copy link

brandub commented Aug 2, 2024

Same issue here. Also needing this for flutter dev.

@brandub
Copy link

brandub commented Aug 21, 2024

Do you think this PR will solve this issue as well?? #95

@michaelkirk
Copy link
Collaborator

I don't expect it to.

@mindthefish
Copy link
Contributor Author

Can you give me a hint or lead me in the right direction to get this going? I'm happy to help here... I'm just not an expert on the subject matter.

This will help us in the flutter world.

Thanks!

-Rick

The workaround for me was to create an Xcode project and rebuild the Package.swift, so creating targets for MapboxNavigation, MapboxNavigationObjC, MapboxCoreNavigation, and MapboxCoreNavigationObjC. Stitching together all the dependencies like in the Package.swift and getting the targets to compile was some hassle and I am still struggling with the ObjC imports, as SPM needs double-quoted imports and xcodebuild/Carthage needs angle-bracket imports. What I am trying is to set preprocessing flags but I couldn't get them to work until now, so I adjust the import each time I need them one way or another:

#ifdef SPM
    #warning "SPM is defined"
    #import "../MBRouteVoiceController.h"
    #import "../MLNMapView+MLNNavigationAdditions.h"
#else
    #warning "SPM is not defined"
    #import <MapboxNavigationObjC/MBRouteVoiceController.h>
    #import <MapboxNavigationObjC/MLNMapView+MLNNavigationAdditions.h>
#endif

I know that building an Xcode project in conjunction with Cartfiles is a step backwards, but for me it was the only way to build an XCFramework with MapLibre as a binary dependency.

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

No branches or pull requests

4 participants