Closed harokyang closed 4 years ago
Sorry, I cannot repro this issue.
Command cmake CMakeLists.txt -DCMAKE_TOOLCHAIN_FILE=/home/vcpkg/scripts/buildsystems/vcpkg.cmake
result:
root@usr:/home/test# cmake CMakeLists.txt -DCMAKE_TOOLCHAIN_FILE=/home/vcpkg/scripts/buildsystems/vcpkg.cmake
-- OPENIMAGEIO_ROOT_DIR =
-- OpenImageIO includes = /home/vcpkg/installed/x64-linux/include
-- OpenImageIO libraries = /home/vcpkg/installed/x64-linux/debug/lib/libOpenImageIO.a
-- OpenImageIO library_dirs = /home/vcpkg/installed/x64-linux/debug/lib
-- OpenImageIO oiiotool = OIIOTOOL_BIN-NOTFOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /home/test
CMakelists.txt :
cmake_minimum_required(VERSION 3.10)
project(testprj)
add_executable(testprj test.cpp)
find_package(OpenImageIO)
Use the command .\vcpkg integrate install
and add the cmake parameter -DCMAKE_TOOLCHAIN_FILE=/YOUR-VCPKG-INSTALL-PATH/scripts/buildsystems/vcpkg.cmake
to the cmake command line.
Thanks.
Well, the find_package() issue is gone, perhaps some issues on my side But the link issue still existed (edited the title)
On Windows, OpenImageIO was built as dll, You only need to link with OpenImageIO.dll All the other dependency dlls are managed and copied by vcpkg
On linux, OpenImageIO was built as static library without internally linked with its dependent libraries I got bunch of link error like:
undefined reference to Imf_2_3::TypedAttribute<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::staticTypeName()' undefined reference to
Imf_2_3::TimeCode::minutes() const'
undefined reference to openvdb::v5_1::io::MappedFile::createBuffer() const' undefined reference to
png_get_valid'
undefined reference to jpeg_write_coefficients' undefined reference to
TIFFSetDirectory'
undefined reference to Imf_2_3::InputPart::setFrameBuffer(Imf_2_3::FrameBuffer const&)' undefined reference to
openvdb::v5_1::uninitialize()'
undefined reference to Imf_2_3::TypedAttribute<Imf_2_3::Envmap>::readValueFrom(Imf_2_3::IStream&, int, int)' undefined reference to
boost::filesystem::detail::copy(boost::filesystem::path const&, boost::filesystem::path const&, boost::system::error_code*)'
undefined reference to Imf_2_3::Header::dataWindow() const' undefined reference to
Imf_2_3::Header::type[abi:cxx11]() cons
and more...
I have to manually link my project with all the libraries OpenImageIO depend on
OpenImageIO should be built as a shared library by default, and only a static one if installed as OpenImageIO:x64-linux-static
@harokyang Now we just support static build on Linux. And according to #1589, can you try to install ilmbase first and then rebuild openimageio? If it's successful, I will confirm this issue.
Thanks.
@JackBoosY I tried, still got the same link failure
It seems that cmake can't find the correct OpenEXR library.
Can you add message("OpenExr Lib: ${OPENEXR_ILMIMF_LIBRARY_DEBUG} ${OPENEXR_ILMIMF_LIBRARY_RELEASE}")
in VCPKG_PATH\buildtrees\openimageio\src\SOME_HASH\src\cmake\modules\FindOpenEXR.cmake
, rebuild openimageio and provide the following configure logs?
VCPKG_PATH\buildtrees\openimageio\config-x64-linux-dbg-out.log
VCPKG_PATH\buildtrees\openimageio\config-x64-linux-dbg-err.log
VCPKG_PATH\buildtrees\openimageio\config-x64-linux-rel-out.log
VCPKG_PATH\buildtrees\openimageio\config-x64-linux-rel-err.log
Thanks.
how can I kick a package rebuild in vcpkg?
Log shows:
OpenExr Lib: OPENEXR_ILMIMF_LIBRARY_DEBUG-NOTFOUND /home/harok/git/vcpkg/installed/x64-linux/debug/lib/libIlmImf-2_3.so
Got it! Openexr
that builds the debug library does not contain the debug suffix _d
, but uses the suffix to find it in src/cmake/modules/FindOpenEXR.cmake
.
@harokyang Please update vcpkg and rebuild openimageio.
Thanks.
still failed here is a test project
All symbols belong to oiio's dependencies can't be resolved
OK, it's the triplet of linux which set VCPKG_LIBRARY_LINKAGE as static by default By forcing oiio built as shared library solved the problem
But the issue of static oiio still exist, you have to resolve all those symbols manually by linking with OpenEXR libtiff libpng tbb openvdb...more and more......all yourself, which rendered the static oiio almost unusable
I added a custom triplet file with VCPKG_LIBRARY_LINKAGE=dynamic, and build oiio with it But the dependent libraries are also switched to this new triplet, and OpenEXR failed on that dynamic triplet setting
Seems the only solution now is to force oiio build as dynamic in profile.cmake by ignoring the set BUILDSTATIC and LINKSTATIC part
@harokyang Could you provide the error logs?
Thanks.
Confirmed. vcpkg-cmake-wrapper.cmake
doesn't work in linux.
@JackBoosY I'm facing the same issue as described here. You are saying that the problem is on a generic vcpkg file and not on the openimageio cmake files. Could you explain what is the problem?
@fabiencastan What can be confirmed now is that share/openimageio/vcpkg-cmake-wrapper.cmake did not play the expected role, causing this issue.
Hi everyone, can anyone test my PR #12592?
Thanks.
find_package(OpenImageIO) report failure There is no vcpkg-cmake-wrapper.cmake and FindOpenImageIO.cmake under vcpkg/installed/x64-linux/share/openimageio
Also OpenImageIO is built as static library on linux instead of shared library(on Windows) Manually link with this library will also require manually link with other dependent static libraries(OpenEXR and more)