maplibre-native icon indicating copy to clipboard operation
maplibre-native copied to clipboard

Make iframework doesn't seem to function

Open nvanfleet opened this issue 3 years ago • 8 comments

I can't seem to get the make iframework ... command work for me even after checking things out properly. It looks like neither dynamic or static works and they don't work in different ways 🤔

When compiling for a dynamic build:

command: make iframework BUILDTYPE=Release

Result:

...
▸ Copying Localizable.strings
▸ Processing Info.plist
▸ Generating 'Mapbox.framework.dSYM'
▸ Touching Mapbox.framework (in target 'dynamic' from project 'ios')
▸ Build Succeeded
* Copying Mapbox dynamic framework into place for iOS devices
* Copying Mapbox dSYM
* Merging device and simulator dSYMs…
fatal error: /Applications/xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: build/ios/RelWithDebInfo-iphoneos/Mapbox.framework.dSYM/Contents/Resources/DWARF/Mapbox and build/ios/RelWithDebInfo-iphonesimulator/Mapbox.framework.dSYM/Contents/Resources/DWARF/Mapbox have the same architectures (arm64) and can't be in the same fat output file
make: *** [iframework] Error 1

When building as static I get completely different output.

Command make iframework FORMAT=static BUILDTYPE=Release

Result:

FORMAT=static BUILD_DEVICE= SYMBOLS= BUILD_DOCS=true \
	./platform/ios/scripts/package.sh
* Configuring static framework for iphoneos 14.4 (symbols: YES, buildtype: RelWithDebInfo, include events:false)
Xcode 12.4
Build version 12D4e
* Recording library version…
maplibre-gl-native-ios d62ff400c6
* Building targets (build 16494, version 5.12.0)
CI environment, using platform/darwin/ci.xcconfig
* Building static framework for iOS Simulator using static scheme
▸ Running script 'CMake Rules'
    GLKit is deprecated. Consider migrating to MetalKit instead. (in target 'static' from project 'ios')
▸ Compiling MGLBackgroundStyleLayer.mm
▸ Compiling Mapbox_vers.c
▸ Compiling Mapbox_vers.c
▸ Compiling MGLUserLocationAnnotationView.m
▸ Compiling Mapbox_vers.c
▸ Compiling NSBundle+MGLAdditions.mm
▸ Compiling UIImage+MGLAdditions.mm
▸ Compiling NSURL+MGLAdditions.m
▸ Compiling MGLPointAnnotation.mm
▸ Compiling NSComparisonPredicate+MGLAdditions.mm
▸ Compiling MGLMapView+OpenGL.mm
▸ Compiling UIImage+MGLAdditions.mm

❌  /Users/nathanvanfleet/src/maplibre-gl-native/include/mbgl/util/geometry.hpp:3:10: 'mapbox/geometry/geometry.hpp' file not found

#include <mapbox/geometry/geometry.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


▸ Compiling UIColor+MGLAdditions.mm

❌  /Users/nathanvanfleet/src/maplibre-gl-native/include/mbgl/util/optional.hpp:3:10: 'optional.hpp' file not found with <angled> include; use "quotes" instead

#include <optional.hpp>
         ^~~~~~~~~~~~~~


▸ Compiling NSValue+MGLStyleAttributeAdditions.mm
▸ Compiling NSPredicate+MGLAdditions.mm

❌  /Users/nathanvanfleet/src/maplibre-gl-native/include/mbgl/util/variant.hpp:3:10: 'mapbox/variant.hpp' file not found

#include <mapbox/variant.hpp>
         ^~~~~~~~~~~~~~~~~~~~


** BUILD FAILED **


The following build commands failed:
	CompileC /Users/nathanvanfleet/src/maplibre-gl-native/platform/ios/build/ios/ios.build/RelWithDebInfo-iphonesimulator/static.build/Objects-normal/x86_64/UIImage+MGLAdditions.o /Users/nathanvanfleet/src/maplibre-gl-native/platform/ios/platform/ios/src/UIImage+MGLAdditions.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
make: *** [iframework] Error 65

nvanfleet avatar Jul 06 '21 21:07 nvanfleet

This also seems to error when I select those options from the xcode proj

nvanfleet avatar Jul 06 '21 21:07 nvanfleet

Have you tried the make xcframework BUILDTYPE=Release command to build an XCFramework instead?

nnhubbard avatar Jul 06 '21 22:07 nnhubbard

Have you tried the make xcframework BUILDTYPE=Release command to build an XCFramework instead?

To be honest my end goal is to get a static framework which the make xcframework command does not support.

I do get this output when I try xcframework though

▸ Archive Succeeded
* Creating Mapbox xcframework
Creating Mapbox.xcframework with args:  -framework build/ios/pkg/dynamic/Mapbox-iphoneos.xcarchive/Products/Library/Frameworks/Mapbox.framework -debug-symbols /Users/nathanvanfleet/src/maplibre-gl-native/platform/ios/build/ios/pkg/dynamic/Mapbox-iphoneos.xcarchive/dSYMs/Mapbox.framework.dSYM -framework build/ios/pkg/dynamic/Mapbox-iphonesimulator.xcarchive/Products/Library/Frameworks/Mapbox.framework -debug-symbols /Users/nathanvanfleet/src/maplibre-gl-native/platform/ios/build/ios/pkg/dynamic/Mapbox-iphonesimulator.xcarchive/dSYMs/Mapbox.framework.dSYM -output build/ios/pkg/dynamic/Mapbox.xcframework
xcframework successfully written out to: /Users/nathanvanfleet/src/maplibre-gl-native/platform/ios/build/ios/pkg/dynamic/Mapbox.xcframework
Mapbox.xcframework created
* Copying library resources…
LICENSE.md -> build/ios/pkg/LICENSE.md
* Generating API documentation for RelWithDebInfo Build…
OUTPUT=build/ios/pkg/documentation ./platform/ios/scripts/document.sh
* Generating readme and release notes
npm ERR! Darwin 20.5.0
npm ERR! argv "/usr/local/Cellar/node/16.4.2/bin/node" "/Users/nathanvanfleet/.npm-packages/bin/npm" "install" "--ignore-scripts"
npm ERR! node v16.4.2
npm ERR! npm  v4.0.5

npm ERR! cb.apply is not a function
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/nathanvanfleet/src/maplibre-gl-native/platform/ios/npm-debug.log
make[1]: *** [idocument] Error 1
make: *** [xcframework] Error 2

Is there just no way to get a static framework?

nvanfleet avatar Jul 06 '21 23:07 nvanfleet

I got slightly different errors when building static. Apologies, but our mainline binary artifact is a Swift binary Package. I would check ./platform/ios/scripts/package.sh to see how static is handled.


make iframework FORMAT=static BUILDTYPE=Release

FORMAT=static BUILD_DEVICE= SYMBOLS= BUILD_DOCS=true
./platform/ios/scripts/package.sh

  • Configuring static framework for iphoneos 14.4 (symbols: YES, buildtype: RelWithDebInfo, include events:false) Xcode 12.4 Build version 12D4e
  • Recording library version… maplibre-gl-native-ios 5db44ceb69
  • Building targets (build 16524, version 5.13.0-pre.1) CI environment, using platform/darwin/ci.xcconfig
  • Building static framework for iOS Simulator using static scheme GLKit is deprecated. Consider migrating to MetalKit instead. (in target 'static' from project 'ios')

❌ error: The linked library 'libmbgl-vendor-csscolorparser.a' is missing one or more architectures required by this target: arm64, i386. (in target 'static' from project 'ios')

❌ error: The linked library 'libmbgl-vendor-icu.a' is missing one or more architectures required by this target: arm64, i386. (in target 'static' from project 'ios')

❌ error: The linked library 'libmbgl-core.a' is missing one or more architectures required by this target: arm64, i386. (in target 'static' from project 'ios')

❌ error: The linked library 'libmbgl-vendor-parsedate.a' is missing one or more architectures required by this target: arm64, i386. (in target 'static' from project 'ios')

** BUILD FAILED **

make: *** [iframework] Error 65

roblabs avatar Jul 07 '21 00:07 roblabs

❌ /Users/renzhongxu/maplibre-gl-native/vendor/csscolorparser/csscolorparser/csscolorparser.hpp:28:10: 'optional.hpp' file not found

#include <optional.hpp> ^~~~~~~~~~~~~~

▸ Building library libmbgl-vendor-icu.a ▸ Compiling csscolorparser.cpp

❌ /Users/renzhongxu/maplibre-gl-native/vendor/csscolorparser/csscolorparser/csscolorparser.hpp:28:10: 'optional.hpp' file not found

#include <optional.hpp> ^~~~~~~~~~~~~~

** BUILD FAILED **

It happened to me, so how to fix it?

xurenzhong avatar Dec 07 '21 06:12 xurenzhong

@nvanfleet You have any idea to me, thanks.

xurenzhong avatar Dec 07 '21 06:12 xurenzhong

@nvanfleet You have any idea to me, thanks.

@xurenzhong

  1. The main issue is that the include directories of the static target need to be updated to be the same includes as the dynamic target (this is all in xcode).
  2. After that it should work but I think I hit some issues trying to package the framework which I never solved.

nvanfleet avatar Dec 07 '21 21:12 nvanfleet

I try many ways, but never success. if anything change, @me, thanks.

xurenzhong avatar Dec 08 '21 09:12 xurenzhong

The Makefile is no longer supported.

louwers avatar Sep 22 '23 07:09 louwers