-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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] Re-fix the usage #20092
Conversation
@jmacey Can you please test this PR? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!
After committing all other changes, the version database must be updated
git add -u && git commit
git checkout dfcd4e4b30799c4ce02fe3939b62576fec444224 -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/baseline.json b/versions/baseline.json
index 4430ddd..bfbc314 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -4718,7 +4718,7 @@
},
"openimageio": {
"baseline": "2.3.7.2",
- "port-version": 1
+ "port-version": 2
},
"openjpeg": {
"baseline": "2.3.1",
diff --git a/versions/o-/openimageio.json b/versions/o-/openimageio.json
index 1ebf88c..827012d 100644
--- a/versions/o-/openimageio.json
+++ b/versions/o-/openimageio.json
@@ -1,5 +1,10 @@
{
"versions": [
+ {
+ "git-tree": "6084a6398514fc24fd450a7b9290937b1274d7b6",
+ "version": "2.3.7.2",
+ "port-version": 2
+ },
{
"git-tree": "799ea36f0486224257ecfea149b429d81e74a879",
"version": "2.3.7.2",
This now builds fine (Windows) but still fails to copy squish.dll to the target directory. |
@jmacey Can you provide me a repro step? |
basically when I build under windows using cmake, the following files are copied into the target directory (build/Debug)
…-a---- 10/09/2021 09:33 212992 boost_filesystem-vc142-mt-gd-x64-1_76.dll
-a---- 10/09/2021 09:33 170496 boost_thread-vc142-mt-gd-x64-1_76.dll
-a---- 10/09/2021 08:19 376832 Half-2_5_d.dll
-a---- 10/09/2021 08:14 1461248 heif.dll
-a---- 10/09/2021 08:19 470016 Iex-2_5_d.dll
-a---- 10/09/2021 08:20 5532672 IlmImf-2_5_d.dll
-a---- 10/09/2021 08:19 156160 IlmThread-2_5_d.dll
-a---- 10/09/2021 08:19 241664 Imath-2_5_d.dll
-a---- 10/09/2021 07:52 1008640 jpeg62.dll
-a---- 10/09/2021 08:07 1922048 libde265.dll
-a---- 10/09/2021 07:53 423424 libpng16d.dll
-a---- 10/09/2021 08:12 8110592 libx265.dll
-a---- 10/09/2021 09:34 428544 lzmad.dll
-a---- 10/09/2021 10:34 15184896 OpenImageIO_d.dll
-a---- 10/09/2021 10:33 2268672 OpenImageIO_Util_d.dll
-a---- 10/09/2021 09:35 1012224 tiffd.dll
squish.dll is missing and the exe will not run, If I manually copy the file to the target it works fine, I'm guessing this is from the cmake build / link process (it's different under mac and linux as they add relative link paths or use static libs).
Jon
________________________________
From: Jack·Boos·Yu ***@***.***>
Sent: 10 September 2021 10:50
To: microsoft/vcpkg ***@***.***>
Cc: Jon MacEy ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vcpkg] [openimageio] Re-fix the usage (#20092)
but still fails to copy squish.dll to the target directory.
@jmacey<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fjmacey&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7C39ceb932badf4437ee0308d974407b99%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637668642566979287%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PPFjfqBuAZF3QNYx9D%2FHFtygqUIq8FdjvbwwknXVOkQ%3D&reserved=0> Can you provide me a repro step?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fmicrosoft%2Fvcpkg%2Fpull%2F20092%23issuecomment-916779222&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7C39ceb932badf4437ee0308d974407b99%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637668642566979287%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=EY5eYrcKq0j4Hkj0D2HoCf2nZKbO%2B%2F%2Be%2FJp%2Fd%2FlJOXY%3D&reserved=0>, or unsubscribe<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fnotifications%2Funsubscribe-auth%2FAACK4G6HKHDJVV3I55MSZX3UBHIH3ANCNFSM5DY3OAKQ&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7C39ceb932badf4437ee0308d974407b99%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637668642566989284%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=IzNMLeG%2F%2BYn%2BlDTly4P8d9%2FR2ePU9MsYSFduOyd2izc%3D&reserved=0>.
Triage notifications on the go with GitHub Mobile for iOS<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7C39ceb932badf4437ee0308d974407b99%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637668642566989284%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6Y0U%2FrzMdCUfyBEOKbt8HvQkaBJW%2FSq6OPTEiJdtEEY%3D&reserved=0> or Android<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7C39ceb932badf4437ee0308d974407b99%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637668642566989284%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=My5RskdGCSbyKMh3X%2By9Ze2oeMhZo6I9JL%2Bnx1DFptw%3D&reserved=0>.
________________________________
BU is a Disability Confident Employer and has signed up to the Mindful Employer charter. Information about the accessibility of University buildings can be found on the BU AccessAble webpages.
This email is intended only for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email, which must not be copied, distributed or disclosed to any other person.
Any views or opinions presented are solely those of the author and do not necessarily represent those of Bournemouth University or its subsidiary companies. Nor can any contract be formed on behalf of the University or its subsidiary companies via email.
|
@jmacey Did you use the |
I confirmed that
|
The dll is not copied to my target directory when building a project against openimageio. It is created in the vcpkg tree.
Jon
On 13 Sep 2021, at 07:06, Jack·Boos·Yu ***@***.***> wrote:
I confirmed that squish.dll was copied into tools/openimageio:
PS F:\vcpkg\packages\openimageio_x86-windows\tools\openimageio> ls
Directory: F:\vcpkg\packages\openimageio_x86-windows\tools\openimageio
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 9/12/2021 10:56 PM plugins
-a---- 7/19/2021 6:49 PM 94208 boost_filesystem-vc141-mt-x32-1_75.dll
-a---- 7/19/2021 6:52 PM 66048 boost_thread-vc141-mt-x32-1_75.dll
-a---- 10/19/2020 12:38 AM 135680 brotlicommon.dll
-a---- 10/19/2020 12:38 AM 41984 brotlidec.dll
-a---- 1/15/2021 1:05 AM 52736 bz2.dll
-a---- 2/3/2021 11:18 PM 526848 freetype.dll
-a---- 1/6/2021 1:00 AM 274432 Half-2_5.dll
-a---- 3/12/2021 8:09 AM 832000 harfbuzz.dll
-a---- 8/15/2021 8:15 PM 339968 heif.dll
-a---- 9/12/2021 10:55 PM 93696 iconvert.exe
-a---- 1/17/2021 6:50 PM 28398592 icudt67.dll
-a---- 1/17/2021 6:50 PM 2095104 icuin67.dll
-a---- 1/17/2021 6:50 PM 1377792 icuuc67.dll
-a---- 9/12/2021 10:55 PM 41984 idiff.exe
-a---- 1/6/2021 1:00 AM 181760 Iex-2_5.dll
-a---- 9/12/2021 10:55 PM 53760 igrep.exe
-a---- 9/12/2021 10:55 PM 119296 iinfo.exe
-a---- 1/6/2021 1:00 AM 2668544 IlmImf-2_5.dll
-a---- 1/6/2021 1:00 AM 35840 IlmThread-2_5.dll
-a---- 1/6/2021 1:00 AM 84992 Imath-2_5.dll
-a---- 9/12/2021 10:55 PM 238592 iv.exe
-a---- 10/14/2020 10:54 PM 528896 jpeg62.dll
-a---- 1/3/2021 9:56 PM 417792 libde265.dll
-a---- 2/6/2021 6:42 PM 162304 libpng16.dll
-a---- 5/31/2021 3:01 AM 2905600 libx265.dll
-a---- 2/18/2021 1:49 AM 132608 lzma.dll
-a---- 9/12/2021 10:55 PM 94208 maketx.exe
-a---- 9/12/2021 10:55 PM 564736 oiiotool.exe
-a---- 9/12/2021 10:55 PM 6078464 OpenImageIO.dll
-a---- 9/12/2021 10:54 PM 581120 OpenImageIO_Util.dll
-a---- 10/19/2020 1:02 AM 409088 pcre2-16.dll
-a---- 9/12/2021 10:56 PM 9 qt.conf
-a---- 8/15/2021 8:42 PM 4476416 Qt5Core.dll
-a---- 8/15/2021 8:45 PM 5555712 Qt5Gui.dll
-a---- 8/15/2021 8:47 PM 4606976 Qt5Widgets.dll
-a---- 9/1/2021 11:05 PM 41472 squish.dll
-a---- 2/18/2021 1:50 AM 380928 tiff.dll
-a---- 10/14/2020 10:55 PM 73216 zlib1.dll
-a---- 12/23/2020 1:38 AM 460800 zstd.dll
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fmicrosoft%2Fvcpkg%2Fpull%2F20092%23issuecomment-917869179&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7Cafef699a2a8b49cb270c08d9767c9308%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637671099674711497%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2F9%2FenLaroL15%2B%2BIvPNiSYYlwnqSt8rXC2Vp8qOgnh%2Bw%3D&reserved=0>, or unsubscribe<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fnotifications%2Funsubscribe-auth%2FAACK4G2TCBYRB5WUX7TRSHTUBWIE3ANCNFSM5DY3OAKQ&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7Cafef699a2a8b49cb270c08d9767c9308%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637671099674711497%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=y%2BjMgaapyEqknFIdXXwh68PtQh5VzicWa84UILDu8qA%3D&reserved=0>.
Triage notifications on the go with GitHub Mobile for iOS<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7Cafef699a2a8b49cb270c08d9767c9308%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637671099674721490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GHvOE1V8Xcs2Suykgh0k0V5S7KOOivEtzYO44cnbO68%3D&reserved=0> or Android<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7Cafef699a2a8b49cb270c08d9767c9308%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637671099674721490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XdijJ2%2B%2FuRz2hWGrzQIMvTwD2gHwm1OfK6hZh3HAe4I%3D&reserved=0>.
…________________________________
BU is a Disability Confident Employer and has signed up to the Mindful Employer charter. Information about the accessibility of University buildings can be found on the BU AccessAble webpages.
This email is intended only for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email, which must not be copied, distributed or disclosed to any other person.
Any views or opinions presented are solely those of the author and do not necessarily represent those of Bournemouth University or its subsidiary companies. Nor can any contract be formed on behalf of the University or its subsidiary companies via email.
|
After reading the source code, oiio requires squish, but it wasn't exported in the oiio cmake config files. That cause the usuage issue. I think that's a oiio bug, @lgritz, could you please help comfirm this? All squish related codes here: if (Libsquish_FOUND)
# External libsquish was found -- use it
add_oiio_plugin (ddsinput.cpp
LINK_LIBRARIES Libsquish::Libsquish
)
... In src/cmake/add_oiio_plugins.cmake: macro (add_oiio_plugin)
cmake_parse_arguments (_plugin "" "NAME" "SRC;INCLUDE_DIRS;LINK_LIBRARIES;DEFINITIONS" ${ARGN})
...
set (format_plugin_libs ${format_plugin_libs} ${_plugin_LINK_LIBRARIES} PARENT_SCOPE)
... In src/libOpenImageIO/CMakeLists.txt: ...
target_link_libraries (OpenImageIO
...
PRIVATE
...
${format_plugin_libs} # Add all the target link libraries from the plugins
... |
It seems like this port is trying to vendor libsquish when it should depend on the libsquish port instead? |
@BillyONeal No, oiio just use the internal FindLibsquish.cmake and oiio depends on libsquish. |
If it wants to make squish.dll (as reported by @jmacey ) that doesn't sound like an internal-only use. (I know this isn't the bug you're necessarily trying to fix in this PR but ideally we would de-vendor that dependency) |
No, it won't, I confirmed that. |
I see, there was some confusion here. I was under the impression that I said "this vendors libsquish" and you said, effectively, "it vendors a custom version of libsquish that it only uses internally". But what you actually said was "it does depend on the libsquish port" and Bill was blind. It still seems like the targets exported by |
To clarify for other reviewers, the situation is:
The usage text ends up being:
|
This does not work:
|
I merged this anyway because I observe that the problems I'm reporting here aren't problems caused by this PR. |
@JackBoosY But it's not part of OIIO's public interface. OIIO internals call into libsquish, but downstream apps that use OIIO's APIs don't need to call libsquish APIs. Is that not the meaning of PRIVATE here? If I've misunderstood, then what would be an example of where PRIVATE would be the right designation? |
@lgritz Even if you only use it internally, it needs to be on your customers' link lines. If you make it |
@JackBoosY I modified OIIO's CI so that the Windows tests for sure use vcpkg's libsquish (it had previously just used the embedded version), and it seems to work. What's different? @BillyONeal OK, I can accept that I've misunderstood these modifiers (though they sure have worked for me for a long time). But then, can you explain to me what is an example of when PRIVATE would be appropriate? What's it for, if I have to use PUBLIC for anything that needs to be available to downstream clients at link time? Is this Windows specific? Because on Linux and OSX, when libOpenImageIO.so links to libsquish.so, a downstream program only needs to link against libOpenImageIO.so. I only need to mark as PUBLIC if the downstream app might directly call into libsquish (i.e., if libsquish types or APIs are part of OIIO's public API). |
For me this is a specific vcpkg / windows thing. If I build anything against olio the program builds but will not run as squish.dll is not copied into the target directory. If I copy the squish.dll into the directory I will work.
This is quite a new thing (last 3-4 months as I don’t update vcpkg that often), It first manifested with the spurious AND in the original error report which has now been fixed. Now I get the squish problem which is not a build / link error but a runtime one on Windows only.
Sorry can’t be specific as to when this error started to occur but I know for certain all was fine in my 2nd Semester so this was around Feb until June when the students submitted their work. Think this points to a bigger issue with vcpkg versions and ports but I guess that discussion is for another day.
Also building for source doesn’t cause to many issues either, however I can’t expect all UG students to do this hence using vcpkg for ease :-)
On 17 Sep 2021, at 17:27, Larry Gritz ***@***.******@***.***>> wrote:
@BillyONeal<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2FBillyONeal&data=04%7C01%7Cjmacey%40bournemouth.ac.uk%7C893cc96beb314ee61e0508d979f811b7%7Cede29655d09742e4bbb5f38d427fbfb8%7C0%7C0%7C637674928614551188%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2WSVVBK62oNsWuDqgSFHXyCbCFnSe6ERackrXfknnS8%3D&reserved=0> OK, I can accept that I've misunderstood these modifiers (though they sure have worked for me for a long time). But then, can you explain to me what is an example of when PRIVATE would be appropriate? What's it for, if I have to use PUBLIC for anything that needs to be available to downstream clients at link time?
…________________________________
BU is a Disability Confident Employer and has signed up to the Mindful Employer charter. Information about the accessibility of University buildings can be found on the BU AccessAble webpages.
This email is intended only for the person to whom it is addressed and may contain confidential information. If you have received this email in error, please notify the sender and delete this email, which must not be copied, distributed or disclosed to any other person.
Any views or opinions presented are solely those of the author and do not necessarily represent those of Bournemouth University or its subsidiary companies. Nor can any contract be formed on behalf of the University or its subsidiary companies via email.
|
I'm not aware of great uses for The more common example is to have private/internal headers that customers aren't supposed to have in their environment but that a project uses internally. |
On Unix/Linux, with dynamic libraries, if you have libA that depends on libB only for internals (doesn't expose B in A's public API), that dependency to B can be PRIVATE, and libA linking against libB is enough to ensure that when appC links against libA, it will automatically pull in libB. At least for shared libraries. For static, you may need to specify them, but my impression was that CMake handled the decisions about whether to add B explicitly to the linkage for A depending on whether it was static or dynamic. Is that not possible in Windows? So the general guidance is that I should pretty much always be using PUBLIC, regardless of whether a dependency is exposed through my APIs, in order to guarantee that the transitive link needs are met? I probably have a lot of places to fix, then. |
Doing some more reading... Generally, dynamic libraries encode their dependency information (what they were linked against when you linked the library itself). Static libraries do not. So what CMake is supposed to do is understand this, and for PRIVATE library dependencies, pass on the library interface if it's static but not dynamic. If I understand correctly, marking everything as PUBLIC seems like overkill. However, I can believe that what happens is that, if static libs are used for libsquish, although cmake will pass along the library dependency in our exported config, a downstream consumer still won't have the FindLibsquish.cmake, and so may not have a good way to find the library when it needs it for linking? |
|
@JackBoosY so the PUBLIC/PRIVATE is ok the way it is, the problem was just that the debug OIIO build was selecting the release squish build? That sounds like it's probably a bug in my FindLibsquish.cmake. Let me see if I can produce a fix for that. |
You know what? OIIO's CI tests Windows, but only release build. Adding a debug build to see if I can reproduce. |
AFAIU multiple issues are discussed here.
|
@lgritz The result of dumpbin proves that if we want to use oiio.lib, you must add squish.lib to the link queue, which means that libsquish should be exported to the |
When users use libsquish through vcpkg, they should use
Yes, agreed.
As I said in 1, even if libsquish does not export its config.cmake/targets.cmake, we can use the installed Findlibsquish.cmake to find and use it. |
Basically yes. But:
File list for libsquish, from microsoft.vcpkg.ci:
|
@dg0yt Fine, I will make a PR to export the libsquish targets. |
@lgritz After reading another PR, I would like to another insight: if(BUILD_SHARED_LIBS)
target_compile_options(lcms2 PRIVATE -DCMS_DLL_BUILD)
target_compile_options(lcms2 PUBLIC -DCMS_DLL)
endif()
target_compile_options(lcms2 PRIVATE -DUNICODE -D_UNICODE) CMake doesn't require any |
I don't buy the "only header libraries are PRIVATE", that seems to contradict everything I read in Craig Scott's book, "Professional CMake," and many other sources. From Professional CMake, 9th ed, p. 248,
I believe that PRIVATE is the right designator to use here, because the squish library is used internally to OIIO, but is not part of the exported API. If squish is a dynamic library, there is no need to propagate this transitive dependency because it's handled by the linker; if squish is a static library, CMake already is supposed to know that (for this one case) it needs to treat it as public and propagate the dependency. I think we're using PUBLIC/PRIVATE correctly, but something else is going wrong for this one library (circumstantial evidence: if I was really using PRIVATE incorrectly, wouldn't ALL the libraries have the same failures?). |
Okay. I would prefer to see "special cases" in the CMake documentation, not in secondary literature. And CMake documentation just has the following:
I guess the behaviour comes down to this code:
I am confused now 😕 |
"Linked to, but not part of the link interface" is terse, but has all the information. For shared libraries, A linking B means that an app linking A only needs to name A (which itself retains the reference to B). But for static libraries, this is not the case; an app using A needs to also link B explicitly, and CMake is supposed to track this. Here's some primary documentation that implies this: https://cmake.org/cmake/help/v3.21/guide/tutorial/Selecting%20Static%20or%20Shared%20Libraries.html#mathfunctions-cmakelists-txt-add-library-static Also, to add the the confusion, I'm using PRIVATE for all the external libraries, yet there is only this one library that we are having trouble with. To me, that indicates that to really understand what's going on, we need to understand what is different about this library. I have a few hypotheses, but not having a Windows machine and being a total vcpkg noob, I'm not sure which are plausible, but maybe you can recognize which have merit:
|
Also, https://cmake.org/cmake/help/v3.21/prop_tgt/LINK_INTERFACE_LIBRARIES.html :
Can you tell if the vcpkg libsquish is generating shared, static, or both? I'm still gravitating toward suspecting that the problem here might be that the vcpkg libsquish build itself is maybe making a static library only that is not correctly set up to mix properly with the other dynamic libraries? |
To hammer a previous point with a concrete example: Why does PRIVATE link against gif library work, and against libtiff works, but PRIVATE link against squish does not? I think that when we can articulate the answer to that question, we'll know how to solve the problem for squish once and for all. |
@lgritz wrote:
Let's refer to "libsquish", to avoid confusion with the software named "Squish" which has an official Find module in CMake. Depending on actual values are given is to
So the form varies:
This illustrates the pros and cons of the variants:
|
Would it be better if I only used targets for dependencies that reliably export config files (and have a corresponding find_dependency in my OpenImageIOConfig.cmake), and for all other cases, use old fashioned |
@lgritz Yes, using module mode to find dependencies can avoid calling |
I agree on the "Yes", but I don't undestand the second part. IMO the modern principles are:
The downside are that
so you have to be careful about minimum versions to be installed on the user side. @lgritz Thanks for your persistence on clarifying |
I had somewhat recently start switching to targets, even for my Find* modules, mostly because of the compactness (just say the target in target_link_libraries, and it also takes care of the includes for you) and simply because I thought it was "modern" usage. I did not consider any downsides, which now I see. I should probably simply back out of that, and to back to the variables at least for the things where I've written my own Find modules, which tend to be fairly simple (maybe too simple). I never considered the "missing for my exported config" issue, probably because I tend to use dynamic libraries myself, where the transitive linkage takes care of itself. I appreciate your patience with me on this. I'm trying to get it right, but especially not being a windows user and tending not to use static libraries, I think I was not myself bumping into some of the edge cases that are now more apparent to me. |
Yeah, vcpkg comes with static, and it comes with combined debug+release. It is not really an edge case, but that's why custom find modules often fail. At least, please make use of |
Hopefully this will make things a little easier for downstream builders: AcademySoftwareFoundation/OpenImageIO#3108 Basically, my new strategy is: |
Merging to master caused all my changes in portfile.cmake to be rolled back.
Re-fix them:
FindOpenEXR.cmake
since it calls find_dependency(OpenEXR CONFIG) and it contains the required macroFOUND_OPENEXR_WITH_CONFIG
in OpenImageIOConfig.cmake.FindLibsquish.cmake
andvcpkg-cmake-wrapper.cmake
installation path.Related: #19916.