Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

MapboxGL on XCode Version 7.0 beta #1870

Closed

Description

@danielgomezrico

I´m one of those horrible compile error with the simple example on https://www.mapbox.com/mapbox-gl-ios/examples/. :(

My pod file:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
pod 'MapboxGL'

My view controller:

import UIKit
import MapboxGL

class MapViewController : UIViewController, MGLMapViewDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

        let mapView = MGLMapView(frame: view.bounds)
        mapView.autoresizingMask = [UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight]

        // set the map's center coordinate
        mapView.setCenterCoordinate(CLLocationCoordinate2D(latitude: 40.7326808,
            longitude: -73.9843407),
            zoomLevel: 12, animated: false)

        view.addSubview(mapView)
    }

}

Error:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_MGLMapView", referenced from:
      type metadata accessor for ObjectiveC.MGLMapView in MapViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is it a bug on Xcode or is mine?

Activity

  1. 1ec5 commented on Jul 10, 2015

    @1ec5
    Contributor

    Hi @danielgomezrico, this is a duplicate of #1849, which is caused by the new version of CocoaPods. Please add -ObjC to the OTHER_LDFLAGS (Other Linker Flags) build setting of your application target.

  2. danielgomezrico commented on Jul 10, 2015

    @danielgomezrico
    Author

    @1ec5 But I have it...

    screen shot 2015-07-09 at 9 27 31 pm

  3. friedbunny commented on Jul 10, 2015

    @friedbunny
    Contributor

    In that case, @danielgomezrico, you should try the voodoo dance of ⌘⇧K (CMD+SHIFT+K) and ⌘⌥⇧K (CMD+OPTION+SHIFT+K) to clean everything out.

  4. 1ec5 commented on Jul 10, 2015

    @1ec5
    Contributor

    You may also need to mark Pods.framework as optional instead of required in the General tab.

  5. 1ec5 commented on Jul 10, 2015

    @1ec5
    Contributor

    Oh, sorry, I had the workaround slightly wrong. Please see this comment for the real workaround: #1862 (comment).

  6. wangqianjun commented on Jul 29, 2015

    @wangqianjun

    I have the same problem:

    Undefined symbols for architecture x86_64:
    "OBJC_CLASS$_MGLMapView", referenced from:
    objc-class-ref in ViewController.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Xcode 6.4
    OSX Yosemite 10.10.4

    Now what should I do?

  7. 1ec5 commented on Jul 29, 2015

    @1ec5
    Contributor

    @wangqianjun, what version of CocoaPods and what version of MapboxGL do you have installed?

  8. AndrewBarba commented on Aug 18, 2015

    @AndrewBarba

    Same problem using Xcode 6.4 and CocoaPods 0.38.2. I checked all of the linker flags, and -ObjC is there. Simply have pod 'MapboxGL' in Podfile so assuming that is latest version

  9. 1ec5 commented on Aug 18, 2015

    @1ec5
    Contributor

    It sounds like CocoaPods has failed to set up the workspace correctly, but the same version of CocoaPods works for me. @wangqianjun and @AndrewBarba, please try installing Mapbox GL into a brand-new project. If it still exibits this issue, please ZIP up the project (podspec and all) and send it to [email protected], referencing this GitHub issue. Thank you!

  10. AndrewBarba commented on Aug 19, 2015

    @AndrewBarba

    Before I actually do that, you guys have use_frameworks! listed in Podfile but also have min platform as iOS 7.0. Everything I'm reading says that is not possible. 7.0 doesn't support frameworks so I'm not sure how anyone got that to work. Regardless I tried it with and without that line on both min targets of iOS 7 and iOS 8 and could not get it to build. With that line on a min target of iOS 7 pretty much everything blew up, on iOS 8 the Facebook SDK was having problems, I fixed those with build settings but then same error with Mapbox.

  11. 1ec5 commented on Aug 19, 2015

    @1ec5
    Contributor

    @AndrewBarba, using a dynamic framework is required if you use Swift, as the others on this page appear to be doing, because Swift code cannot link against static libraries. It is possible to run an application linked against frameworks on iOS 7; Xcode issues a warning, but that appears to be a bug in Xcode.

    Are you getting exactly the same linker error as the original reporter, or something different?

  12. AndrewBarba commented on Aug 19, 2015

    @AndrewBarba

    Sorry to be completely spitballing here (DF reader, really want to use this) but your podspec is using m.xcconfig which isn't listed in Pod docs. Have you looked at using:

    1. https://guides.cocoapods.org/syntax/podspec.html#pod_target_xcconfig
    2. https://guides.cocoapods.org/syntax/podspec.html#compiler_flags
  13. added a commit that references this issue on Aug 19, 2015
  14. 1ec5 commented on Aug 19, 2015

    @1ec5
    Contributor

    http://corinnekrych.blogspot.com/2015/04/how-well-does-swift-plays-on-ios7.html (read first comment)

    I stand corrected. But CocoaPods/swift#9 (comment) is pretty much spot on. In fact, the main benefit we’ve gotten from CocoaPods has been its ability to wrap the static library in a dynamic framework (something we’ve been planning to roll at home for #828). However, if you’re running into the validation issue because you’re backwards-deploying to iOS 7.0, you may want to consider the manual installation route, unless you’re using CocoaPods for any other packages.

    your podspec is using m.xcconfig which isn't listed in Pod docs

    Looks like our use of xcconfig dates back to cutting-room-floor/mapbox-gl-cocoa@906a1bb. pod_target_xcconfig and compiler_flags only replaced xcconfig quite recently in CocoaPods/CocoaPods#3573 in 0.38.0. I’ve opened #2132 to move over to the new flag, though I don’t know if we want to require the newest CocoaPods version so soon. Besides the Facebook SDK, what other CocoaPods packages are you using in your project?

  15. AndrewBarba commented on Aug 20, 2015

    @AndrewBarba

    We're using quite a few

    pod 'Fabric'
    pod 'Crashlytics'
    pod 'mopub-ios-sdk'
    pod 'Braintree'
    pod 'TLKit'
    pod 'Button'
    

    And TLKit, which is our private pod, uses:

    k.dependency 'AFNetworking', '~> 2.5'
    k.dependency 'SSKeychain', '~> 1.2'
    k.dependency 'PocketSocket', '~> 0.6'
    k.dependency 'FBSDKCoreKit', '~> 4.1'
    k.dependency 'FBSDKLoginKit', '~> 4.1'
    k.dependency 'SDWebImage', '~> 3.7'
    
  16. added a commit that references this issue on Aug 20, 2015
  17. added a commit that references this issue on Nov 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions