-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
CMake fixes #62
CMake fixes #62
Conversation
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( |
The issue, i believe. Is that you may now get clobbered files. I would suggest we maybe look into patching the targets file to make the static targets optional. |
Not if we separate the builds completely. TBH I don't understand why |
run_constrained: | ||
# do not co-install with shared-only lib; | ||
# zstd-static contains the shared libs already anyway | ||
- zstd <0.0a0 |
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.
The issue is that the previous design was completely going against this.
The goal is:
- Try to compile a package that depends on package
a
andzstd
. a
links tozstd
dynamically- The new package links to
zstd
statically.
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.
The issue is that the previous design was completely going against this.
Respectfully, the previous design was a hack, and demonstrably broken (at least from the POV of cmake). I think it's a bad idea for the output containing the static+shared build to depend on the output for the shared-only build - it all but guarantees broken CMake metadata and/or clobbered files.
The goal is:
- Try to compile a package that depends on package
a
andzstd
.a
links tozstd
dynamically- The new package links to
zstd
statically.
I don't understand your point here. Why should a package depending on the (already-now) shared zstd
end up linking statically?
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.
On the off chance that you're referring to "zstd-static contains the shared libs already anyway" - this was previously the case already. In fact, the build breaks when passing both:
ZSTD_BUILD_STATIC=ON
ZSTD_BUILD_SHARED=OFF
The error was something like "the CLI cannot be built without the shared lib". I didn't investigate further how to disable building the CLI, as I wanted to keep the previous setup of having both shared & static libs within the zstd-static
output - the only point I changed is that it doesn't depend on the zstd
output anymore.
PS. It's obviously not great to have shared + static lib in the same output, but that's the way things are currently, not least because the upstream build doesn't make it easy to build only the static one.
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.
The error was something like "the CLI cannot be built without the shared lib". I didn't investigate further how to disable building the CLI, as I wanted to keep the previous setup of having both shared & static libs within the
zstd-static
output - the only point I changed is that it doesn't depend on thezstd
output anymore.
I did investigate this now, details in this comment resp. 22966cd
@conda-forge/zstd The current status of this feedstock is not ideal as far as I can tell. Perhaps there's something I'm missing, but at least the CMake integration is broken (see #58). I also don't think it's particularly elegant to have shared and static libs in the same output (and the absence of static libs in the nominally shared-only Current status (before this PR):
Status of this PR:
Future?If I were to draw this feedstock up from scratch, I believe the cleanest approach would be the following, but I didn't want to make such invasive changes now in a PR that's only meant to unblock the CMake stuff and leave the rest working as-is.
|
Yes, that's what I meant...
... both outputs currently build the shared lib & CLI, but I was not aware that conda successfully deduplicates this (in most cases I've seen this happen, it didn't work). I'll edit the overview comment to reflect this. |
@hmaarrfk Any further thoughts on this? |
I unfortunately disagree with the approach, but do not have time to delve into it too much. Instead, I'm hoping you can help me understand who the "owner" of each of the 4 files is:
The source of the problem, in my opinion, is that zstdTargets.cmake (in foreach(_expectedTarget zstd::libzstd_shared zstd::libzstd_static)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
endif()
if(TARGET ${_expectedTarget})
list(APPEND _targetsDefined ${_expectedTarget})
endif()
endforeach()
[...]
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"${target}\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS) This one file, is incompatible with the presently allowed two options:
Therefore, I would like to understand the specifics of the 4 aforementioned files. Which package, in the new structure, actually owns them. |
Thanks for the detailed response. Since the outputs do not depend on each other anymore, each output owns its own copy of those files, and they don't clobber each other because they are intentionally not co-installable. It would be much cleaner still not to have an output that contains both shared & static lib in the first place, but I wanted to keep the amount of changes (in terms of content of the various outputs) to a minimum. If you like the proposal under "Future?" better, I'd be very happy to prepare a PR. |
I'm extremely busy this coming week but I can try to take a look at when I get back. I'd love Isuru's input here too but he is finishing grad school and I don't think it is fair to ask him to review it. With all that said, if you two are in agreement go ahead and merge and we can pull the packages if something is amiss. |
I'll note that this has some degree of time sensitivity, because it's currently blocking progress on building the LLVM 15 rc's (in fact, from the POV of the llvmdev feedstock, #58 is a regression, because the same recipe worked at the time of LLVM 14). I'm stuck at step 0 in a series of quite a few outputs necessary to do that, and not being able to progress mean we might miss the now-much-shorter rc window to get in fixes that are required/beneficial for us (which has the potential to substantially increase the integration work later on). |
Ok. To be honest, i don't even know why the static library got added. I feel like we over cautiously added static libraries, and I'm not sure who requested this particular package. I feel like there will be challenges with users needing to install bot the static and the dynamic library. But let's try. |
Thanks!
Perhaps @wolfv (who did this in #43) still remembers?
Note that the state of affairs is unchanged by this PR (i.e. also previously, |
But packaged will depend on the package named |
I don't understand this concern.
Footnotes
|
Ah, perhaps you meant "users depending on both That indeed would not be possible anymore (though again, the use-case is de facto still supported - as previously - by only depending on |
Package |
Ah, yes, the run-export & transitivity... I hope this is not actually an issue in practice, but if yes, I'd agree to mark the current builds as broken. However that just brings us back to the underlying problem here, which is that we can have only 3 out of the following 4 (AFAICT):
Currently I've chosen to give up 4. - perhaps an argument can be made that giving up 2. is less harmful despite being against best practice. |
Right, so honestly, i would almost favor deleting the static packages, and seeing if anybody complains. |
However, stats show that they are in use, by somebody: |
My hunch however, is that the little people that do try, will not be hitting the paradigm that I described, but rather be trying to build out a fuller statically linked stack. |
For what its worth, I did look for quite some time on making a cmake target optionally installed. It doesn't seem like it is a common usecase. |
The other alternative, which I don't have time to flesh out, is to return to the previous system, but, to ensure that:
This would favor the dynamic library usage, instead of forcing users of cmake+zstd to have the static libraries installed. |
Wouldn't that defeat the point of |
I don't trust github's code-search, but the only uses that show up are micromamba and one other feedstock. The micromamba case makes sense to me (no runtime dep for something "micro"), and is presumably why @wolfv added this in the first place. The good thing is that is will not be affected by the run-export problem (and actually, this would be better served by the kind of standalone In the other feedstock, In particular, both of these cases do not require (best as I can tell) on having
The two known users of |
Run exports will only be triggered for direct dependencies |
I know. I just added "presumably" to my equivalent statement because I'm not 100% sure on all the details behind the scenes... 😅 Any comment about the rest of what I wrote? Would you consider a split as outlined beneficial? Do you still prefer your own proposal (AIUI: do you think that |
I ended up opening an issue for wider discussion about this, because I've encountered the same problem in libprotobuf: conda-forge/conda-forge.github.io#1809 |
Closes #58
Closes #61