-
Notifications
You must be signed in to change notification settings - Fork 994
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
[question] export-pkg failes on dependencies for a standalone application [conan 2] #16601
Comments
Hi @forry Quick comments first:
This is expected and by design. To compute the
It looks like that there is there some potential to improve the UX, capture the error and show a better error message instead of a trace. Or maybe it is that you used The error is expected, as long as you are trying to avoid the binaries, but it is not possible in this case to avoid the binaries, they are needed in the So I am not sure what is the main issue or what I could be missing. If the binary was built before, all the dependencies should already be in the cache, no need to skip binaries or anything like that, just let |
Maybe I don't understand the conan in the core. But what I want to achieve here are two things. Let's start from the consumer side: I want to download a package that has the exe file in the bin folder and copy it somewhere (or maybe run it, there shouldn't be a difference). Let's say that I have the exe beforehand as a prebuilt binary. In this case, I assume the simple conanfile.py with the package method and setting only as Then comes the second part - the producer side. Here I need to produce said binary. Normally, I could use just a simple conanfile.txt with the build time dependencies (if that is possible) or I could use the conanfile.py with CMakeDeps generator and requirements as I did. And since only the producing of the exe with the cmake driving my build is my goal I might not care about the package_id and the rest correct? As a side note, since My problem is when I try to put those parts together and have one conanfile for both ends. I thought that the I'm trying to understand how it works and what is wrong with my though process.
I suppose that the compiler information for a standalone app for consumer might be useful if the runtime is dynamic and he puts many of those applications together to have only one version of the runtime. But I don't care (the runtime is staticly linked in the app), how do I tell that to the conan while maintaining the possibility to install the dependencies for the build at the same time? (edit)
No as said I only added the
I thought that this would prevent him from wanting those binaries. I have no problem that conan is building deps graph (well maybe a little). I have a problem that he does not realize that for exporting the package he does not need those deps' binaries (and even more when I thought I told him that with the |
The
It seems that you are doing a lot of hops and extra steps that Conan can implement in just one single Those two (local flow + export-pkg) can work together without much issues, this is well tested, you can do the local flow + export-pkg, but the So my recommendation would be to simplify all of that and use
I am still not sure what problem you are trying to solve. Both using
You can make the application independent of the versions of the dependencies with different mechanisms, mostly the "modes": https://docs.conan.io/2/reference/binary_model/dependencies.html, which can be defined globally in
I think you are missing one of the important points of Conan. If a dependency of the application changes, lets say, a static library and it does an important bug-fix, and the application is not re-built, then the application that linked statically will contain the bug. Conan A different story is if you want to do a full "vendoring", that completely isolate the dependencies. This is possible since 2.4, see https://docs.conan.io/2/devops/vendoring.html, and it provides full isolation of the dependencies, they don't even need to exist once the binary is built, and they will never be part of the I have been checking the vendoring package feature, and at the moment it doesn't seem to support the So to summarize:
|
Update: I have tried the
There is another reason that I forgot above, is that the This is an extra reason to have the |
The All of these company internal packages are consumed only as prebuilt binaries but someone is developing them (locally) and he also wants to use conan for getting his dependencies. If his dependencies change, e.g. for a security patch, we would want him to make a new version of the package. So here the vendoring seems to be just what we need for some of them. I'll give it a try. Since I was trying conan before even v1 I periodically return to it after a long time. I'm just trying to fill in the blanks. So, humor me for a second, if you need dependencies to compute the package id, why do you need to have the respective binaries (potentially huge) in the local cache if you know, that you won't be building anything? Why don't you just settle for the recipe? What if the
Without Thanks! (edit) I tried adding the |
Not necessarily. For packaging your own code, an
If the approach works for you, fine. Just note that the
For 2 different reasons:
So dependencies binaries must be installed and available in the cache for a fully functional
This seems a different issue. Conan does not propagate headers or libraries for
Then the |
In our case, the sources are either at the public repo or the consumer shouldn't build the dependency himself and only rely on the prebuilt binaries.
In my case, I have an app with the static runtime linked with one static and one header-only lib. That's why I'm so confused why would I need those for exporting a single .exe, I didn't though about the license.txt use case (in my mind the deployer or cmake would take care of that, I'm really just using export-pkg to copy already prepared stuff), good point.
Is the |
Yes, there might be cases where they might not be needed, but Conan cannot know it, it fully depends on the user recipe logic.
It is very different:
|
Thank you very much. So to sum it up for future reference. If I don't want the consumer to care about my dependencies I use |
What is your question?
Hi,
I'm now trying to package an application that contains a single exe file. On the server it is build by cmake/msvc and then packaged and uploaded. Since it uses a static CRT due to a pdfium library the settings for build supplied by cmake are different than the one that are in the default profile when packaging. But since it is a standalone application and those settings are deleted in
package_id()
it should not matter, at least I thought.The app builds fine with this, using the conan-cmake:
This is what conan-cmake outputs as a profile. The conan-cmake is slightly changed (should not matter, builds fine):
Then I try:
Surprisingly, it is building a dependency graph even though the recipe states it is an application. It is built with one static and one header library. However, it fails to find the static one since the default profile differs(?). But I would expect that it wouldn't matter since the differences are in parts deleted in
package_id()
. I only need the compiler and build_type for the build step.Ok then I tried to add
--skip-binaries
which then exploded on the error in boost. The recipe is the same as in the conancenter (downloaded from git today) but I reexported it under a different user/channel for further usage.My wish for the resulting package would be a single exe file with os, and arch settings in the conaninfo for it is then packaged as a part of a different application that builds with different settings (more like the default profile). It was working for conan 1 though the requirements were set as private there. Why doesn't this work out of the box? I would like to have
settings = "os", "arch"
but thenconan install .
wouldn't work for the dependencies. Should I always set thevisible=False
in therequires()
for applications? What is then thepackage_type
for? Why doesn't it simply skip those dependencies?The recipe for pdfium states
package_type = "static-library"
.conan recipe for the app:
conanfile.py
conan version 2.4.1
Sorry for the long read.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: