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

[iOS] [Mason] duplicate symbols on static library #3366

Closed
RomainQuidet opened this issue Dec 21, 2015 · 18 comments
Closed

[iOS] [Mason] duplicate symbols on static library #3366

RomainQuidet opened this issue Dec 21, 2015 · 18 comments
Labels
build iOS Mapbox Maps SDK for iOS

Comments

@RomainQuidet
Copy link
Contributor

From a clean master branch pull, I run "make ipackage".
It ends correctly (lib mapbox compiled and linked) but with warnings about duplicated symbols from geojsonvt.
When used, this library has duplicated symbols preventing our app to link.

Further more, Mason keeps old geojson libs / headers on our build machine, so it even more confused about duplicated symbols.

Mapbox lib error output:

Building static library...
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: armv7 same member name (tile.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(tile.o) and: gyp/build/Release-iphoneos/libmbgl-core.a(tile.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: armv7 same member name (transform.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(transform.o) and: gyp/build/Release-iphoneos/libmbgl-core.a(transform.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: armv7s same member name (tile.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(tile.o) and: gyp/build/Release-iphoneos/libmbgl-core.a(tile.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: armv7s same member name (transform.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(transform.o) and: gyp/build/Release-iphoneos/libmbgl-core.a(transform.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: i386 same member name (tile.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(tile.o) and: gyp/build/Release-iphonesimulator/libmbgl-core.a(tile.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: i386 same member name (transform.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(transform.o) and: gyp/build/Release-iphonesimulator/libmbgl-core.a(transform.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: x86_64 same member name (tile.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(tile.o) and: gyp/build/Release-iphonesimulator/libmbgl-core.a(tile.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: x86_64 same member name (transform.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(transform.o) and: gyp/build/Release-iphonesimulator/libmbgl-core.a(transform.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: arm64 same member name (tile.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(tile.o) and: gyp/build/Release-iphoneos/libmbgl-core.a(tile.o) due to use of basename, truncation and blank padding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: warning for architecture: arm64 same member name (transform.o) in output file used for input files: mason_packages/ios-9.2/geojsonvt/3.1.0/lib/libgeojsonvt.a(transform.o) and: gyp/build/Release-iphoneos/libmbgl-core.a(transform.o) due to use of basename, truncation and blank padding
Created build/ios/pkg/static/libMapbox.a
@1ec5
Copy link
Contributor

1ec5 commented Dec 21, 2015

If the issue is in Mason, please report the bug in that repo.

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS build labels Dec 21, 2015
@RomainQuidet
Copy link
Contributor Author

@1ec5 I don't know yet, I'm trying to understand your project generation / compilation process, it's quite obscure for me. But the issue for me is on mapbox scripts, they include the libgeojsonvt.a in the final static lib, but it seems already included from libmbgl-core.a

@1ec5
Copy link
Contributor

1ec5 commented Dec 21, 2015

@mikemorris, I’m seeing these warnings too. Any idea what’s changed?

@RomainQuidet
Copy link
Contributor Author

@1ec5 you don't see the issue on the demo app as it is not using the final lib as third party developers do

@1ec5
Copy link
Contributor

1ec5 commented Dec 21, 2015

Regarding the old versions of the libraries, be sure to run make clean && make distclean (and possibly rm -rf gyp/build/) if you haven’t done so recently.

@RomainQuidet
Copy link
Contributor Author

@1ec5 we always do a make clean, I haven't see the distclean ! I'll try thanks

@RomainQuidet
Copy link
Contributor Author

Seems that core.gypi sets the core lib including geojsonvt static lib, and again in package.sh, the last step "building static library..." add again the geojsonvt static lib .a file...

@RomainQuidet
Copy link
Contributor Author

after several tests, it seems that the libmapbox.a is ok, but libtool has issues with fat lib... I don't see any duplicated symbols in libmapbox.a.
Libtool had a bug like that back in 2010, maybe it's back again...

@mikemorris
Copy link
Contributor

Okay, so the double-linking of geojsonvt.a was implemented in 79a5a96, IIRC because the geojsonvt.a symbols linked in core.gypi are optimized of the core.a static library (the code paths are only used by platform implementations), so the symbols were missing unless explicitly linked in platform/ios/scripts/package.sh - I'm pretty sure this is an issue specific to our build system, not a general mason bug.

@mikemorris
Copy link
Contributor

libtool has issues with fat lib

libtool as used in package.sh or as part of your app build system @RomainQuidet?

@RomainQuidet
Copy link
Contributor Author

@mikemorris Hi. Libtool is used by your package.sh as standard build mechanism (behind xcode-build).
The build mechanism is loosing Xcode tools somewhere because of the double include. This prevent us to use the mapbox lib for the moment.

@mikemorris
Copy link
Contributor

I'm seeing this issue as far back as 79a5a96, but I don't recall seeing this at all during earlier testing - I wonder if this could be related to the version of libtool packaged with a newer release of Xcode? I'm reproducing this with Version 7.2 (7C68)

@1ec5 1ec5 self-assigned this Dec 22, 2015
@1ec5
Copy link
Contributor

1ec5 commented Dec 22, 2015

Also reproduces in Xcode 7.1.

@1ec5
Copy link
Contributor

1ec5 commented Dec 22, 2015

This is related to the new Xcode version, but it isn’t libtool:

  1. sudo xcode-select -s /Applications/Xcode-72.app/
  2. make clean && make distclean && rm -rf gyp/build && make ipackage-sim
  3. Link from an application in Xcode 7.2.
    • Linker errors
  4. sudo xcode-select -s /Applications/Xcode-71.app/
  5. make ipackage-sim
  6. Link from an application in Xcode 7.2.
    • Linker errors
  7. sudo xcode-select -s /Applications/Xcode-71.app/
  8. make clean && make distclean && rm -rf gyp/build && make ipackage-sim
  9. Link from an application in Xcode 7.2.
    • Success

Also, geojsonvt-3.1.0 landed in Mason just within the last week, and we started using it then: #3290. I wonder whether there are any relevant differences with geojsonvt-3.0.1.

/cc @kkaefer

@1ec5 1ec5 added this to the ios-v3.1.0 milestone Dec 22, 2015
@1ec5
Copy link
Contributor

1ec5 commented Dec 23, 2015

The warnings themselves are slightly older than the linker errors: due to mapbox/geojson-vt-cpp@a55d31c and mapbox/geojson-vt-cpp@cc08ac5, libgeojsonvt and libmbgl-core have two compilation units with the same name (tile.cpp and transform.cpp). This collision has occurred since we started using v3.0.0 of libgeojsonvt in #3232.

/cc @mourner

@1ec5 1ec5 removed their assignment Dec 23, 2015
@1ec5
Copy link
Contributor

1ec5 commented Dec 23, 2015

@RomainQuidet, after running make clean && make distclean && rm -rf gyp/build/, then either make ipackage or make iframework, I no longer see link errors when linking the static library into an application for the simulator. I believe rm -rf gyp/build/ was the difference.

The warnings remain, so I’m leaving this ticket open to track them.

@1ec5 1ec5 removed this from the ios-v3.1.0 milestone Dec 23, 2015
@mikemorris
Copy link
Contributor

@1ec5 We should probably add rm -rf gyp/build/ to either make clean or make distclean tasks.

@1ec5
Copy link
Contributor

1ec5 commented Apr 18, 2016

No longer seeing this issue after #4641 landed.

@1ec5 1ec5 closed this as completed Apr 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

3 participants