maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
888 stars 273 forks source link

Failed to run platform ios app with bazel #2560

Closed kingfisherphuoc closed 1 week ago

kingfisherphuoc commented 1 week ago

Describe the bug I tried to run the test app on the simulator with this command: bazel run //platform/ios:App, but it did not work.

To Reproduce Steps to reproduce the behavior:

  1. Clone this repo and set up provision profile.
  2. run bazel run //platform/ios:App
  3. Got an issue as below:
INFO: Analyzed target //platform/ios:App (0 packages loaded, 0 targets configured).
/maplibre-native/platform/ios/BUILD.bazel:185:16: Linking platform/ios/App_bin failed: (Exit 1): wrapped_clang failed: error executing ObjcLink command (from target //platform/ios:App) external/apple_support~~apple_cc_configure_extension~local_config_apple_cc/wrapped_clang ... (remaining 1 argument skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ld: building for 'iOS-simulator', but linking in dylib (/opt/homebrew/Cellar/llvm@11/11.1.0_4/lib/libc++.1.0.dylib) built for 'macOS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in child process '/usr/bin/xcrun'. 1
Target //platform/ios:App failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.582s, Critical Path: 0.17s
INFO: 2 processes: 2 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

Expected behavior The build should be successful.

Platform information (please complete the following information):

louwers commented 1 week ago

Bazel can only run applications in the simulator, so make sure you have Xcode installed and at least one simulator device enabled.

Also make sure you build for Metal

bazel run //platform/ios:App --//:renderer=metal

It is easier to run with Xcode, as it will install the needed simulator on request. See https://github.com/maplibre/maplibre-native/blob/main/platform/ios/CONTRIBUTING.md#bazel to set up an Xcode project.