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

[DO NOT MERGE] Install GeoJSONVT v2.1.6.1 from mason - #2489

Closed
mikemorris wants to merge 5 commits into
masterfrom
geojsonvt-v2.1.6.1
Closed

mikemorris wants to merge 5 commits into
masterfrom
geojsonvt-v2.1.6.1

Conversation

@mikemorris

Copy link
Copy Markdown
Contributor

TODO:

AFTER MERGE:

/cc @jfirebaugh @kkaefer

@mikemorris mikemorris added the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Oct 1, 2015
@mikemorris

Copy link
Copy Markdown
Contributor Author

On hold while we reexamine the linker errors #2237 (comment)

@mikemorris

Copy link
Copy Markdown
Contributor Author

Seeing many similar linker warnings to the one below on OS X 10.11 locally and on Travis:

ld: warning: direct access in mapbox::util::geojsonvt::Convert::convertGeometry(std::__1::vector<mapbox::util::geojsonvt::ProjectedFeature, std::__1::allocator<mapbox::util::geojsonvt::ProjectedFeature> >&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&, double) to global weak symbol guard variable for rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >& rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::operator[]<rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&)::NullValue means the weak symbol cannot be overridden at runtime.
This was likely caused by different translation units being compiled with different visibility settings.

https://travis-ci.org/mapbox/mapbox-gl-native/jobs/83385450

iOS tests are failing on Travis with an error that looks more like the Linux/gcc linker error:

⌦  ld: symbol(s) not found for architecture i386
⌦  clang: error: linker command failed with exit code 1 (use -v to see invocation)
Testing failed:
    "mapbox::util::geojsonvt::Convert::create(std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >, mapbox::util::geojsonvt::ProjectedFeatureType, mapbox::util::variant<mapbox::util::geojsonvt::ProjectedPoint, mapbox::util::geojsonvt::ProjectedGeometryContainer>)", referenced from:
    "mapbox::util::geojsonvt::Convert::project(std::__1::vector<mapbox::util::geojsonvt::LonLat, std::__1::allocator<mapbox::util::geojsonvt::LonLat> > const&, double)", referenced from:
    "mapbox::util::geojsonvt::GeoJSONVT::getTile(unsigned char, unsigned int, unsigned int)", referenced from:
    "mapbox::util::geojsonvt::GeoJSONVT::GeoJSONVT(std::__1::vector<mapbox::util::geojsonvt::ProjectedFeature, std::__1::allocator<mapbox::util::geojsonvt::ProjectedFeature> >, unsigned char, unsigned char, unsigned int, bool, double)", referenced from:
    Linker command failed with exit code 1 (use -v to see invocation)
** TEST FAILED **
The following build commands failed:
    Ld /Users/travis/Library/Developer/Xcode/DerivedData/ios-tests-crpfasqgvczlpjckmmbbigcxequw/Build/Intermediates/ios-tests.build/Release-iphonesimulator/Mapbox\ GL\ Tests.build/Objects-normal/i386/Mapbox\ GL\ Tests normal i386
(1 failure)

@mikemorris mikemorris mentioned this pull request Oct 2, 2015
4 tasks done
@mikemorris

Copy link
Copy Markdown
Contributor Author

Flagging 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', as it may affect visibility of GeoJSONVT internal deps?

@mikemorris
mikemorris force-pushed the geojsonvt-v2.1.6.1 branch 2 times, most recently from f4c380e to be86504 Compare October 2, 2015 21:42
@mikemorris

Copy link
Copy Markdown
Contributor Author

Refs #2502

@mikemorris

Copy link
Copy Markdown
Contributor Author

Pretty sure the iOS linker errors are a different symptom of the same issue causing

ld: warning: direct access in mapbox::util::geojsonvt::Convert::convertGeometry
NullValue means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

The iOS mason binary build script doesn't look like it's missing any architectures, tried rebuilding the binaries but they built as expected and didn't fix anything.

This error looks like https://stackoverflow.com/questions/9894961/strange-warnings-from-the-linker-ld/9954259#9954259

/cc @incanus @1ec5

@mikemorris

Copy link
Copy Markdown
Contributor Author

Uh, so it turns out that I may have been mistaken about mapbox/geojson-vt-cpp#12 - it looks like #2476 was actually the solution to the missing labels bug AND the cause of the ld: warning: direct access linker warnings when switching to mason GeoJSONVT (MBGL and GeoJSONVT both have a dependency on the mason RapidJSON headers now, which get compiled with -fvisibility-inlines-hidden in GeoJSONVT, but not in MBGL because mason just ships uncompiled headers and MBGL doesn't set this flag). Looks like I may have gotten "lucky" with a rebase onto master and thought I fixed the bug when I actually didn't.

/cc @jfirebaugh

@mikemorris

Copy link
Copy Markdown
Contributor Author

Noticed that GCC_SYMBOLS_PRIVATE_EXTERN: YES in xcode_settings sets -fvisibility=hidden in CFLAGS and -fvisibility-inlines-hidden in CXXFLAGS, whereas mason only sets -fvisibility-inlines-hidden in CXXFLAGS.

@mikemorris

Copy link
Copy Markdown
Contributor Author

1930740 fixed the linker warnings on OS X. Still haven't been able to track down the iOS linker error though (been working in https://github.com/mapbox/mapbox-gl-native/tree/geojsonvt-2.1.6-gcc-5).

@mikemorris mikemorris mentioned this pull request Oct 7, 2015
@jfirebaugh
jfirebaugh force-pushed the geojsonvt-v2.1.6.1 branch 3 times, most recently from 7f49901 to 3d92ab6 Compare October 8, 2015 00:20
@mikemorris

Copy link
Copy Markdown
Contributor Author

Running nm mason_packages/ios-9.0/geojsonvt/2.1.6/lib/libgeojsonvt.a I'm seeing the "missing" symbol the linker is complaining about on iOS tests, trying to get the linker to print it un-demangled now...

0000000000004590 T __ZN6mapbox4util9geojsonvt7Convert6createENSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_NS3_4lessISA_EENS8_INS3_4pairIKSA_SA_EEEEEENS1_20ProjectedFeatureTypeENS0_7variantIJNS1_14ProjectedPointENS1_26ProjectedGeometryContainerEEEE

@mikemorris

Copy link
Copy Markdown
Contributor Author

I found an undefined symbol in nm build/Release-iphonesimulator/libmbgl-core.a

U __ZN6mapbox4util9geojsonvt7Convert6createENSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_NS3_4lessISA_EENS8_IN
S3_4pairIKSA_SA_EEEEEENS1_20ProjectedFeatureTypeENS0_7variantIJNS1_14ProjectedPointENS1_26ProjectedGeometryContainerEEEE
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list0000000000000000 T __ZN4mbgl17createSpriteImag
eERKNS_4util5ImageEttttdb

@mikemorris

Copy link
Copy Markdown
Contributor Author

It looks like some symbols from geojsonvt are undefined in annotation_manager.o

nm -m build/mbgl.build/Release-iphonesimulator/core.build/Objects-normal/x86_64/annot
ation_manager.o | grep geojson
00000000004944f0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZN6mapbox4util7variantIJNS0_9geojsonvt14ProjectedPointENS2_26ProjectedGeometryContainerEEED1Ev
                 (undefined) external __ZN6mapbox4util9geojsonvt7Convert6createENSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_NS3_4lessISA_EENS8_INS3_4pairIKSA_SA_EEEEEENS1_20ProjectedFeatureTypeENS0_7variantIJNS1_14ProjectedPointENS1_26ProjectedGeometryContainerEEEE
                 (undefined) external __ZN6mapbox4util9geojsonvt7Convert7projectERKNSt3__16vectorINS1_6LonLatENS3_9allocatorIS5_EEEEd
                 (undefined) external __ZN6mapbox4util9geojsonvt9GeoJSONVT7getTileEhjj
                 (undefined) external __ZN6mapbox4util9geojsonvt9GeoJSONVTC1ENSt3__16vectorINS1_16ProjectedFeatureENS3_9allocatorIS5_EEEEhhjbdb
00000000004983e0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__112__hash_tableINS_17__hash_value_typeIjNS_10unique_ptrIN6mapbox4util9geojsonvt9GeoJSONVTENS_14default_deleteIS6_EEEEEENS_22__unordered_map_hasherIjSA_NS_4hashIjEELb1EEENS_21__unordered_map_equalIjSA_NS_8equal_toIjEELb1EEENS_9allocatorISA_EEE20__node_insert_uniqueEPNS_11__hash_nodeISA_PvEE
000000000049bb00 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__112__hash_tableINS_17__hash_value_typeIjNS_10unique_ptrIN6mapbox4util9geojsonvt9GeoJSONVTENS_14default_deleteIS6_EEEEEENS_22__unordered_map_hasherIjSA_NS_4hashIjEELb1EEENS_21__unordered_map_equalIjSA_NS_8equal_toIjEELb1EEENS_9allocatorISA_EEE5eraseENS_21__hash_const_iteratorIPNS_11__hash_nodeISA_PvEEEE
00000000004985e0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__112__hash_tableINS_17__hash_value_typeIjNS_10unique_ptrIN6mapbox4util9geojsonvt9GeoJSONVTENS_14default_deleteIS6_EEEEEENS_22__unordered_map_hasherIjSA_NS_4hashIjEELb1EEENS_21__unordered_map_equalIjSA_NS_8equal_toIjEELb1EEENS_9allocatorISA_EEE6rehashEm
00000000004986f0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__112__hash_tableINS_17__hash_value_typeIjNS_10unique_ptrIN6mapbox4util9geojsonvt9GeoJSONVTENS_14default_deleteIS6_EEEEEENS_22__unordered_map_hasherIjSA_NS_4hashIjEELb1EEENS_21__unordered_map_equalIjSA_NS_8equal_toIjEELb1EEENS_9allocatorISA_EEE8__rehashEm
00000000004982b0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__113__vector_baseIN6mapbox4util9geojsonvt11TileFeatureENS_9allocatorIS4_EEED2Ev
0000000000494550 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__113unordered_mapIjNS_10unique_ptrIN6mapbox4util9geojsonvt9GeoJSONVTENS_14default_deleteIS5_EEEENS_4hashIjEENS_8equal_toIjEENS_9allocatorINS_4pairIKjS8_EEEEE7emplaceIJRSF_S8_EEENSE_INS_19__hash_map_iteratorINS_15__hash_iteratorIPNS_11__hash_nodeINS_17__hash_value_typeIjS8_EEPvEEEEEEbEEDpOT_
00000000004981f0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__16__treeINS_12__value_typeIyN6mapbox4util9geojsonvt4TileEEENS_19__map_value_compareIyS6_NS_4lessIyEELb1EEENS_9allocatorIS6_EEE7destroyEPNS_11__tree_nodeIS6_PvEE
00000000004970f0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__16vectorIN6mapbox4util7variantIJNS2_9geojsonvt14ProjectedPointENS4_26ProjectedGeometryContainerEEEENS_9allocatorIS7_EEE21__push_back_slow_pathIS7_EEvOT_
00000000004973c0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__16vectorIN6mapbox4util7variantIJNS2_9geojsonvt14ProjectedPointENS4_26ProjectedGeometryContainerEEEENS_9allocatorIS7_EEEC2ERKSA_
00000000004979c0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__16vectorIN6mapbox4util9geojsonvt16ProjectedFeatureENS_9allocatorIS4_EEE18__construct_at_endIPS4_EENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeESB_SB_m
0000000000497580 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__16vectorIN6mapbox4util9geojsonvt16ProjectedFeatureENS_9allocatorIS4_EEE21__push_back_slow_pathIS4_EEvOT_
00000000004978e0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__16vectorIN6mapbox4util9geojsonvt16ProjectedFeatureENS_9allocatorIS4_EEEC2ERKS7_
0000000000496fc0 (__TEXT,__textcoal_nt) weak external automatically hidden __ZNSt3__16vectorIN6mapbox4util9geojsonvt6LonLatENS_9allocatorIS4_EEE21__push_back_slow_pathIS4_EEvOT_

@mikemorris

Copy link
Copy Markdown
Contributor Author
U __ZN6mapbox4util9geojsonvt7Convert6createENSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_NS3_4lessISA_EENS8_INS3_4pairIKSA_SA_EEEEEENS1_20ProjectedFeatureTypeENS0_7variantIJNS1_14ProjectedPointENS1_26ProjectedGeometryContainerEEEE

Symbol seems to be undefined after running make osx too but no linker complaints. Should note that make ipackage succeeds as well, the failure is in scripts/ios/test.sh

@mikemorris

Copy link
Copy Markdown
Contributor Author

noinline
This function attribute prevents a function from being considered for inlining. If the function does not have side-effects, there are optimizations other than inlining that causes function calls to be optimized away, although the function call is live. To keep such calls from being optimized away, put
asm ("");
https://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Function-Attributes.html

externally_visible
This attribute, attached to a global variable or function nullify effect of -fwhole-program command line option, so the object remain visible outside the current compilation unit

Sounds interesting.

@mikemorris

Copy link
Copy Markdown
Contributor Author

From @1ec5, re why only iOS is complaining about the missing symbol:

That’s probably the case: we definitely test annotations in the iOS test suite, but we don’t use make test-* for iOS tests.
And we added AnnotationManager for iOS initially.

@mikemorris

Copy link
Copy Markdown
Contributor Author

Thanks to @1ec5 for pointing me to https://github.com/mapbox/mapbox-gl-native/tree/master/test/ios/ios-tests.xcodeproj, where I found an option to not demangle missing symbols:

__ZN6mapbox4util9geojsonvt7Convert6createENSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESA_NS3_4lessISA_EENS8_INS3_4pairIK
SA_SA_EEEEEENS1_20ProjectedFeatureTypeENS0_7variantIJNS1_14ProjectedPointENS1_26ProjectedGeometryContainerEEEE

Trying to figure out how I could go about adding the GeoJSONVT static lib path to the linker through this GUI now... (really wishing this was a .gypi file instead)

@mikemorris

Copy link
Copy Markdown
Contributor Author

-> #2584

@mikemorris mikemorris closed this Oct 9, 2015
@mikemorris
mikemorris deleted the geojsonvt-v2.1.6.1 branch October 9, 2015 20:17
@1ec5 1ec5 removed the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Nov 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants