Open HazyMrf opened 3 days ago
So I understand I need to do some manipulations with .requires field, but I just don't understand how to achieve the desired result :( . I see that m
and pthread
are linked together with every component, but I cannot link themselves between themselves
Hi @HazyMrf
Thanks for your question.
Hello! I'm writing conanfile.py to pull gperftools into my project. I need my libraries to be built static as .a files so I cannot use default package.
I am not sure what you mean. I have checked the gperftools
package recipe and it defaults to building static libraries:
default_options = {
"shared": False,
(as most Conan package recipes in ConanCenter do)
from conans import ConanFile, CMake, tools
It seems that you are using very legacy Conan 1.X syntax. Even if using Conan 1.X, the imports that you should be using should be:
from conan import ConanFile
from conan.tools.cmake import CMake
But from conans
should not longer be used.
This applies also to generators = "cmake"
, this shouldn't be used anymore.
Same with self.copy()
, it shouldn't be used anymore, instead use from conan.tools.files import copy
and ``copy(self, ...```
In general the recommendation would be to use the ConanCenter recipes, and modify/tune from there what is needed, these recipes are already modernized so they work both with Conan 1 and Conan 2.
Hello @memsharded, thank you for such a quick response. The reasons I decided to write my own conanfile are:
ld.lld-18: error: unable to find library -lprofiler
ld.lld-18: error: unable to find library -ltcmalloc_and_profiler
clang++-18: error: linker command failed with exit code 1 (use -v to see invocation)
When I try to link with CONAN_LIB::gperftools_tcmalloc_and_profiler, CMake just cannot find these libraries:
Target "processor" links to:
CONAN_LIB::gperftools_tcmalloc_and_profiler
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
BTW when I open conanbuildinfo.txt I see this:
[libs_gperftools]
tcmalloc_minimal
tcmalloc
profiler
tcmalloc_and_profiler
[system_libs_gperftools]
pthread
m
So basically library CONAN_LIB::gperftools_tcmalloc_and_profiler must exist, but yet it doesn't
At the same time, when I try to manually inspect installed libraries, I see that there are no profilers
user@machine:~/project/build-release-clang$ ls /home/user/.conan/data/gperftools/2.15-patched/my_artifactory/package/05f8d434f3281f6460cdb60743163e815604864d/lib
libtcmalloc.a libtcmalloc_minimal.a
What is your question?
Hello! I'm writing conanfile.py to pull gperftools into my project. I need my libraries to be built static as .a files so I cannot use default package. By default tcmalloc from gperftools has dependencies (as target_link_libraries) from libraries called spinlock, sysinfo and logging. Right now I'm able to compile my project by doing smth like
What I want, is just write
Here is my conanfile.py: