vlabella / GLE

GLE - Graphics Layout Engine
BSD 3-Clause "New" or "Revised" License
19 stars 9 forks source link

Could not find a package configuration file provided by "JBIG" #16

Open ryandesign opened 1 month ago

ryandesign commented 1 month ago

When running cmake for GLE 4.3.4 this message appears:

CMake Warning at CMakeLists.txt:123 (find_package):
  By not providing "FindJBIG.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "JBIG", but
  CMake did not find one.

  Could not find a package configuration file provided by "JBIG" with any of
  the following names:

    JBIGConfig.cmake
    jbig-config.cmake

  Add the installation prefix of "JBIG" to CMAKE_PREFIX_PATH or set
  "JBIG_DIR" to a directory containing one of the above files.  If "JBIG"
  provides a separate development package or SDK, be sure it has been
  installed.

I have jbigkit 2.1 installed but it does not come with JBIGConfig.cmake nor jbig-config.cmake.

The GLE README does not mention the JBIG requirement.

ryandesign commented 1 month ago

The same problem exists for ztsd in some cases. Zstd has several build systems, but only their cmake build system produces the zstdConfig.cmake file GLE's build currently requires:

https://github.com/facebook/zstd/issues/3271

In Ubuntu, for example, zstdConfig.cmake does not appear to be provided. On macOS, in Homebrew, zstd is built using cmake so zstdConfig.cmake is provided. In MacPorts, zstd is built using autotools so zstdConfig.cmake is not part of the ztsd port but there is a separate zstdConfig.cmake port that can be installed to get those files.

If zstd was built with one of its other build systems then:

CMake Warning at CMakeLists.txt:130 (find_package):
  By not providing "FindZSTD.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "ZSTD", but
  CMake did not find one.

  Could not find a package configuration file provided by "ZSTD" with any of
  the following names:

    ZSTDConfig.cmake
    zstd-config.cmake

  Add the installation prefix of "ZSTD" to CMAKE_PREFIX_PATH or set
  "ZSTD_DIR" to a directory containing one of the above files.  If "ZSTD"
  provides a separate development package or SDK, be sure it has been
  installed.

Please rewrite the JBIG and zstd detection in GLE's CMakeLists.txt so that it does not rely on the jbigConfig.cmake or zstdConfig.cmake files.

The GLE README does not mention the zstd requirement nor the libdeflate requirement.

ryandesign commented 1 month ago

Before investing time in trying to fix this, I'd like to understand why GLE looks for jbig, zstd, lzma, and deflate at all, because it doesn't use them.

Searching for lzma and deflate was added in 7ed08fb3621f3f356fa136f42404db59006e843b (though you wouldn't know it from reading the commit message) and searching for jbig and zstd was added in 167976704973dbb3e0d303a0fe648f0b0704eea6, both of which were first released in 4.3.4.

It appears that all four are being searched for only because they are optional dependencies of libtiff.

As long as GLE is linking with shared libraries, GLE shouldn't need to care what other libraries libtiff, or any other library GLE links with, is linked with. That's for those libraries to take care of. The only reason GLE would need to care is if it were linking with static libraries. Is there a situation where it does that? If so, how is that accomplished and why? On macOS, for example, static libraries are not recommended. I don't know about other operating systems.

If we can agree that GLE should link with shared libraries, then the fix for this issue and #32 is simply the removal of all the cmake code related to jbig, zstd, lzma, and deflate.

vlabella commented 1 month ago

They were added since they were dependencies for libtiff. Switching to shared libraries on linux and mac is a good idea. Windows prefers static libraires, so having an option to include them would be good. I think it builds fine if they are not found. It will just give linker errors if libtiff expects them.