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

[Expo] [MapLibre] module 'Mapbox' not found #1478

Closed
mlecoq opened this issue Jul 30, 2021 · 11 comments
Closed

[Expo] [MapLibre] module 'Mapbox' not found #1478

mlecoq opened this issue Jul 30, 2021 · 11 comments

Comments

@mlecoq
Copy link

mlecoq commented Jul 30, 2021

Describe the bug
I have an expo app and I would like to use MapLibre instead of MapBox

I have the following error:

› Compiling @react-native-mapbox-gl/maps Pods/react-native-mapbox-gl » FilterParser.m

❌  (node_modules/@react-native-mapbox-gl/maps/ios/RCTMGL/FilterParser.m:10:9)

   8 | 
   9 | #import "FilterParser.h"
> 10 | #import <Mapbox/Mapbox.h>
     |         ^ 'Mapbox/Mapbox.h' file not found

To Reproduce

During pod update I see

Removing Mapbox-iOS-SDK
Removing MapboxMobileEvents

but no reference to MapLibre

On android I have a similar issue:

› Compiling @react-native-mapbox-gl/maps Pods/react-native-mapbox-gl » MGLSnapshotModule.m

❌  (node_modules/@react-native-mapbox-gl/maps/ios/RCTMGL/RCTMGLUtils.h:14:9)

  12 | #import <React/RCTImageLoader.h>
  13 | 
> 14 | @import Mapbox;
     |         ^ module 'Mapbox' not found

Here is an app example :
https://github.com/mlecoq/expo-maplibre

Expected behavior
I can run MapLibre with Expo

Actual behavior
MapBox is ok but MapLibre crashes

Versions (please complete the following information):

  • Platform: Android and iOS
  • Platform OS: Android 11, iOS 14.4
  • Device: iPhone 12
  • Emulator/ Simulator: yes
  • Dev OS: osx
  • react-native-mapbox-gl Version 8.2.1
  • React Native Version 0.63
@mlecoq
Copy link
Author

mlecoq commented Jul 30, 2021

Looking at the document of expo plugins, you can pass parameters in config, in fact expo plugin in react-native-mapbox lacks a parameter to due correct configuration to use MapLibre instead of some manual updates in podfile and build.gradle

@mlecoq
Copy link
Author

mlecoq commented Jul 30, 2021

@EvanBacon you have added the expo plugin in this project. Is it doable ? I can handle it, but I would need some insights

@ferdicus
Copy link
Member

@mlecoq
Copy link
Author

mlecoq commented Jul 30, 2021

@ferdicus I have replaced

$RNMBGL_Use_SPM = true

with

$RNMBGL_Use_SPM = {
  url: "https://github.com/maplibre/maplibre-gl-native-distribution",
  requirement: {
      kind: "exactVersion",
      version: "5.11.0"
  },
  product_name: "Mapbox"
}

and then made a new install and it gaves me the same result

@f1sh1918
Copy link

f1sh1918 commented Aug 2, 2021

i'm facing a similar issue in CircleCI:

/Users/distiller/project/native/node_modules/@react-native-mapbox-gl/maps/ios/RCTMGL/RCTMGLLayer.h:15:9: module 'Mapbox' not found

@import Mapbox;

But it's working with XCode local (same version)
Really strange behavior

@f1sh1918
Copy link

f1sh1918 commented Aug 2, 2021

@ferdicus I have replaced

$RNMBGL_Use_SPM = true

with

$RNMBGL_Use_SPM = {
  url: "https://github.com/maplibre/maplibre-gl-native-distribution",
  requirement: {
      kind: "exactVersion",
      version: "5.11.0"
  },
  product_name: "Mapbox"
}

and then made a new install and it gaves me the same result

Did you manually remove swift package in XCode? Then installed v5.11?

@EvanBacon
Copy link
Contributor

I didn't add support for MapLibre, it would require a PR to add support, or just setting the package up manually and not using prebuild.

In general, this plugin is "very dangerous" because it uses regexes in an application file. We're working on a system for library authors to define postinstall / preinstall blocks for their native module as part of Expo autolinking. When that is released we can rewrite this plugin to support more features and be safer.

@mlecoq
Copy link
Author

mlecoq commented Aug 3, 2021

@ferdicus yes I have installed 5.11 manually

Configuration in podfile does not install swift package, I have to install it manually through Xcode

Installation of 5.11 looks fine, I have this log before crash

Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace expomaplibre.xcworkspace -configuration Debug -scheme expomaplibre -destination id=D874D92F-70E1-47D7-8007-DFD1983F45D6

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph

Resolved source packages:
  MapLibre GL Native: https://github.com/maplibre/maplibre-gl-native-distribution @ 5.11.0

@mlecoq
Copy link
Author

mlecoq commented Aug 3, 2021

In fact I may have made an error, with 5.11 dependency +

$RNMBGL_Use_SPM = {
  url: "https://github.com/maplibre/maplibre-gl-native-distribution",
  requirement: {
      kind: "exactVersion",
      version: "5.11.0"
  },
  product_name: "Mapbox"
}

I have now this error

Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace expomaplibre.xcworkspace -configuration Debug -scheme expomaplibre -destination id=D874D92F-70E1-47D7-8007-DFD1983F45D6

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph
artifact of binary target 'Mapbox' failed extraction: The operation couldn’t be completed. (TSCBasic.StringError error 1.)
Resolved source packages:
  MapLibre GL Native: https://github.com/maplibre/maplibre-gl-native-distribution @ 5.11.0


xcodebuild: error: Could not resolve package dependencies:
  artifact of binary target 'Mapbox' failed extraction: The operation couldn’t be completed. (TSCBasic.StringError error 1.)

@mlecoq
Copy link
Author

mlecoq commented Aug 3, 2021

Ok, I understand

Expo plugin does not add

  post_install do |installer|
    $RNMBGL.post_install(installer)
    ... other post install hooks
  end

in podfile

Adding this solves the issue, I will see if I can update expo plugin

@ferdicus
Copy link
Member

Closing this - please add a comment to this ticket as soon as you found the time to add something to the expo plugin @mlecoq

Cheers 🍻

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