Replies: 1 comment
-
Duplicates #39722. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a library that uses many dependencies managed by vcpkg. I have never had any issues until I recently added OpenImageIO.
On Windows 10 (MSVC 17.6) my library builds and links successfully, and then I am able to build an application and link my library to it.
On Ubuntu 20.04.6 (g++ 10.5.0, ld 2.34) my library builds and links successfully, but all applications fail to link against it with many errors stating an undefined reference to some boost library.
When I build my library as a static lib (on Ubuntu) it yields errors that look like the following:
Minimal Working Example:
Can be found at https://github.com/crgnam/oiio-linker-error
(Required
vcpkg
on your computer):To given more details without needing the repository the file structure looks like this:
vcpkg.json
:CMakeLists.txt
:mylib.hpp
:mylib.cpp
:myapp.cpp
:Build with:
Things I have already tried:
PUBLIC
instead ofPRIVATE
(changingsource/mylib/CMakeLists.txt
to use:target_link_libraries(mylib PUBLIC OpenImageIO::OpenImageIO)
)source/myapp/CMakeLists.txt
to use:target_link_libraries(myapp PRIVATE OpenImageIO::OpenImageIO mylib)
)So far, everything I try still successfully builds and links the library, but fails to link the library to my executable. (Though, everything works fine on Windows/MSVC)
EDIT:
If I install OpenImageIO using
sudo apt install libopenimageio-dev
, and do NOT use vcpkg, and then change thesource/mylib/CMakeLists.txt
to:My application will successfully link to
mylib
and runs fine (on Ubuntu).Does this mean that there is something wrong with vcpkg port? Or am I misunderstanding something? Because my expectation (as with all of the other libraries that I use) is that this shouldn't be a problem (and indeed, it isn't with my other libraries such as TBB, cpsice, etc., or on Windows).
Beta Was this translation helpful? Give feedback.
All reactions