maps: Chip Apple M1, unable to compile the example project in IOS simulator
Describe the bug
Error in compiling for IOS simulator in new mac M1 chip. The project compile and run correctly on physical devices for both IOS/ANDROID (ipad and android phone). This is the error i’m getting on Xcode when trying to compile for a simulator : building for iOS Simulator, but linking in dylib built for iOS, file '/Users/xxxx/xxxx/xxxx/xxxx/maps/example/ios/Pods/@react-native-mapbox-gl-mapbox-static/dynamic/MapboxMobileEvents.framework/MapboxMobileEvents' for architecture arm64
To Reproduce
- git clone git@github.com:react-native-mapbox-gl/maps.git
- cd maps
- yarn add @react-native-mapbox-gl/maps
- cd example
- yarn
- try to run example folder on an IOS simulator in new mac M1 chip
maps Package.json
{ "name": "@react-native-mapbox-gl/maps", "description": "A Mapbox GL react native module for creating custom maps", "version": "8.1.0-rc10", "publishConfig": { "access": "public" }, "author": "React Native Mapbox Team", "main": "./javascript/index.js", "keywords": [ "gl", "ios", "android", "mapbox", "react-native" ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/react-native-mapbox-gl/maps" }, "scripts": { "fetch:style:spec": ". ./scripts/download-style-spec.sh", "generate": "node ./scripts/autogenerate", "test": "npm run lint && npm run unittest", "unittest": "jest", "unittest:single": "jest --testNamePattern", "format": "npm run lint -- --fix", "lint": "eslint . --ignore-pattern 'example' --fix && cd example/ && eslint ./src --fix" }, "peerDependencies": { "prop-types": ">=15.5.8", "react": "^16.6.1", "react-native": ">=0.59.9" }, "dependencies": { "@mapbox/geo-viewport": ">= 0.4.0", "@react-native-mapbox-gl/maps": "^8.1.0-rc10", "@turf/along": ">= 4.0.0 <7.0.0", "@turf/distance": ">= 4.0.0 <7.0.0", "@turf/helpers": ">= 4.6.0 <7.0.0", "@turf/length": ">= 4.6.0 <7.0.0", "@turf/nearest-point-on-line": ">= 4.0.0 <7.0.0", "@types/geojson": "^7946.0.7", "debounce": "^1.2.0" }, "devDependencies": { "@babel/core": "7.5.0", "@babel/plugin-proposal-class-properties": "7.10.4", "@babel/plugin-transform-exponentiation-operator": "7.10.4", "@babel/plugin-transform-runtime": "7.11.5", "@babel/runtime": "7.11.2", "@react-native-community/eslint-config": "^2.0.0", "@sinonjs/fake-timers": "^6.0.0", "babel-core": "6.26.3", "babel-eslint": "^10.0.1", "documentation": "13.1.0", "ejs": "^3.1.3", "ejs-lint": "^1.1.0", "eslint": "^7.3.0", "eslint-plugin-fp": "^2.3.0", "eslint-plugin-import": "2.22.1", "husky": "4.3.0", "jest": "25.5.4", "jest-cli": "25.5.4", "lint-staged": "^10.1.3", "metro-react-native-babel-preset": "0.49.1", "node-dir": "0.1.17", "prettier": "^2.0.4", "react": "16.8.6", "react-docgen": "^5.0.0-beta.1", "react-native": "0.59.10", "react-native-testing-library": "^6.0.0", "react-test-renderer": "16.8.3", "typescript": "4.0.5" }, "jest": { "preset": "react-native", "collectCoverageFrom": [ "javascript/**/*.js" ], "setupFiles": [ "./setup-jest.js", "./__tests__/__mocks__/react-native.mock.js" ], "modulePathIgnorePatterns": [ "example", "__tests__/__mocks__" ] }, "husky": { "hooks": { "pre-commit": "lint-staged && npm run generate" } }, "lint-staged": { "*.js": [ "yarn lint" ] } }
example Package.json
{ "name": "RNMapboxGLExample", "version": "1.0.0", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ./src", "postinstall": "node ./scripts/set_access_token.js && jetifier" }, "dependencies": { "@mapbox/geo-viewport": "^0.4.0", "@mapbox/mapbox-sdk": "^0.6.0", "@react-native-community/masked-view": "^0.1.7", "@turf/along": "^5.1.5", "@turf/bbox-polygon": "^6.0.1", "@turf/bearing": "^5.1.5", "@turf/distance": "^5.1.5", "@turf/helpers": "^6.1.4", "@turf/length": "^6.0.2", "@turf/line-distance": "^4.7.3", "@turf/nearest": "^4.7.3", "@turf/nearest-point-on-line": ">= 4.0.0 <7.0.0", "buffer": "^5.1.0", "debounce": "^1.2.0", "install": "^0.12.2", "moment": "^2.24.0", "npm": "^6.13.4", "prop-types": "^15.7.2", "react": "16.13.1", "react-native": "0.63.3", "react-native-elements": "^2.2.1", "react-native-gesture-handler": "^1.6.1", "react-native-safe-area-context": "^0.7.3", "react-native-safe-area-view": "^0.13.1", "react-native-screens": "^2.4.0", "react-native-svg": "^12.1.0", "react-native-vector-icons": "6.6.0", "react-navigation": "^4.3.7", "react-navigation-stack": "^2.3.11", "url": "^0.11.0" }, "devDependencies": { "@babel/core": "^7.8.4", "@babel/runtime": "^7.8.4", "@react-native-community/eslint-config": "^1.1.0", "@types/jest": "^26.0.0", "@types/react": "^16.9.36", "@types/react-native": "^0.62.13", "@types/react-test-renderer": "^16.9.2", "@typescript-eslint/eslint-plugin": "^3.0.0", "@typescript-eslint/parser": "^3.0.0", "babel-jest": "^25.1.0", "babel-plugin-module-resolver": "^3.2.0", "eslint": "^7.3.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-import": "^2.22.0", "glob-to-regexp": "^0.4.0", "jest": "^25.1.0", "jetifier": "^1.6.4", "metro-react-native-babel-preset": "^0.59.0", "react-test-renderer": "16.13.1", "typescript": "^4.0.3" }, "jest": { "preset": "react-native", "setupFilesAfterEnv": [ "../setup-jest" ] } }
Expected behavior
Example run without a problem in IOS simulator on M1 mac
Actual behavior
Compiling error
Screenshots

- Platform: [IOS]
- Platform OS: [IOS 10]
- Simulator: [yes]
- Dev OS: [Mac Os Big Sur 11.1]
- Mac: [Apple MacBook Pro 13 M1 2020]
- Xcode: [12.3]
- react-native-mapbox-gl Version: [8.1.0-rc10]
- React Native Version: [0.63.3]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 13
- Comments: 40 (11 by maintainers)
@stale don’t mark it as stale, this issue is a huge blocker for using RN mapbox on M1 chip. Please remove the wontfix label.
This is an issue which you can only reproduce on Apple Silicon. If you’re not using Apple Silicon but rather simulating running x86, of course the issue wouldn’t be there. It’s kinda redundant to say it works on Rosetta. We can run our whole dev environments on Rosetta, but you’d be sacrificing performance and not moving forward.
I’ve tried it out just now. It compiles and runs!! This is as furthest I’ve gotten so far. This is great!!
But, the map is REALLY slow. When I try to interact with the map, I get a visual response around 5 seconds later, my app consumes 100% CPU in Activity Monitor.
The stdout is also spammed with the following:
To me it seems like the library doesn’t turn on accelerated GPU rendering and falls back to software rendering… Not sure if that’s something Mapbox even does though.
This is awesome progress, great job on getting this workaround to work!
this is not a workaround. you are just running your xcode on rosetta
It looks like the issue in upstream is resolved!!
https://github.com/mapbox/mapbox-navigation-ios/issues/2672
Can anyone try to get it running with the latest sdk? We going to need to update the sdk dependency in react-native-mapbox-gl and release a new version.
@noway Did you ever manage to either build without maplibre or solve the performance issues in iOS simulator?
Unfortunately I couldn’t build rn mapbox gl with maplibre due to this issue: https://github.com/react-native-mapbox-gl/maps/issues/1472
I was facing the same issue and tried everything. The only solution that worked for me was to run Xcode with Rosetta and it builds fine for the iOS simulator.
@mfazekas so is it fixed? which library / version should I use now?
Am I the only one who is experiencing huge issues while coding react native app. First I had issues with cocoapods, then with react-native-maps package… Seems like m1 CPU was a mistake!