png lib required by freetype

47 views
Skip to first unread message

Bruce Clay

unread,
Nov 12, 2022, 9:52:59 AM11/12/22
to vsg-users : VulkanSceneGraph Developer Discussion Group
All of the projects that include freetype appear to also need png lib .
If I add it in Visual studio then things build ok.

I am not a cmake creator so I do not know the right way to add this to the cmake

My failed attempt to do this for the MyFirstVsgApplication is in the attached files.

Any suggestion would be appreciated
CMakeCache.txt
CMakeLists.txt

Robert Osfield

unread,
Nov 12, 2022, 11:32:25 AM11/12/22
to vsg-...@googlegroups.com
Hi Bruce,

On Sat, 12 Nov 2022 at 14:53, Bruce Clay <bcla...@gmail.com> wrote:
All of the projects that include freetype appear to also need png lib .
If I add it in Visual studio then things build ok.

In theory the Freetype cmake support should specify all the libs that need to be linked, so if your build of Freetype adds a dependency of png then it's CMake module/config files should include that in the list of libs that one must link to to use freetype.

The VSG, vsgXchange etc. attempt to do this for their own dependencies, but I've just spotted that the vsgXchange/src/freetype/build_vars.cmake doesn't add itself to the dependency list put into the vsgXchangeConfig.cmake.  Perhaps this is the cause of the problems....

I have just checked in the addition of a find_dependency(freetype) to the vsgXchangeConfig.cmake:


Could you try vsgXchange master and see if that helps avoid the need for modifying applications that link to vsgXchange like you did for MyFirstVsgApplication.

Thanks,
Robert.

Bruce Clay

unread,
Nov 12, 2022, 12:41:18 PM11/12/22
to vsg-...@googlegroups.com
Robert:
  I pulled the latest version of vsgXchange.  I could see the change you made but it appears to not make a difference.  I still have to add the png lib to the Visual Studio Solution to build vsgconv and beyond.

Bruce

--
You received this message because you are subscribed to the Google Groups "vsg-users : VulkanSceneGraph Developer Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vsg-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vsg-users/CAFN7Y%2BVfi2z4kW8Ce_1xX8LAyMVuabpU_WF%2B7V_QKYjwAQcetQ%40mail.gmail.com.

Robert Osfield

unread,
Nov 12, 2022, 1:48:38 PM11/12/22
to vsg-...@googlegroups.com
On Sat, 12 Nov 2022 at 17:41, Bruce Clay <bcla...@gmail.com> wrote:
Robert:
  I pulled the latest version of vsgXchange.  I could see the change you made but it appears to not make a difference.  I still have to add the png lib to the Visual Studio Solution to build vsgconv and beyond.

Does the generated and installed vsgXchangeConfig.cmake contain the Freetype entry now? 

Another avenue to look into what the CMake FindFreetype.cmake is declaring as libs that should be linked.


It looks like vsgXchange usage looks correct - now it has find_dependecy addition. 

Could it be that your build of Freetype.cmake is non-standard so CMake's FindFreetype.cmake isn't correctly including all the dependencies it should?

Where did you pull in your freetype lib and headers from?

One possible workaround if the FindFretype.cmake is failing to include libs that it depends upon could be to extend the vsgXhchange/src/freetype/buil_vars.cmake to have a find_package(lpng) and add the PNG_LIBRARIES to the EXTRA_LIBRARIES.

I don't know the status of Freetype and libpng dependency, it might be platform specific, or even down to how freetype was built.  This is what CMake should be handling for us.  Perhaps there is a FreetypeConfig.cmake file available, if so this might be more attuned to the install of freetype.

Unfortunately I can't test this stuff out as it works fine without libpng on all the systems I have.

Cheers,
Robert.

Bruce Clay

unread,
Nov 12, 2022, 6:23:10 PM11/12/22
to vsg-users : VulkanSceneGraph Developer Discussion Group
Robert:
  I found a workaround for this problem.  I was able to create a static freetype library. I was able to build all projects with the new file.  The list below shows
the status from running the various apps

vsgbuilder exit status 0  
vsgcameras exit status 0  
vsgclip exit status 1  
vsgcompute exit status 1  
vsgcomputevertex exit status  1  
vsgconvd exit status 1  
exit vsgdeviceselection status  0  
vsgdraw exit status 1  
vsgdynamicload exit status  0  
exit vsgdynamictexture status  1  
exit status vsgdynamictexture_cs    
vsgdynamicvertex exit status  0  
vsgdynamicviews exit status  -1073741819  
exit vsgexecutecommands status  0  
 exit status 0  
. exit status  1  
vsghelloworld exit status  0  
vsginput exit status -1073741819  
vsginterleaved exit status  1  
vsgintersection exit status  0  
vsglights exit status 0  
vsglog exit status 0  
vsglog_mt exit status 0  
vsgmaths exit status 0  
vsgmemory exit status 0  
vsgmeshshader exit status  1  
vsgmultigpu exit status  0  
vsgmultiviews exit status  0  
exit vsgocclusionquery status  0  
vsgortho exit status 1  
vsgoverlay exit status 0  
vsgpagedlod exit status  -1073741819  
vsgpath exit status 0  
vsgpointer exit status 0  
vsgraytracing exit status  1  
exit vsgrendertotexture status  1  
vsgscreenshot exit status  0  
vsgshaderset exit status  1  
vsgskybox exit status 0  
vsgstatecomposer exit status  9009  
vsgstateswitch exit status  0  
vsgsubpass exit status 1  
vsgtext exit status 1  
vsgtextgroup exit status  1  
vsgtexturearray exit status  1  
vsgtimestamps exit status  0  
vsgtransform exit status  0  
vsgtypes exit status 0  
vsgvalues exit status 0  
vsgviewer exit status 0  
vsgvisitor exit status 0  
exit status vsgvisitorcustomtype    
vsgwindows exit status 0  

Bruce

Robert Osfield

unread,
Nov 13, 2022, 3:34:01 AM11/13/22
to vsg-...@googlegroups.com
Hi Bruce,

On Sat, 12 Nov 2022 at 23:23, Bruce Clay <bcla...@gmail.com> wrote:
Robert:
  I found a workaround for this problem.  I was able to create a static freetype library. I was able to build all projects with the new file.  The list below shows
the status from running the various apps

Glad to hear you found a workaround. 

I just had a look at the Freetype project repository and it now has a CMakeLists.txt file:


This includes optional sections for searching for various dependencies that include png.

option(FT_DISABLE_PNG
  "Disable support of PNG compressed OpenType embedded bitmaps." OFF)
cmake_dependent_option(FT_REQUIRE_PNG
  "Require support of PNG compressed OpenType embedded bitmaps." OFF
  "NOT FT_DISABLE_PNG" OFF)

And later:

if (NOT FT_DISABLE_PNG)
  if (FT_REQUIRE_PNG)
    find_package(PNG REQUIRED)
  else ()
    find_package(PNG)
  endif ()
endif ()

So I presume different pre-built distributions of freetype-dev use png and possibly other dependencies while others don't.  Unfortunately the FindFreetype.cmake that comes with CMake does appear to pick up on these.

I will pull down the whole repo and see if they provide a cmake config that might add the specs for these dependencies.  If we can't use CMake directly to tell us what the dependencies of Freetype are we might have to add a CMake compile test.
 
This doesn't feel like it's a problem that can be resolved today so most likely it'll have to wait till after vsgXchange-1.0.0.

Cheers.
Robert.

Robert Osfield

unread,
Nov 13, 2022, 3:41:35 AM11/13/22
to vsg-...@googlegroups.com
Hi Bruce et. al,

I have built freetype from source and installed it to a local directory.  This includes a lib/cmake/freetype/
freetype-config.cmake file, which has within it:

set_target_properties(freetype PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/freetype2"
  INTERFACE_LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libbrotlidec.so"
)

So it mentions the libpng, libz and libbrotlidec dependencies which is a hopeful sign.

Could you check your machine for a similar freetype-config.cmake?  If you have a lib/lib/cmake/freetype/ directory and the .cmake files within it.

It may be possible to check for the cmake freetype config file first, then fallback to the old style FindFreetype.cmake that CMake has been included forever.

Cheers,
Robert.

Robert Osfield

unread,
Nov 13, 2022, 5:11:44 AM11/13/22
to vsg-...@googlegroups.com
Hi All,

I have created a freetype_config branch of vsgXchange that adds use of the feetype-config.cmake where it's supported:


This works with the latest freetype locally built and installed, as well as the standard freetype-dev installed on my Kubuntu 22.04 system.

Could folks test this out. 

Bruce could you try your original freetype lib install rather than the newly built one to see if the old configuration now works?

Chers,
Robert.

Bruce Clay

unread,
Nov 13, 2022, 2:45:17 PM11/13/22
to vsg-...@googlegroups.com
Robert:
  I pulled the latest version of vsgXchange and tried to run but had the same issue.  I then looked for the modified build_vars.cmake.  the changes are not in the current source tree.  I copied from the https://github.com/vsg-dev/vsgXchange/compare/freetype_config link you provided but that caused cmake to error out stating that it could not load the cmake.  Unfortunately cmake is a bit out of my realm so I likely made a mistake.

Since there is a work around I would think this can wait until after the release.  

Not sure if you saw my post yesterday showing results of testing the vsgExamples.  Several did not appear to do anything which likely means bad input parameters on my part but some of them errored out indicated by status = 1 in the list.  I was particularly interested in t vsgPagedLod since I am trying to get to the BlueMarbleViewer capabilities from days gone by.

Brue


--
You received this message because you are subscribed to the Google Groups "vsg-users : VulkanSceneGraph Developer Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vsg-users+...@googlegroups.com.

Robert Osfield

unread,
Nov 13, 2022, 2:48:47 PM11/13/22
to vsg-...@googlegroups.com
 Hi Bruce,

On Sun, 13 Nov 2022 at 19:45, Bruce Clay <bcla...@gmail.com> wrote:
  I pulled the latest version of vsgXchange and tried to run but had the same issue.  I then looked for the modified build_vars.cmake.  the changes are not in the current source tree.  I copied from the https://github.com/vsg-dev/vsgXchange/compare/freetype_config link you provided but that caused cmake to error out stating that it could not load the cmake.  Unfortunately cmake is a bit out of my realm so I likely made a mistake.

The changes are only in the freetype_config branch, I haven't merged them with vsgXchange master as they hasn't been any reported testing out in the community.  Once 1.0.0 is out and I have had a breather I can follow up.  Hopefully others can test this branch as well.

As for the Cmake issues, you'll need to post the exact output from cmake running and the cmake cache files produced to help us figure out what is going wrong.

Cheers,
Robert.

Since there is a work around I would think this can wait until after the release.  

Not sure if you saw my post yesterday showing results of testing the vsgExamples.  Several did not appear to do anything which likely means bad input parameters on my part but some of them errored out indicated by status = 1 in the list.  I was particularly interested in t vsgPagedLod since I am trying to get to the BlueMarbleViewer capabilities from days gone by.

Brue


On Sun, Nov 13, 2022 at 5:11 AM Robert Osfield <robert....@gmail.com> wrote:
Hi All,

I have created a freetype_config branch of vsgXchange that adds use of the feetype-config.cmake where it's supported:


This works with the latest freetype locally built and installed, as well as the standard freetype-dev installed on my Kubuntu 22.04 system.

Could folks test this out. 

Bruce could you try your original freetype lib install rather than the newly built one to see if the old configuration now works?

Chers,
Robert.

--
You received this message because you are subscribed to the Google Groups "vsg-users : VulkanSceneGraph Developer Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vsg-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vsg-users/CAFN7Y%2BVt9WctpY8QZ6qMkPhQr1HOWAOAZnRPf3-71D8Osbx2RQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "vsg-users : VulkanSceneGraph Developer Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vsg-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages