Getting the recipe (conanfile.py) of a conan package? - conan

For some package P in my local cache, how do I get the recipe (conanfile.py) of package P?
For example, let's take a conan package called:
zlib/1.2.11#conan/stable
I can install this package into my local cache from conan-center like so:
$ conan install zlib/1.2.11#conan/stable --remote conan-center
How do I unpack the recipe (conanfile.py) of this zlib package into the current directory?
$ mkdir zlib
$ cd zlib
$ conan ??? zlib/1.2.11#conan/stable
^.... what goes here?
$ cat conanfile.py

You are looking for conan get command. It can be used like:
conan get zlib/1.2.8#conan/stable -r conan-center
This will print conanfile and you don't even need to cat it afterwards.
More details about conan get here: https://docs.conan.io/en/latest/reference/commands/consumer/get.html

Related

How to test API from a ROS1 package that works with another ROS2 package?

I have found one ROS1 git repo/package. But it was tested with confirmed ROS Version : ROS Melodic Morenia and Ubuntu 18.04 LTS. So it can be build with catkin_build. Using the following commands
$ cd ~/
$ mkdir --parents catkin_ws/src
$ cd catkin_ws
$ catkin init
$ catkin build
A reference site about vcstool that builds packages after installing dependent packages and overlays your workspace on the installation environment
$ cd ~/catkin_ws/src
$ git clone https://github.com/ros1-package.git
$ sudo apt update
$ sudo apt install python-vcstool python-rosdep python-catkin-tools
$ git clone https://github.com/strv/vcstool-utils.git
$ rosdep install --from-paths ~/catkin_ws/src --ignore-src -r -y
$ ./vcstool-utils/import_all.sh -s .rosinstall ~/catkin_ws/src
$ catkin build
$ source ../devel/setup.bash
Then I have my own repo/package but it uses ROS2. I would like to try and test the existing API of the first ROS1 git repo/package to see if its works together with my own ROS2 package. Would appreciate a help how can proceed and how can test/try the API of the first ROS1 package with my own ROS2 package. Any help?
You can use the ROS 1 to ROS 2 bridge: https://github.com/ros2/ros1_bridge

Where are nanomsg nng libraries installed

I am new to nanomsg and cmake. I installed the nanomsg using the documentation
$ mkdir build
$ cd build
$ cmake -G Ninja ..
$ ninja
$ ninja test
$ ninja install
I am not sure where are the packages installed. I see the headers in /usr/include and cmake directory in /usr/lib64 directory.
/usr/lib64/cmake/nng# ls
nng-config.cmake nng-config-noconfig.cmake
I am unable to compile my sample programs due to this confusion. Any help would be highly appreciated.

CMake not finding CMakeLists.txt

I am trying to install ants in Ubuntu 18 which requires a CMake step.
So far I have taken the following steps:
apt-get install ants
cd /tmp
git clone https://github.com/stnava/ANTs.git
mkdir /opt/ants
cd /opt/ants
cmake -c -g /tmp/ANTS
I keep getting the following error:
CMake Error: The source directory "/tmp/ANTS" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
You apparently have a typo in the path (S should be lower case), try this:
cmake -c -g /tmp/ANTs

How can I package the installed files in CMAKE

I install some files into a folder with CMake Install command. Then I want to package the folder into a zip or tar. How can i do it in cmake. I mean thar after executing the make install I can also get the zip file
PS:
I have tried
install(CODE "execute_process(COMMAND tar -cf ${CMAKE_PROJECT_NAME}.tar ${CMAKE_PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})")
But the install order of CMake is undefined across different directories
You can use cpack. The easiest way just include(CPack) into your root CMakeLists.txt, then make package would be available. Default formats exactly what you asked (.zip for Windows, various .tar for *NIX). To make other packages (RPM, DEB, MSI, EXE) you better to get familiar with documentation.
Since you the install order is undefined across the directories,you can try stating the dependency explicitly or make a list of all directories to be installed and use it in DEPENDS of your custom command which will install the package. cmake -P cmake_install.cmake will install the files to your directory.
add_custom_command(
OUTPUT ${tar_package}
DEPENDS ${deps}
# Install in a temporary dir
COMMAND cmake
-DCOMPONENT=${component}
-DCMAKE_INSTALL_PREFIX=${install_dir}
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
# make tar or whatever you want
COMMAND tar -czf
${tar_package}
-C ${install_dir} .
)

how to map pkg-config names to yum/apt-get

Lots of makefiles use pkg-config but the names don't relate to package managers (e.g. yum / apt). How to map pkg-config names to them? is there a trick?
Example: if I do yum searchName -- look through the name and approximate to pkg-config's name
Result:
$ pkg-config --libs dbus-glib-0
Package dbus-glib-0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `dbus-glib-0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'dbus-glib-0' found
$ sudo yum install dbus-glib
Loaded plugins: langpacks, refresh-packagekit
Package dbus-glib-0.100-5.fc19.i686 already installed and latest version
Nothing to do
$ sudo yum install dbus-glib-0
Loaded plugins: langpacks, refresh-packagekit
No package dbus-glib-0 available.
Error: Nothing to do
In the case of apt-get, if you have some software that complains about this missing package via pkg-config, for instance:
configure: error: Package requirements (gtk+-2.0 >= 2.8) were not met:
No package 'gtk+-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables GTK_CFLAGS
and GTK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Error: Could not run ./configure, which is required to configure banshee
Then it means that the configure script is looking for the gtk+-2.0 pkgconfig package.
Then, what you can do is this:
$ sudo apt-get install apt-file
...
$ apt-file update
...
$ apt-file search gtk+-2.0 | grep "\.pc"
libgtk2.0-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-2.0.pc
Which means you can install package libgtk2.0-dev:
sudo apt-get install libgtk2.0-dev
And the dependency would be satisfied.
In the particular case of the original question:
$ apt-file search --package-only dbus-glib-1.pc
libdbus-glib-1-dev
(dbus-glib-0 seems to be too old to show up in my system.)
The pkg-config files are usually provided by the -devel package so in most cases foo.pc is provided by libfoo-devel. That's still guesswork, but there are two shortcuts:
Installing by path name, if you know where the .pc file will end up
$> yum install /usr/lib64/pkgconfig/foo.pc
That works for any file, but you still need to guess where the .pc file is. The best approach is using the actual pkgconfig requirement:
$> yum install "pkgconfig(foo)"
Use the quotes to avoid the shell trying to interpret the parenthesis.