Devolutions / conan-rs

A Rust wrapper of the conan C/C++ package manager (conan.io) to simplify usage in build scripts
Apache License 2.0
34 stars 11 forks source link

conan generate failures #26

Closed vithalsm closed 5 months ago

vithalsm commented 5 months ago

Hi,

While using 'conan-rs' to integrate rust with conan, I see failures as:

[hello 0.1.0] ======== Finalizing install (deploy, generators) ======== [hello 0.1.0] conanfile.txt: Writing generators to /work/rust-app [hello 0.1.0] ERROR: Invalid generator 'json'. Available types: CMakeToolchain, CMakeDeps, MesonToolchain, MSBuildDeps, MSBuildToolchain, NMakeToolchain, NMakeDeps, VCVars, QbsProfile, VirtualRunEnv, VirtualBuildEnv, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps, BazelDeps, BazelToolchain, IntelCC, XcodeDeps, XcodeToolchain, PremakeDeps, MakeDeps, SConsDeps

I am using 'conan2' which doesn't seem to support 'json' as generator. However, install.rs pushes '-g json' for install command.

Could you please help to fix the issue?

awakecoding commented 5 months ago

@Tomcat-42 that's a weird error, did anything happen to the json generator?

vithalsm commented 5 months ago

@awakecoding.

Well, as we discussed, conan2 doesn't support 'json' generator anymore and hence the error. Alternative way is to use '--format=json'. I used the same to get json output of conan install to conanbuildinfo.json file to proceed further. [ Had to modify install.rs to apprend '--format=json' to install command and then json output was present in a generate 'output' file. Copied the json info to conanbuildinfo.json as expected by conan-rs scripts. ]

Now, I got error thrown by serde_json::from_reader(). The error decode (my debug info in conan-rs): SERDE Result... Some(Error("missing field dependencies", line: 3009, column: 1))

BTW, I am using conan2. Appreciate if anyone can try with conan2, might be lot faster to trace/fix the issues.

vithalsm commented 5 months ago

Simplest conanfile.txt that I tried:

[requires] libev/4.33

awakecoding commented 5 months ago

@Tomcat-42 @ravenexp TL;DR: conan2 dropped the JSON generator, and instead can output JSON to standard output using different command-line parameters. To simulate the current behavior where we load the conanbuildinfo.json, @vithalsm has manually copy/pasted the output in the file, but then it fails to load the JSON which has changed. I no longer have time to actively develop conan-rs aside from reviewing and accepting community contributions. Is this something either of you would be willing to look into?

ravenexp commented 5 months ago

@Tomcat-42 @ravenexp TL;DR: conan2 dropped the JSON generator, and instead can output JSON to standard output using different command-line parameters. To simulate the current behavior where we load the conanbuildinfo.json, @vithalsm has manually copy/pasted the output in the file, but then it fails to load the JSON which has changed. I no longer have time to actively develop conan-rs aside from reviewing and accepting community contributions. Is this something either of you would be willing to look into?

Your analysis is correct. The JSON output scheme is completely different in conan2, and that's why I created an independent implementation for v2.0 in https://github.com/ravenexp/conan2-rs. I'm no longer using conan1 and conan-rs, so I'm personally no longer interested in backporting this functionality into conan-rs.

vithalsm commented 5 months ago

@awakecoding @ravenexp conan2-rs helped to get the build done and emit the required link options. Thank you very much !