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

[openimageio[opencolorio] / libheif] Linking against OpenImageIO failed #13354

Closed
shauser67 opened this issue Sep 4, 2020 · 14 comments · Fixed by #22818
Closed

[openimageio[opencolorio] / libheif] Linking against OpenImageIO failed #13354

shauser67 opened this issue Sep 4, 2020 · 14 comments · Fixed by #22818
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@shauser67
Copy link

Host Environment

  • OS: Windows 10, x64-windows-static
  • Compiler: Visual Studio 2019

To Reproduce
Linking my application against openimageio worked fine until recently when a new dependency to libheif was introduced. Although I added heif.lib to both the debug and release configuration there are a number of unresolved external symbols. Maybe a configuration problem? Thanks for any help in advance!

Failure logs

1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_alloc" in Funktion ""public: __cdecl heif::Context::Context(void)" (??0Context@heif@@QEAA@XZ)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_heif_context_alloc".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_free" in Funktion ""public: void __cdecl <lambda_b56393027182d859a078a76b1d71c317>::operator()(struct heif_context *)const " (??R<lambda_b56393027182d859a078a76b1d71c317>@@QEBAXPEAUheif_context@@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_heif_context_free".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_read_from_file" in Funktion ""public: void __cdecl heif::Context::read_from_file(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class heif::Context::ReadingOptions const &)" (?read_from_file@Context@heif@@QEAAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVReadingOptions@12@@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_get_number_of_top_level_images" in Funktion ""public: int __cdecl heif::Context::get_number_of_top_level_images(void)const " (?get_number_of_top_level_images@Context@heif@@QEBAHXZ)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_get_list_of_top_level_image_IDs" in Funktion ""public: class std::vector<unsigned int,class std::allocator<unsigned int> > __cdecl heif::Context::get_list_of_top_level_image_IDs(void)const " (?get_list_of_top_level_image_IDs@Context@heif@@QEBA?AV?$vector@IV?$allocator@I@std@@@std@@XZ)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_get_primary_image_ID" in Funktion ""public: unsigned int __cdecl heif::Context::get_primary_image_ID(void)const " (?get_primary_image_ID@Context@heif@@QEBAIXZ)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_get_image_handle" in Funktion ""public: class heif::ImageHandle __cdecl heif::Context::get_image_handle(unsigned int)const " (?get_image_handle@Context@heif@@QEBA?AVImageHandle@2@I@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_release" in Funktion ""public: void __cdecl <lambda_efa651c352d8d6fdfbdbe4c4c14a08c3>::operator()(struct heif_image_handle *)const " (??R<lambda_efa651c352d8d6fdfbdbe4c4c14a08c3>@@QEBAXPEAUheif_image_handle@@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_heif_image_handle_release".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_get_width" in Funktion ""public: int __cdecl heif::ImageHandle::get_width(void)const " (?get_width@ImageHandle@heif@@QEBAHXZ)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_get_height" in Funktion ""public: int __cdecl heif::ImageHandle::get_height(void)const " (?get_height@ImageHandle@heif@@QEBAHXZ)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_has_alpha_channel" in Funktion ""public: bool __cdecl heif::ImageHandle::has_alpha_channel(void)const " (?has_alpha_channel@ImageHandle@heif@@QEBA_NXZ)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_get_number_of_metadata_blocks" in Funktion ""public: class std::vector<unsigned int,class std::allocator<unsigned int> > __cdecl heif::ImageHandle::get_list_of_metadata_block_IDs(char const *)const " (?get_list_of_metadata_block_IDs@ImageHandle@heif@@QEBA?AV?$vector@IV?$allocator@I@std@@@std@@PEBD@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_get_list_of_metadata_block_IDs" in Funktion ""public: class std::vector<unsigned int,class std::allocator<unsigned int> > __cdecl heif::ImageHandle::get_list_of_metadata_block_IDs(char const *)const " (?get_list_of_metadata_block_IDs@ImageHandle@heif@@QEBA?AV?$vector@IV?$allocator@I@std@@@std@@PEBD@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_get_metadata_type" in Funktion ""public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl heif::ImageHandle::get_metadata_type(unsigned int)const " (?get_metadata_type@ImageHandle@heif@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_get_metadata_size" in Funktion ""public: class std::vector<unsigned char,class std::allocator<unsigned char> > __cdecl heif::ImageHandle::get_metadata(unsigned int)const " (?get_metadata@ImageHandle@heif@@QEBA?AV?$vector@EV?$allocator@E@std@@@std@@I@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_handle_get_metadata" in Funktion ""public: class std::vector<unsigned char,class std::allocator<unsigned char> > __cdecl heif::ImageHandle::get_metadata(unsigned int)const " (?get_metadata@ImageHandle@heif@@QEBA?AV?$vector@EV?$allocator@E@std@@@std@@I@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_decode_image" in Funktion ""public: class heif::Image __cdecl heif::ImageHandle::decode_image(enum heif_colorspace,enum heif_chroma,class heif::ImageHandle::DecodingOptions const &)" (?decode_image@ImageHandle@heif@@QEAA?AVImage@2@W4heif_colorspace@@W4heif_chroma@@AEBVDecodingOptions@12@@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_get_bits_per_pixel" in Funktion ""public: int __cdecl heif::Image::get_bits_per_pixel(enum heif_channel)const " (?get_bits_per_pixel@Image@heif@@QEBAHW4heif_channel@@@Z)".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_get_plane" in Funktion ""public: unsigned char * __cdecl heif::Image::get_plane(enum heif_channel,int *)" (?get_plane@Image@heif@@QEAAPEAEW4heif_channel@@PEAH@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_heif_image_get_plane".
1>OpenImageIO.lib(heifinput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_release" in Funktion ""public: void __cdecl <lambda_58dbd4d088f8023809ea9b3eb12257d8>::operator()(struct heif_image *)const " (??R<lambda_58dbd4d088f8023809ea9b3eb12257d8>@@QEBAXPEAUheif_image@@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp_heif_image_release".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_write" in Funktion ""public: void __cdecl heif::Context::write(class heif::Context::Writer &)" (?write@Context@heif@@QEAAXAEAVWriter@12@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_get_encoder_for_format" in Funktion ""public: __cdecl heif::Encoder::Encoder(enum heif_compression_format)" (??0Encoder@heif@@QEAA@W4heif_compression_format@@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_encoder_release" in Funktion ""public: void __cdecl <lambda_9dfc29ade988a1a284fa8a22212a2bec>::operator()(struct heif_encoder *)const " (??R<lambda_9dfc29ade988a1a284fa8a22212a2bec>@@QEBAXPEAUheif_encoder@@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_encoder_set_lossy_quality" in Funktion ""public: void __cdecl heif::Encoder::set_lossy_quality(int)" (?set_lossy_quality@Encoder@heif@@QEAAXH@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_encoder_set_lossless" in Funktion ""public: void __cdecl heif::Encoder::set_lossless(bool)" (?set_lossless@Encoder@heif@@QEAAX_N@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_encoding_options_alloc" in Funktion ""public: __cdecl heif::Context::EncodingOptions::EncodingOptions(void)" (??0EncodingOptions@Context@heif@@QEAA@XZ)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_encoding_options_free" in Funktion ""public: __cdecl heif::Context::EncodingOptions::EncodingOptions(void)" (??0EncodingOptions@Context@heif@@QEAA@XZ)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_encode_image" in Funktion ""public: class heif::ImageHandle __cdecl heif::Context::encode_image(class heif::Image const &,class heif::Encoder &,class heif::Context::EncodingOptions const &)" (?encode_image@Context@heif@@QEAA?AVImageHandle@2@AEBVImage@2@AEAVEncoder@2@AEBVEncodingOptions@12@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_set_primary_image" in Funktion ""public: void __cdecl heif::Context::set_primary_image(class heif::ImageHandle &)" (?set_primary_image@Context@heif@@QEAAXAEAVImageHandle@2@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_context_add_exif_metadata" in Funktion ""public: void __cdecl heif::Context::add_exif_metadata(class heif::ImageHandle const &,void const *,int)" (?add_exif_metadata@Context@heif@@QEAAXAEBVImageHandle@2@PEBXH@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_create" in Funktion ""public: void __cdecl heif::Image::create(int,int,enum heif_colorspace,enum heif_chroma)" (?create@Image@heif@@QEAAXHHW4heif_colorspace@@W4heif_chroma@@@Z)".
1>OpenImageIO.lib(heifoutput.cpp.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp_heif_image_add_plane" in Funktion ""public: void __cdecl heif::Image::add_plane(enum heif_channel,int,int,int)" (?add_plane@Image@heif@@QEAAXW4heif_channel@@HHH@Z)".
@shauser67 shauser67 changed the title [openimageio[opencolorio] / libheif] Linking against openimageio failed [openimageio[opencolorio] / libheif] Linking against OpenImageIO failed Sep 4, 2020
@NancyLi1013
Copy link
Contributor

Hi @shauser67
Thanks for posting this issue.
Could you please help provide the steps to reproduce this issue and your project case?

@shauser67
Copy link
Author

Hi @NancyLi1013,

I have created a simple "Hello World" project in Visual Studio 2019 to reproduce the problem (x64 / Debug / Multithreaded-Debug):

#include <iostream>

#include <OpenImageIO/imagebuf.h>
#include <OpenImageIO/imagebufalgo.h>

int main()
{
    OIIO::ImageInput::open ("test.png");

    std::cout << "Hello World!\n";
}

Additional include directories:

C:\Users\sh\Documents\vcpkg\installed\x64-windows-static\include

Additional defines:

OIIO_STATIC_DEFINE
OpenColorIO_STATIC

Additional library directories:

C:\Users\sh\Documents\vcpkg\installed\x64-windows-static\debug\lib
C:\Users\sh\Documents\vcpkg\installed\x64-windows-static\debug\lib\static

Additional dependencies:

boost_filesystem-vc140-mt-gd.lib
boost_system-vc140-mt-gd.lib
boost_thread-vc140-mt-gd.lib
Half-2_5_d.lib
heif.lib
IrrXMLd.lib
jpegd.lib
Iex-2_5_d.lib
IexMath-2_5_d.lib
IlmImf-2_5_d.lib
IlmImfUtil-2_5_d.lib
IlmThread-2_5_d.lib
Imath-2_5_d.lib
lcmsd.lib
libpng16d.lib
lzmad.lib
OpenColorIO.lib
OpenImageIO.lib
OpenImageIO_Util.lib
tiffd.lib
zlibd.lib

Although heif.lib is specified as an additional dependency the compiler detects the undefined symbols shown in my initial post.

@NancyLi1013
Copy link
Contributor

Sorry for the delay.
Factually, if you run ./vcpkg integrate project, it's unnecessary to add additional library directories and dependencies.

I try to reproduce this issue on my local, but it was blocked by the error:

1>------ Build started: Project: ConsoleApplication3, Configuration: Debug x64 ------
1>ConsoleApplication3.obj : error LNK2019: unresolved external symbol "public: static class std::unique_ptr<class OpenImageIO_v2_1::ImageInput,struct std::default_delete<class OpenImageIO_v2_1::ImageInput> > __cdecl OpenImageIO_v2_1::ImageInput::open(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class OpenImageIO_v2_1::ImageSpec const *)" (?open@ImageInput@OpenImageIO_v2_1@@SA?AV?$unique_ptr@VImageInput@OpenImageIO_v2_1@@U?$default_delete@VImageInput@OpenImageIO_v2_1@@@std@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@PEBVImageSpec@2@@Z) referenced in function main
1>C:\Users\v-ruil\source\repos\ConsoleApplication3\x64\Debug\ConsoleApplication3.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "ConsoleApplication3.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

@shauser67
Copy link
Author

I suppose you haven't defined both OIIO_STATIC_DEFINE and OpenColorIO_STATIC. These defines are required if you want to link against static library versions of OpenImageIO instead of DLLs.

Looking at heif.h I found a similiar define called LIBHEIF_STATIC_BUILD, but it doesn't remove the linker errors regarding libheif functions.

I slighty modified the C++ example to match an example from OpenImageIO:

#define OIIO_STATIC_DEFINE 1
#define OpenColorIO_STATIC 1
#define LIBHEIF_STATIC_BUILD 1

#include <iostream>

#include <OpenImageIO/imageio.h>

int main()
{
    auto in = OIIO::ImageInput::open ("test.png");

    std::cout << "Hello World!\n";
}

@NancyLi1013
Copy link
Contributor

Thanks for your investigation. I only defined #define OIIO_STATIC_DEFINE 1. I will try this again.

@NancyLi1013
Copy link
Contributor

I have reproduced this issue. But there is no need to define these two definitions.

#define OpenColorIO_STATIC 1
#define LIBHEIF_STATIC_BUILD 1

Just define this is enough.
#define OIIO_STATIC_DEFINE 1

After I changed as static libraries, the error disappeared.

Check Configuration properties -> Vcpkg -> Use static libraries -> Yes.

I will try to fix this as soon as possible.

@NancyLi1013 NancyLi1013 added the category:port-bug The issue is with a library, which is something the port should already support label Sep 23, 2020
@curtisgray
Copy link

Is there an update on this issue? I am having the very same issue: libheif static library is not chosen for linking.

@NancyLi1013
Copy link
Contributor

Sorry for the long delay. I will investigate this issue again.

@curtisgray
Copy link

Thanks for looking into this, @NancyLi1013.

I found a work around. The preprocessor value LIBHEIF_STATIC_BUILD was not set during the openimageio install. So I did the following to work around the issue and fix the problem locally:

NOTE: the VCPKG_DEFAULT_TRIPLET environment variable is set to x64-windows-static triplet configuration

  1. change the file: vcpkg/installed/x64-windows-static/share/libheif/libheif-config.cmake to add LIBHEIF_STATIC_BUILD to the
    INTERFACE_COMPILE_DEFINITIONS.

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"
)
  1. Reinstall openimageio using the commands
vcpkg remove openimageio
vcpkg install openimageio

@NancyLi1013
Copy link
Contributor

Hi @curtisgray

Are you willing to create a PR to fix this issue?

@curtisgray
Copy link

@NancyLi1013, I've created PR #14641 to address this issue.

@plettplett
Copy link

Hi,

Vcpkg installed latest dependencies for OIIO.

Rebuilt OIIO vcpkg 2.3.7.2#4

Builds OK -

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"
)

Reinstall openimageio using the commands -

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 HEIF & e265 when building OIIO static. Please, any ideas.

Thank you,

@plettplett
Copy link

Hi,

I forgot to add that vcpkg cache folders were removed after editing libheif-config.cmake, and before re-installing openimageio.

Thank you,

@JackBoosY
Copy link
Contributor

Hi guys, can anyone test whether #22818 fix this issue?

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

Successfully merging a pull request may close this issue.

6 participants