Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcpkg dependency example #2274

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft

Conversation

mathisloge
Copy link
Contributor

This PR is based on #2272

Unbenannt

As you can see, there are definitly some problems with newer versions.
I had to patch all mapbox repositories, since the new versions are incompitable with the current implementation.

The shapes drawn over the map are broken, too
image

Version differences:

  • duktape: 2.3.0 -> 2.5.0
  • harfbuzz 2.7.2 -> 2.8.1
  • icu 67.1 -> 69.1
  • freetype 2.10.2 -> 2.10.4
  • miniz 1.16 beta r1 -> 2.1.0
  • rapidjson 2017-02-21 -> 2020-09-14
  • stb_easy_font v0.7 -> v1.1
  • stb_image v2.19 -> v2.26
  • yaml-cpp custom -> 0.6.3
  • imgui v1.63 -> v1.83
  • glfw 3.2.1 -> 3.3.4

So there are not so many version differences, but the end result is clearly different.

Any idea which dependency is the most likely cause?
Then I could test it with the original version.

@matteblair
Copy link
Member

If I had to guess, this is the order of likelihood to cause these errors:

  • yaml-cpp custom -> 0.6.3
  • duktape: 2.3.0 -> 2.5.0
  • freetype 2.10.2 -> 2.10.4
  • harfbuzz 2.7.2 -> 2.8.1
  • icu 67.1 -> 69.1
  • rapidjson 2017-02-21 -> 2020-09-14
  • stb_easy_font v0.7 -> v1.1
  • stb_image v2.19 -> v2.26
  • glfw 3.2.1 -> 3.3.4
  • miniz 1.16 beta r1 -> 2.1.0
  • imgui v1.63 -> v1.83

You could post any errors from the log output too, but I'll try to find time to test this branch myself.

@mathisloge
Copy link
Contributor Author

it is something with glm even though vcpkg and submodule versions were the same. Maybe the GLM_FORCE_CTOR_INIT does something.
but it works now quite fine with all the new versions
image

@matteblair
Copy link
Member

Oh I didn't realize you replaced GLM too! Yes the GLM_FORCE_CTOR_INIT define is important - many code paths depend on GLM types being initialized with zeros by default.

@mathisloge
Copy link
Contributor Author

mhm strange .after replacing most of the libraries, I get a nullptr exception in Freetype (by Alfons).
But this only happens in release mode. In debug mode it runs without problems. So there might be some side effects in the timing of the initialisation of the font loading logic?

@matteblair
Copy link
Member

That is a possibility! Could also be a case of accidentally using undefined behavior that happens to work correctly in debug mode. Hard to say without more info!

@matteblair
Copy link
Member

By the way, while I can appreciate the goal of unifying tangram's dependencies under vcpkg, I have to ask: Do you expect vcpkg to work with our current Android and iOS build systems? From what I've read, vcpkg doesn't support Android and iOS to the same extent as desktop platforms.

@mathisloge
Copy link
Contributor Author

mathisloge commented Sep 24, 2021

That is a possibility! Could also be a case of accidentally using undefined behavior that happens to work correctly in debug mode. Hard to say without more info!

#2274 (comment)

Do you expect vcpkg to work with our current Android and iOS build systems?

I generally expect it to work with vcpkg. But this PR should also test this.

From what I've read, vcpkg doesn't support Android and iOS to the same extent as desktop platforms.

The situation is that ios and android are community maintained. But there are currently a lot of PRs for improvements of the toolchain (the most important one might be microsoft/vcpkg#15605. however the scripts are currently under a active audit session to refactor them). For android I've added the needed things to work with tangram (currently there are still some key points I have to figure out). macos itself is officially supported. (I don't have any apple hardware or experience with it, so i can't judge the differences between macos vs ios.)

If all things are working, i'm extracting some of the overlay-ports to vcpkg main repo / custom registry for alfons (since it seems that the author does not maintain it). However tangram has some additions to libraries. So we will have to maintain those as overlay ports, so that all other depending libraries will get build with those as well.

@mathisloge
Copy link
Contributor Author

mathisloge commented Sep 24, 2021

it will fail at if ( FT_ALLOC( metrics, writing_system_class->style_metrics_size ) ) in freetype.
The variables writing_system_class, metrics and memory are null.
I'm wondering why metrics is null, because this should not be null as it will be checked before: This was utterly nonesense :D it is !metrics so it is correct that metrics is null. But writing_system_class shouldn't be null.

metrics = globals->metrics[style];
if ( !metrics )
    {
      /* create the global metrics object if necessary */
      FT_Memory  memory = globals->face->memory;
      if ( FT_ALLOC( metrics, writing_system_class->style_metrics_size ) )

this is the callstack:

[Inline Frame] freetype.dll!af_face_globals_get_metrics(AF_FaceGlobalsRec_ * globals, unsigned int) Line 458 (d:\dev\tangram-es\vcpkg\buildtrees\freetype\src\bf1991f3c3-22b0284d2c.clean\src\autofit\afglobal.c:458)
freetype.dll!af_loader_load_glyph(AF_LoaderRec_ * loader, AF_ModuleRec_ * module, FT_FaceRec_ * face, unsigned int glyph_index, int load_flags) Line 306 (d:\dev\tangram-es\vcpkg\buildtrees\freetype\src\bf1991f3c3-22b0284d2c.clean\src\autofit\afloader.c:306)
freetype.dll!af_autofitter_load_glyph(AF_ModuleRec_ * module, FT_GlyphSlotRec_ * slot, FT_SizeRec_ * size, unsigned int glyph_index, int load_flags) Line 489 (d:\dev\tangram-es\vcpkg\buildtrees\freetype\src\bf1991f3c3-22b0284d2c.clean\src\autofit\afmodule.c:489)
freetype.dll!FT_Load_Glyph(FT_FaceRec_ * face, unsigned int glyph_index, int load_flags) Line 981 (d:\dev\tangram-es\vcpkg\buildtrees\freetype\src\bf1991f3c3-22b0284d2c.clean\src\base\ftobjs.c:981)
[Inline Frame] alfons.dll!alfons::GlyphData::loadGlyph(FT_FaceRec_ *) Line 68 (d:\dev\tangram-es\vcpkg\buildtrees\alfons\src\69fc23f452-257eac83cf.clean\src\alfons\freetypeHelper.h:68)
[Inline Frame] alfons.dll!alfons::FreetypeHelper::loadGlyph(FT_FaceRec_ * ftFace, unsigned int) Line 115 (d:\dev\tangram-es\vcpkg\buildtrees\alfons\src\69fc23f452-257eac83cf.clean\src\alfons\freetypeHelper.h:115)
alfons.dll!alfons::FontFace::createGlyph(unsigned int codepoint) Line 215 (d:\dev\tangram-es\vcpkg\buildtrees\alfons\src\69fc23f452-257eac83cf.clean\src\alfons\fontFace.cpp:215)
alfons.dll!alfons::GlyphAtlas::createGlyph(const alfons::Font & _font, const alfons::GlyphKey & _key, alfons::AtlasGlyph & _entry) Line 145 (d:\dev\tangram-es\vcpkg\buildtrees\alfons\src\69fc23f452-257eac83cf.clean\src\alfons\atlas.cpp:145)
alfons.dll!alfons::GlyphAtlas::getGlyph(const alfons::Font & _font, const alfons::GlyphKey & _key, alfons::AtlasGlyph & _entry) Line 137 (d:\dev\tangram-es\vcpkg\buildtrees\alfons\src\69fc23f452-257eac83cf.clean\src\alfons\atlas.cpp:137)
alfons.dll!alfons::TextBatch::drawShape(const alfons::Font & _font, const alfons::Shape & _shape, const glm::vec<2,float,0> & _position, float _scale, alfons::LineMetrics & _metrics) Line 81 (d:\dev\tangram-es\vcpkg\buildtrees\alfons\src\69fc23f452-257eac83cf.clean\src\alfons\textBatch.cpp:81)
alfons.dll!alfons::TextBatch::drawShapeRange(const alfons::LineLayout & _line, unsigned __int64 _start, unsigned __int64 _end, glm::vec<2,float,0> _position, alfons::LineMetrics & _metrics) Line 139 (d:\dev\tangram-es\vcpkg\buildtrees\alfons\src\69fc23f452-257eac83cf.clean\src\alfons\textBatch.cpp:139)
tangram.exe!Tangram::FontContext::layoutText(Tangram::TextStyle::Parameters & _params, const icu_69::UnicodeString & _text, std::vector<Tangram::GlyphQuad,std::allocator<Tangram::GlyphQuad>> & _quads, std::bitset<64> & _refs, glm::vec<2,float,0> & _size, std::array<Tangram::Range,3> & _textRanges) Line 229 (d:\dev\tangram-es\core\src\text\fontContext.cpp:229)
tangram.exe!Tangram::TextStyleBuilder::prepareLabel(Tangram::TextStyle::Parameters & _params, Tangram::Label::Type _type, Tangram::TextStyleBuilder::LabelAttributes & _attributes) Line 828 (d:\dev\tangram-es\core\src\style\textStyleBuilder.cpp:828)
tangram.exe!Tangram::TextStyleBuilder::addFeature(const Tangram::Feature & _feat, const Tangram::DrawRule & _rule) Line 278 (d:\dev\tangram-es\core\src\style\textStyleBuilder.cpp:278)
tangram.exe!Tangram::TileBuilder::applyStyling(const Tangram::Feature & _feature, const Tangram::SceneLayer & _layer) Line 97 (d:\dev\tangram-es\core\src\tile\tileBuilder.cpp:97)
tangram.exe!Tangram::TileBuilder::build(Tangram::TileID _tileID, const Tangram::TileData & _tileData, const Tangram::TileSource & _source) Line 133 (d:\dev\tangram-es\core\src\tile\tileBuilder.cpp:133)
tangram.exe!Tangram::TileTask::process(Tangram::TileBuilder & _tileBuilder) Line 41 (d:\dev\tangram-es\core\src\tile\tileTask.cpp:41)
tangram.exe!Tangram::TileWorker::run(Tangram::TileWorker::Worker * instance) Line 99 (d:\dev\tangram-es\core\src\tile\tileWorker.cpp:99)
[Inline Frame] tangram.exe!std::invoke(void(Tangram::TileWorker::*)(Tangram::TileWorker::Worker *) &&) Line 1601 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\type_traits:1601)
tangram.exe!std::thread::_Invoke<std::tuple<void (__cdecl Tangram::TileWorker::*)(Tangram::TileWorker::Worker *),Tangram::TileWorker *,Tangram::TileWorker::Worker *>,0,1,2>(void * _RawVals) Line 56 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\thread:56)
ucrtbase.dll!00007ffead151bb2() (Unknown Source:0)
kernel32.dll!00007ffeaf1b7034() (Unknown Source:0)
ntdll.dll!00007ffeaf8e2651() (Unknown Source:0)

Log output

D:\dev\tangram-es\build\windows-default-release>"D:\dev\tangram-es\build\windows-default-release\tangram.exe"
TANGRAM D:\dev\tangram-es\core\src\map.cpp:877: setup GL
TANGRAM D:\dev\tangram-es\core\src\gl\hardware.cpp:60: Driver supports map buffer: 0
TANGRAM D:\dev\tangram-es\core\src\gl\hardware.cpp:61: Driver supports vaos: 1
TANGRAM D:\dev\tangram-es\core\src\gl\hardware.cpp:62: Driver supports rgb8_rgba8: 0
TANGRAM D:\dev\tangram-es\core\src\gl\hardware.cpp:63: Driver supports NPOT texture: 1
TANGRAM D:\dev\tangram-es\core\src\gl\hardware.cpp:77: Hardware max texture size 16384
TANGRAM D:\dev\tangram-es\core\src\gl\hardware.cpp:78: Hardware max combined texture units 160
TANGRAM D:\dev\tangram-es\core\src\map.cpp:210: resize: 1024 x 768
TANGRAM D:\dev\tangram-es\platforms\windows\src\main.cpp:27: Base URL: file:///D:/dev/tangram-es/build/windows-default-release/
WARNING D:\dev\tangram-es\core\src\scene\sceneLoader.cpp:687: Can't find data source touch for layer touch
WARNING D:\dev\tangram-es\core\src\tile\tileManager.cpp:204: add source osm
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:481: Fetch font https://fonts.gstatic.com/s/opensans/v13/O4NhV7_qs9r9seTo7fnsVLO3LdcAZYWl9Si6vvxL-qU.woff 
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:481: Fetch font https://fonts.gstatic.com/s/opensans/v13/wMws1cEtxWZc6AZZIpiqWALUuEpTyoUstqEm5AMlJo4.woff 
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:481: Fetch font https://fonts.gstatic.com/s/montserrat/v7/zhcz-_WihjSQC0oHJ9TCYL3hpw3pgy2gAi-Ip7WPMi0.woff
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:427: Fetch texture file:///D:/dev/tangram-es/build/windows-default-release/res/img/marker-stroked.png     
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:427: Fetch texture file:///D:/dev/tangram-es/build/windows-default-release/res/img/poi_icons_32.png       
WARNING D:\dev\tangram-es\core\src\scene\styleParam.cpp:266: Invalid font-size '1.2em'.
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:432: Received texture file:///D:/dev/tangram-es/build/windows-default-release/res/img/marker-stroked.png
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:432: Received texture file:///D:/dev/tangram-es/build/windows-default-release/res/img/poi_icons_32.png  
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:312: Prefetch tiles for View: 1024.000000x768.000000 / zoom:16.000000 lon:-74.009764 lat:40.705327
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:485: Received font: https://fonts.gstatic.com/s/montserrat/v7/zhcz-_WihjSQC0oHJ9TCYL3hpw3pgy2gAi-Ip7WPMi0.woff
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:485: Received font: https://fonts.gstatic.com/s/opensans/v13/O4NhV7_qs9r9seTo7fnsVLO3LdcAZYWl9Si6vvxL-qU.woff
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:485: Received font: https://fonts.gstatic.com/s/opensans/v13/wMws1cEtxWZc6AZZIpiqWALUuEpTyoUstqEm5AMlJo4.woff
TANGRAM D:\dev\tangram-es\core\src\scene\scene.cpp:312: Prefetch tiles for View: 1024.000000x768.000000 / zoom:16.000000 lon:-74.009764 lat:40.705327
LOADED Font: Open Sans Italic size: 16

@mathisloge
Copy link
Contributor Author

Have updated my comment #2274 (comment) as I had some brain lag :D

@mathisloge
Copy link
Contributor Author

mathisloge commented Sep 24, 2021

@matteblair saw a issue at freetype. https://gitlab.freedesktop.org/freetype/freetype/-/issues/1089
This is a bug in freetype itself, which is already fixed but need to land in a release.

using freetype 2.10.4 everything works.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants