Closed brawer closed 5 months ago
@brawer You need to be in the platform/ios
directory and also initialize the submodules.
git clone --recurse-submodules https://github.com/maplibre/maplibre-gl-native.git
npm install
cd maplibre-gl-native/platform/ios
Let me know if it works for you.
Hm, I’m still getting an error. However, after installing xcpretty
, the compile goes further. So apparently, xcpretty
is not really optional, even though the build instructions claim this.
To reproduce on a machine that doesn’t have xcpretty
installed:
git clone --recurse-submodules https://github.com/maplibre/maplibre-gl-native.git
cd maplibre-gl-native
npm install
cd platform/ios
make xpackage
Error:
$ make xpackage
mkdir -p "platform/macos/macos.xcworkspace/xcuserdata/sascha.xcuserdatad"
cp platform/macos/WorkspaceSettings.xcsettings "platform/macos/macos.xcworkspace/xcuserdata/sascha.xcuserdatad/WorkspaceSettings.xcsettings"
mkdir -p build/macos
(cd build/macos && cmake -G Xcode ../../../../ \
-DCMAKE_SYSTEM_NAME=Darwin )
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- The C compiler identification is AppleClang 14.0.0.14000029
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring GL-Native with OpenGL renderer backend
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/OpenGL.framework
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Checking for one of the modules 'glfw3'
-- [Node.js] Downloading Node.js version list...
-- [Node.js] Downloading Nan 2.14.2...
-- [Node.js] Downloading headers for Node v18.13.0...
-- [Node.js] Downloading headers for Node v17.9.1...
-- [Node.js] Downloading headers for Node v16.19.0...
-- [Node.js] Downloading headers for Node v15.14.0...
-- [Node.js] Downloading headers for Node v14.21.2...
-- [Node.js] Downloading headers for Node v13.14.0...
-- [Node.js] Downloading headers for Node v12.22.12...
-- [Node.js] Downloading headers for Node v11.15.0...
-- [Node.js] Downloading headers for Node v10.24.1...
-- [Node.js] Downloading headers for Node v9.11.2...
-- [Node.js] Downloading headers for Node v8.17.0...
-- Checking for one of the modules 'libuv'
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sascha/src/maplibre-gl-native/platform/ios/build/macos
SYMBOLS= ./platform/macos/scripts/package.sh
CI environment, using platform/darwin/ci.xcconfig
* Building dynamic framework (build 16804, version 0.19.1)…
./platform/macos/scripts/package.sh: line 46: xcpretty: command not found
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:C31D7C29-563E-5350-9723-563C13A7778E }
{ platform:macOS, name:Any Mac }
make: *** [xpackage] Error 127
After installing xcpretty
, the compile still produces a series of errors. (I’m a little surprised that a harmless make
command is updating system packages via brew update
, but whatever...)
$ make xpackage
SYMBOLS= ./platform/macos/scripts/package.sh
CI environment, using platform/darwin/ci.xcconfig
* Building dynamic framework (build 16804, version 0.19.1)…
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:x86_64, id:C31D7C29-563E-5350-9723-563C13A7778E }
{ platform:macOS, name:Any Mac }
▸ Running script 'Generate CMakeFiles/ZERO_CHECK'
▸ Build Succeeded
* Copying dynamic framework into place
* Building and archiving Mapbox GL.app (build 16804, version 0.19.1)…
* Creating local podspec…
* Copying library resources…
LICENSE.md -> build/macos/pkg/LICENSE.md
platform/macos/docs/pod-README.md -> build/macos/pkg/README.md
* Generating API documentation…
OUTPUT=build/macos/pkg/documentation ./platform/macos/scripts/document.sh
Using config file /Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/jazzy.yml
<unknown>:0: remark: did not find a prebuilt standard library for target 'x86_64-apple-macos' compatible with this Swift compiler; building it may take a few minutes, but it should only happen once for this combination of compiler and target
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:88:63: error: expected a type
- (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:88:98: error: expected a type
- (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:182:62: error: expected a type
- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:212:88: error: no type or protocol named 'MGLAnnotation'
- (nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MGLAnnotation>)annotation;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:244:4: error: expected a type
- (NSColor *)mapView:(MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:259:4: error: expected a type
- (NSColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:295:64: error: no type or protocol named 'MGLAnnotation'
- (void)mapView:(MGLMapView *)mapView didSelectAnnotation:(id <MGLAnnotation>)annotation;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:305:66: error: no type or protocol named 'MGLAnnotation'
- (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id <MGLAnnotation>)annotation;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:330:69: error: no type or protocol named 'MGLAnnotation'
- (BOOL)mapView:(MGLMapView *)mapView annotationCanShowCallout:(id <MGLAnnotation>)annotation;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:348:13: error: expected a type
- (nullable NSViewController *)mapView:(MGLMapView *)mapView calloutViewControllerForAnnotation:(id <MGLAnnotation>)annotation;
^
/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h:348:102: error: no type or protocol named 'MGLAnnotation'
- (nullable NSViewController *)mapView:(MGLMapView *)mapView calloutViewControllerForAnnotation:(id <MGLAnnotation>)annotation;
^
<unknown>:0: error: failed to import bridging header '/Users/sascha/src/maplibre-gl-native/platform/ios/platform/macos/src/MGLMapViewDelegate.h'
91% documentation coverage with 89 undocumented symbols
included 1108 symbols
building site
building search index
jam out ♪♫ to your fresh new docs in `build/macos/pkg/documentation`
* Checking that all public symbols are exported…
Installing SourceKitten via Homebrew…
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
check-jsonschema
copa
kwok
okta-awscli
pipdeptree
scriptisto
You have 14 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
./platform/macos/src/MGLMapViewDelegate.h:88:63: error: expected a type
- (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera;
^
./platform/macos/src/MGLMapViewDelegate.h:88:98: error: expected a type
- (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera;
^
./platform/macos/src/MGLMapViewDelegate.h:182:62: error: expected a type
- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style;
^
./platform/macos/src/MGLMapViewDelegate.h:212:88: error: no type or protocol named 'MGLAnnotation'
- (nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MGLAnnotation>)annotation;
^
./platform/macos/src/MGLMapViewDelegate.h:244:4: error: expected a type
- (NSColor *)mapView:(MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation;
^
./platform/macos/src/MGLMapViewDelegate.h:259:4: error: expected a type
- (NSColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation;
^
./platform/macos/src/MGLMapViewDelegate.h:295:64: error: no type or protocol named 'MGLAnnotation'
- (void)mapView:(MGLMapView *)mapView didSelectAnnotation:(id <MGLAnnotation>)annotation;
^
./platform/macos/src/MGLMapViewDelegate.h:305:66: error: no type or protocol named 'MGLAnnotation'
- (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id <MGLAnnotation>)annotation;
^
./platform/macos/src/MGLMapViewDelegate.h:330:69: error: no type or protocol named 'MGLAnnotation'
- (BOOL)mapView:(MGLMapView *)mapView annotationCanShowCallout:(id <MGLAnnotation>)annotation;
^
./platform/macos/src/MGLMapViewDelegate.h:348:13: error: expected a type
- (nullable NSViewController *)mapView:(MGLMapView *)mapView calloutViewControllerForAnnotation:(id <MGLAnnotation>)annotation;
^
./platform/macos/src/MGLMapViewDelegate.h:348:102: error: no type or protocol named 'MGLAnnotation'
- (nullable NSViewController *)mapView:(MGLMapView *)mapView calloutViewControllerForAnnotation:(id <MGLAnnotation>)annotation;
^
<unknown>:0: error: failed to import bridging header 'platform/macos/src/MGLMapViewDelegate.h'
All symbols are correctly exported.
These errors also happen on CI: https://pipelines.actions.githubusercontent.com/serviceHosts/5d681c24-07f8-4885-befb-2fb4ef8870f8/_apis/pipelines/1/runs/4763/signedlogcontent/2?urlExpires=2023-01-23T16%3A36%3A13.1698882Z&urlSigningMethod=HMACV1&urlSignature=re3x3r28iAFKPxfBfm7eigY9K%2BR8c5M7rTlNdBlJx30%3D
@louwers I cannot open the above URL. If same error is reproducible on CI then I think we should try to fix it in CI.
I'm also unable to build for macOS., but not even getting as far as @brawer in the building progress. Getting lots of errors like:
❌ error: Build input file cannot be found: '/Users/ryan/maplibre-gl-native/platform/ios/platform/darwin/src/MGLBackgroundStyleLayer.mm'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'dynamic' from project 'macos')
and
The following build commands failed:
CompileC /Users/ryan/maplibre-gl-native/platform/ios/build/macos/macos.build/Debug/dynamic.build/Objects-normal/x86_64/NSPredicate+MGLAdditions.o /Users/ryan/maplibre-gl-native/platform/ios/platform/darwin/src/NSPredicate+MGLAdditions.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'dynamic' from project 'macos')
CompileC /Users/ryan/maplibre-gl-native/platform/ios/build/macos/macos.build/Debug/dynamic.build/Objects-normal/x86_64/MGLVectorTileSource.o /Users/ryan/maplibre-gl-native/platform/ios/platform/darwin/src/MGLVectorTileSource.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'dynamic' from project 'macos')
If I can get this thing built, I'd love to contribute to the project. Unfortunately I have no experience with Makefiles and such.
Coud you try using
make xproj
in projects/ios
.
Great! Thank you @louwers. For anyone coming after, here's my full set of steps to build for MacOS:
git clone --recurse-submodules http://github.com/maplibre/maplibre-gl-native.git
cd maplibre-gl-native
npm install
cd platform/ios
make xproj
make xpackage
I haven't had a chance to run the sample app or put the framework into my app yet, but once I do I'll let you know how it goes :-)
Okay, I took some time to try out the package, but I've run into some more issues. Thanks again in advance for any more help you can offer :-)
First, I tried just running the macosapp
target in the macos
project (the project that was built automatically during the make xproj
process), and the build failed with these two errors:
framework not found Mapbox
library not found for -lmbgl-core
Next, I tried installing the framework into my own project, using the instructions (step 1) here, and then building my project, but got this warning during the build:
Ignoring file /{path}/Mapbox.framework/Mapbox, building for macOS-x86_64 but attempting to link with file built for iOS-arm64
And, of course, the framework wasn't built and couldn't be imported in the project.
Thanks again for your help!
This file is gone.
The build instructions for macOS appear to be broken; possibly out of date?
To Reproduce Follow the instructions of https://github.com/maplibre/maplibre-gl-native/blob/main/platform/ios/platform/macos/INSTALL.md#building-the-sdk-from-source:
git clone https://github.com/maplibre/maplibre-gl-native.git
cd maplibre-gl-native
make xpackage
Expected Should compile, as described in instructions.
Observed
Platform macOS 13.1 (build 22C65), Xcode 14.2 (build 14C18)