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.

investigate fitBounds link errors #1859

Closed

Description

@incanus

We've seen this in a couple places now (like #1822 (comment)) and it does not seem to be limited to non-Travis builds.

Undefined symbols for architecture x86_64:
  "mbgl::Map::fitBounds(std::__1::vector<mbgl::LatLng, std::__1::allocator<mbgl::LatLng> >, mbgl::$_1, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> >)", referenced from:
      -[MGLMapView setVisibleCoordinates:count:edgePadding:animated:] in libMapboxGL.a(MGLMapView.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I went back through the routines around mbgl::Map::fitBounds to see if anything looked amiss. I think I have a few things; not sure how relevant they are.

  • We use INFINITY and std::fmax/std::fmin/std::log2 etc. but don't #import <cmath>.

  • Use of vec2<> without a type, like so:

    vec2<> swPixel = pixelForLatLng(bounds.sw);
    

    This isn't very explicit at the very least, but could it also be introducing some problems?

  • Static analyzer run comes up pretty clean.

    screen shot 2015-07-08 at 10 06 58 pm

Anything jump out at anyone?

@1ec5 @kkaefer @springmeyer @tmpsantos @brunoabinader

Activity

  1. added this to the iOS Beta 3 milestone on Jul 9, 2015
  2. added a commit that references this issue on Jul 9, 2015
  3. self-assigned this
    on Jul 9, 2015
  4. incanus commented on Jul 9, 2015

    @incanus
    ContributorAuthor

    To clarify what is happening here, the build is finishing fully and appears fine, but folks using it externally sometimes see this link problem when trying to compile. This could be related to the way that we test GL inline vs. as a static library. Though I haven't seen this problem with our own static library (via Swift) usage.

  5. 1ec5 commented on Jul 9, 2015

    @1ec5
    Contributor

    vec2 is declared to be double by default. The remaining static analyzer warnings are covered upstream. Importing cmath is a good idea, plus vector if we aren't already somewhere. Is there anything unusual about how LatLng is defined?

  6. springmeyer commented on Jul 9, 2015

    @springmeyer
    Contributor

    This might be a conflict with -stdlib. Is this replicable if you try linking a sample app against libmbgl with -stdlib=libstdc++ (which is wrong, should be -stdlib=libc++)?

  7. incanus commented on Jul 9, 2015

    @incanus
    ContributorAuthor

    Going to build a test project to replicate this first, that we can track in VCS and get to the bottom of this.

  8. incanus commented on Jul 9, 2015

    @incanus
    ContributorAuthor

    Replicated:

    https://github.com/incanus/LinkerTest

    This is an Objective-C app, downloading RC 1 w/o symbols and using the binary install method. Went through the setup instructions, then tried to build and got the fitBounds compile error.

  9. incanus commented on Jul 9, 2015

    @incanus
    ContributorAuthor

    Link problem doesn't happen on the the -symbols version (which is why we don't typically see it).

  10. added a commit that references this issue on Jul 9, 2015
  11. added 2 commits that reference this issue on Jul 9, 2015
  12. incanus commented on Jul 9, 2015

    @incanus
    ContributorAuthor

    This was related to the declaration of EdgeInsets prior to 3318a3c, which created an anonymous struct that was causing problems with the fitBounds function symbols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions