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 10 unresolved libheif externals when linking my app against openimageio static #21238

Closed
plettplett opened this issue Nov 7, 2021 · 2 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@plettplett
Copy link

Hi,

Vcpkg installed latest dependencies for OIIO when building OIIO vcpkg 2.3.7.2#4

Build SUCCESS -

C:\Users\chris\vcpkg>vcpkg install openimageio[core,gif,openjpeg,webp,libraw,webp]:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
openimageio[core,gif,libraw,openjpeg,webp]:x64-windows-static -> 2.3.7.2#4
Detecting compiler hash for triplet x64-windows-static...
Restored 0 packages from C:\Users\chris\AppData\Local\vcpkg\archives in 288.2 us. Use --debug to see more details.
Starting package 1/1: openimageio:x64-windows-static
Building package openimageio[core,gif,libraw,openjpeg,webp]:x64-windows-static...
-- Using cached OpenImageIO-oiio-9f74cf4d9813bfdcad5bca08b4ff75a25d056cb0.tar.gz.
-- Cleaning sources at C:/Users/chris/vcpkg/buildtrees/openimageio/src/a25d056cb0-36fa00c6d2.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/chris/vcpkg/downloads/OpenImageIO-oiio-9f74cf4d9813bfdcad5bca08b4ff75a25d056cb0.tar.gz
-- Applying patch fix-config-cmake.patch
-- Applying patch fix_static_build.patch
-- Applying patch disable-test.patch
-- Applying patch fix-dependencies.patch
-- Using source at C:/Users/chris/vcpkg/buildtrees/openimageio/src/a25d056cb0-36fa00c6d2.clean
-- Found external ninja('1.10.2').
-- Configuring x64-windows-static
-- Building x64-windows-static-dbg
-- Building x64-windows-static-rel
-- Installing: C:/Users/chris/vcpkg/packages/openimageio_x64-windows-static/share/openimageio/copyright
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-2-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-8.0.0.5906.c9a21571-1-any.pkg.tar.zst.
-- Using msys root at C:/Users/chris/vcpkg/downloads/tools/msys2/aa5af7b2aa7e90e8
-- Performing post-build validation
-- Performing post-build validation done
Stored binary cache: C:\Users\chris\AppData\Local\vcpkg\archives\04\04ffb3cf9bcaa21ecdbdfd40773866eb89aebdfa2f912c4cbcbe931b71e505e2.zip
Installing package openimageio[core,gif,libraw,openjpeg,webp]:x64-windows-static...
Elapsed time for package openimageio:x64-windows-static: 3.818 min

Total elapsed time: 3.867 min

The package openimageio provides CMake targets:

find_package(Modules CONFIG REQUIRED)
target_link_libraries(main PRIVATE OpenImageIO::OpenImageIO)

find_package(OpenImageIO CONFIG REQUIRED)
target_link_libraries(main PRIVATE OpenImageIO::OpenImageIO OpenImageIO::OpenImageIO_Util)

C:\Users\chris\vcpkg>

The problem when static linking my app -

heif.lib(heif_decoder_libde265.cc.obj) : error LNK2019: unresolved external symbol __imp_de265_get_version referenced in function "char const * __cdecl libde265_plugin_name(void)" (?libde265_plugin_name@@YAPEBDXZ)
heif.lib(heif_decoder_libde265.cc.obj) : error LNK2019: unresolved external symbol __imp_de265_get_image_width referenced in function "struct heif_error __cdecl convert_libde265_image_to_heif_image(struct libde265_decoder *,struct de265_image const *,struct heif_image * *)" (?convert_libde265_image_to_heif_image@@ya?AUheif_error@@PEAUlibde265_decoder@@PEBUde265_image@@PEAPEAUheif_image@@@z)
heif.lib(heif_decoder_libde265.cc.obj) : error LNK2019: unresolved external symbol __imp_de265_get_image_height referenced in function "struct heif_error __cdecl convert_libde265_image_to_heif_image(struct libde265_decoder *,struct de265_image const *,struct heif_image * *)" (?convert_libde265_image_to_heif_image@@ya?AUheif_error@@PEAUlibde265_decoder@@PEBUde265_image@@PEAPEAUheif_image@@@z)
....

All 20 Unresolved externals (LNK1120: ) errors refer to : heif.lib(heif_decoder_libde265.cc.obj) .

Here's the OIIO static lib link line -

-L C:\Users\chris\vcpkg\installed\x64-windows-static\lib -l OpenImageIO -l OpenImageIO_Util -l OpenColorIO -l lcms2 -l bz2 -l libpng16 -l zlib -l libwebm -l lzma -l tinyxml -l libszip -l bz2 -l gif -l freetype -l jpeg -l turbojpeg -l raw_r -l openjp2 -l webp -l libhdf5_hl -l libhdf5 -l tiff -l jasper -l Half-2_5 -l IexMath-2_5 -l Iex-2_5 -l IlmImf-2_5 -l Imath-2_5 -l IlmThread-2_5 -l IlmImfUtil-2_5 -l assimp-vc142-mt -l x265-static -l libde265 -l heif -l squish -l webpdecoder -l webpdemux -l boost_thread-vc140-mt -l boost_filesystem-vc140-mt -l boost_system-vc140-mt

I also tried changing libheif-config.cmake -

Before Change:

set_target_properties(heif PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "LIBHEIF_EXPORTS;HAVE_VISIBILITY"
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)

After Change:

set_target_properties(heif PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "LIBHEIF_STATIC_BUILD;LIBHEIF_EXPORTS;HAVE_VISIBILITY"
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)

Vcpkg cache folders were removed after editing libheif-config.cmake, and before re-installing openimageio.

Reinstalled openimageio -

C:\Users\chris\vcpkg>vcpkg remove openimageio[core,gif,openjpeg,webp,libraw,webp]:x64-windows-static

C:\Users\chris\vcpkg>vcpkg install openimageio[core,gif,openjpeg,webp,libraw,webp]:x64-windows-static

Build : SUCCESS

But when linking, exact same link errors (as listed above).

Is there an option for omitting libHEIF (& its dependencies... de265) when building OIIO static. Please, any ideas.

Thank you,

@NancyLi1013 NancyLi1013 added the category:port-bug The issue is with a library, which is something the port should already support label Nov 8, 2021
@NancyLi1013
Copy link
Contributor

Hi @plettplett

Thanks for posting this issue. It's duplicated to #13354, let's move the attention to that issue #13354.

@plettplett
Copy link
Author

plettplett commented Nov 20, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

2 participants