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

[Windows][ros2] Constraint Freetype dependencies for more predictable build result. #405

Merged
merged 1 commit into from
Oct 26, 2019
Merged

[Windows][ros2] Constraint Freetype dependencies for more predictable build result. #405

merged 1 commit into from
Oct 26, 2019

Conversation

seanyen
Copy link
Contributor

@seanyen seanyen commented May 25, 2019

This is a cherry-pick for #393.

This freetype library in ROS2 on Windows is a static library and that implies any dependencies of freetype also need to be exported to the downstream project which consumes freetype.

If following the steps from https://index.ros.org/doc/ros2/Installation/Windows-Development-Setup/, there is no problem because no other unexpected libraries in CMAKE search path. However, for example, ZLib just happens to be in the CMAKE search path, then freetype will be intellegently try to discover and link against ZLib and however the freetype CMake config was not exposing its dependencies to the downstream projects consuming freetype.

In order to make the build more predictable for different environment, I added the flags to explicitly disable all the optional dependencies discovery.

UPDATED: Here is a example of the build error when running into this.

Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  OgreMain.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreMain.dll
  Codec_STBI.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\Codec_STBI.dll
  OgreGLSupport.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\lib\Release\OgreGLSupport.lib
  OgreHLMS.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreHLMS.dll
  OgreMeshLodGenerator.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreMeshLodGenerator.dll
  OgreMeshUpgrader.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreMeshUpgrader.exe
     Creating library F:/workspace/ros2__ws/build/rviz_ogre_vendor/ogre-v1.12.1-prefix/src/ogre-v1.12.1-build/lib/Release/OgreOverlay.lib and object F:/workspace/ros2__ws/build/rviz_ogre_vendor/ogre-v1.12.1-prefix/src/ogre-v1.12.1-build/lib/Release/OgreOverlay.exp
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_create_read_struct referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_longjmp_fn referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_create_info_struct referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_read_info referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_expand_gray_1_2_4_to_8 referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_palette_to_rgb referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_tRNS_to_alpha referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_gray_to_rgb referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_filler referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_packing referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_interlace_handling referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_strip_16 referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_read_update_info referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_read_image referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_read_end referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_destroy_read_struct referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_get_error_ptr referenced in function error_callback [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_read_fn referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_get_io_ptr referenced in function read_data_from_FT_Stream [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_set_read_user_transform_fn referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_error referenced in function read_data_from_FT_Stream [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_get_valid referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: unresolved external symbol png_get_IHDR referenced in function Load_SBit_Png [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreOverlay.dll : fatal error LNK1120: 23 unresolved externals [F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\Components\Overlay\OgreOverlay.vcxproj]
  OgrePaging.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgrePaging.dll
  OgreProperty.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreProperty.dll
  OgreRTShaderSystem.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreRTShaderSystem.dll
  OgreTerrain.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreTerrain.dll
  OgreVolume.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreVolume.dll
  OgreXMLConverter.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\OgreXMLConverter.exe
  Plugin_BSPSceneManager.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\Plugin_BSPSceneManager.dll
  Plugin_OctreeSceneManager.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\Plugin_OctreeSceneManager.dll
  Plugin_PCZSceneManager.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\Plugin_PCZSceneManager.dll
  Plugin_OctreeZone.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\Plugin_OctreeZone.dll
  Plugin_ParticleFX.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\Plugin_ParticleFX.dll
  RenderSystem_GL.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\RenderSystem_GL.dll
  RenderSystem_GL3Plus.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\RenderSystem_GL3Plus.dll
  VRMLConverter.vcxproj -> F:\workspace\ros2__ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1-build\bin\Release\VRMLConverter.exe

@seanyen
Copy link
Contributor Author

seanyen commented Oct 16, 2019

@clalancette any feedback on this?

@seanyen
Copy link
Contributor Author

seanyen commented Oct 25, 2019

cc @jacobperron this is ready for review and merge. And hope this can be back ported to dashing and crystal too. Thanks!

Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change seems okay to me.

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@jacobperron
Copy link
Member

Dashing backport: #489

jacobperron added a commit that referenced this pull request Dec 6, 2019
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.

None yet

2 participants