maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
1.03k stars 300 forks source link

Update vector-tile to MapLibre fork #2460

Closed louwers closed 4 months ago

louwers commented 4 months ago

Updates the vector-tile vendored dependency to use the MapLibre fork hosted at https://github.com/maplibre/mvt-cpp

Includes a commit cherry-picked by @nathreed https://github.com/maplibre/mvt-cpp/pull/2

Closes https://github.com/maplibre/maplibre-native/issues/795

Style Metric mvt-cpp vector-tiles
Americana avgEncodingTime 13.0449364383 13.9205717752
Americana low1pEncodingTime 59.4919468571 63.3725865995
Americana avgRenderingTime 12.2574985444 12.8400150678
Americana low1pRenderingTime 37.3708819947 36.2964980954

Also some progress towards https://github.com/maplibre/maplibre-native/issues/2227

github-actions[bot] commented 4 months ago

Bloaty Results (iOS) 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  -0.0%    -552  [ = ]       0    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-2460-compared-to-main.txt

michaelkirk commented 1 month ago

Just in case anyone else has the same problem, I'm encountering an error, I think related to this change of submodule.

I started seeing an error when updating:

 ~/src/maplibre/maplibre-native$ git submodule update
fatal: remote error: upload-pack: not our ref 8ad3bf0b78bf9cb0dba0abaccec0c180e1c27ab3
fatal: Fetched in submodule path 'vendor/vector-tile', but it did not contain 8ad3bf0b78bf9cb0dba0abaccec0c180e1c27ab3. Direct fetching of that commit failed.

If you're hitting that error, I think the fix could be:

cd vendor/vector-tile && git remote set-url origin https://github.com/maplibre/mvt-cpp.git


Here's my debug steps in case it's interesting to anyone...

I don't really know enough about git submodules, but:

$ cd vendor/vector-tile
$ git remote -v
origin  https://github.com/mapbox/vector-tile.git (fetch)
origin  https://github.com/mapbox/vector-tile.git (push)

It's still referencing the old remote!

Sanity check that I have the up-to-date .gitmodule

$ cat .gitmodules| grep -A1 vector-tile
[submodule "vendor/vector-tile"]
        path = vendor/vector-tile
        url = https://github.com/maplibre/mvt-cpp.git

Ok, .gitmodules looks good. Maybe it's cached in the .git/config? TBH I don't really know the practical difference.

$ cat .git/config| grep -A3 vector-tile
[submodule "vendor/vector-tile"]
        active = true
        url = https://github.com/mapbox/vector-tile.git

Yep! The .git/config has the old entry. So maybe I need to manually delete that entry from .git/config and re-initialize?

$ vim .git/config  # delete entry for vector-tile
$ git submodule update --init
Submodule 'vendor/vector-tile' (https://github.com/maplibre/mvt-cpp.git) registered for path 'vendor/vector-tile'
fatal: remote error: upload-pack: not our ref 8ad3bf0b78bf9cb0dba0abaccec0c180e1c27ab3
fatal: Fetched in submodule path 'vendor/vector-tile', but it did not contain 8ad3bf0b78bf9cb0dba0abaccec0c180e1c27ab3. Direct fetching of that commit failed.

Huh! It's still failing. It recloned the submodule with the stale remote.

So I gave up.

cd ..
rm -fr maplibre-native
git clone https://github.com/maplibre/maplibre-native
cd maplibre-native
git submodule update --init --recursive

In hindsight, I probably could have manually set the new remote vendor/vector-tile.

But I was expecting the client to be able to infer this automatically based on the changes to .gitmodules. Maybe there's a reason it's manual that I don't understand.

$ git --version
git version 2.46.0
louwers commented 1 month ago

@michaelkirk Thanks for sharing your struggles. Submodules can be a pain...