How do I install libudev with cmake - cmake

I have a binary (c++) and I want to link against the libudev library. But I want my cmake file verified if the udev library it's installed. If not, download the package and install it. But the only away to install udev library (I think) it's by using sudo apt-get install libudev-dev package or something like that.
My question is: is possible, using a cmake file, download the libudev-dev package ?

Related

How do I install an older ethtool version on a machine?

I need to test if some firmware is compatible with older ethtool versions.
The machine I am using currently have ethtool version 5.16, but I need to install ethtool version 5.13
I got the compressed file from https://mirrors.edge.kernel.org/pub/software/network/ethtool/ and have used tar -zxvf https... to extract the files. This extracts a directory with the contents shown below:
After reading the INSTALL file, I ran ./configure but it gave me the following error: configure: error: The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config
This meant that I could not run make or make install and thus am stuck.
After speaking to colleagues, the solution was found:
apt-get install -y pkg-config. Thereafter the following package was also needed: apt-get install -y libmnl-dev
Simple installed it with ./configure, make and make install and saw the ethtool version was as desired.

How to install cmake-gui latest version on Ubuntu

When installing from package-manager, cmake-gui or cmake-qt-gui are shipped with an older version of cmake.
Even after I build and install cmake's latest version from source, cmake-gui continues to use the older version.
How to force cmake-gui to use cmake latest version builded from source?
The cmake-gui package from repository has a built-in cmake, those two have the same version.
Steps to install cmake-gui latest version.
Install checkinstall to easily remove cmake in the future: sudo apt-get install checkinstall;
Download latest cmake from official site;
Extract the compressed file to some folder;
Open a terminal inside that folder;
Execute: ./bootstrap --qt-gui;
Execute: checkinstall -D make install; You will be prompted with some questions, answer them;
Finished installation! Type cmake at Ubuntu's search bar and you will see a CMake icon;
Verify the version clicking at help >> about;
An alternative to the above.
Check if you have an old version of cmake with cmake --version. If so, remove it with sudo apt-get purge cmake
Download latest cmake from official site
Extract the downloaded cmake-x.xx.x file to your Desktop and then open a terminal inside that file.
Execute: ./bootstrap --qt-gui
After finished, run gmake as prompted.
Move cmake-x.xx.x file to /opt/ directory by going up to your Desktop with the terminal and then running sudo mv cmake-x.xx.x /opt/
Declare cmake binary as global by writing export PATH=/opt/cmake-x.xx.x/bin:$PATH in your ~.bashrc file.
Source with source .bashrc
You will then be able to open cmake or cmake-gui with your terminal from any path in your computer.

Adding Qt Dependencies to spec file in rpmbuild

I'm using Ubuntu 14.04 and I am updating the rpmbuild spec file of an application that now uses Qt.
The packages that I need are the following:
sudo apt-get build-essential
sudo apt-get install mesa-common-dev -y
sudo apt-get install libglu1-mesa-dev -y
sudo apt-get qt5-default
sudo apt-get qtwebengine5-dev
I know the spec file has "BuildRequires" and "Requires" dependency tags...any help in writing this as well as some examples would be helpful. I have a working spec file I just need to add the dependencies.
I think there is some confusion here. spec files are used to generate rpm files. However Ubuntu uses deb files.
Supposing you really want to create an rpm; then you need to know this:
BuildRequires
these packages are required for building the rpm. Typically you will need build-essential and the '*-dev` packages for building your application
Requires
these packages are required upon installation for your application to work; mostly you don't need your build-tools anymore, but you still need the qt5-default for example.
PS: on a little side note I might be one of the only people in the world building deb packages using spec files with a special conversion script https://bitbucket.org/klaussfreire/spec2deb/src/default/ but I wouldn't really recommend that.

installation of cmake on debian 8

I tried to install mcsema on my debian linux but I am stopped by error
Cmake 3.1 or higher is required. You are running 3.0.2. On debian this is the only version could be installed by apt-get install. Building CMake from sources, I get several errors as well. Does anyone know how to install the latest version of Cmake on Debian 8?
Download latests cmake release and follow the README.rst instructions:
UNIX/Mac OSX/MinGW/MSYS/Cygwin ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You need to have a compiler and a make installed. Run the
bootstrap script you find in the source directory of CMake. You
can use the --help option to see the supported options. You may
use the --prefix=<install_prefix> option to specify a custom
installation directory for CMake. You can run the bootstrap script
from within the CMake source directory or any other build directory of
your choice. Once this has finished successfully, run make and
make install. In summary::
$ ./bootstrap && make && make install

How to provide standard library sources for IntelliJ IDEA's Rust project?

I am using Mac for development. I installed Rust 1.13.0 using brew install rust and the Rust plugin 0.1.0.1385 for IntelliJ IDEA. I created my first test project with cargo and while opening it with IDEA I got the message
No standard library sources found, some code insight will not work
I haven't found any sources installed, nor the Rust sources package in Homebrew.
How do I provide sources for the project and what are the practical implication if I ignore this step?
As commented, the supported approach is to use rustup:
Navigate to https://rustup.rs/ and follow the installation instructions for your platform.
Add the rust-src component by running: rustup component add rust-src
Create a new Rust project in IntelliJ and choose your existing Rust project source. If the folder already contains previous IntelliJ project files, you may have to delete those first before it will let you proceed.
IntelliJ-Rust should automatically configure the standard library sources to point to the sources downloaded by rustup.
As a reference, since the question title is broad, for Fedora 28 I had to:
dnf install cargo rust-src
sudo ln -s /usr/lib/rustlib/src /usr/lib/rustlib/x86_64-unknown-linux-gnu/
then give /usr/lib/rustlib/x86_64-unknown-linux-gnu/src/rust/src as "Standard library"
Full setup:
Issue opened to simplify the process
When not using the rustup installer, one can install the source package and direct the rust plugin to use those:
(Tested with CLion 2020.2.1, rust-1.46.0-x86_64-pc-windows-gnu.msi, rustc-1.46.0-src.tar.gz. Offline Rust installers and source archive from there: https://forge.rust-lang.org/infra/other-installation-methods.html )
Although the preferred way of installing Rust is by using rustup, as pointed out by the other posts, it is not uncommon to use the packages that your distro makes available.
I use, for example, the packages provided by Gentoo and I share the same problem about the not prefilled field for standard libraries.
Nevertheless, you can easily find out where your standard libraries have been installed by typing the following find command:
find /usr/lib* -type d -name "rust" | grep src
or the following if you installed rust in your home
find -type d -name "rust" | grep src
The previous commands will help, unless, of course, in your distro there is a package for the binaries and one for the source and you only installed the binary one.
I know the question is for MacOS but this answer is shown up when searching for it on Linux. Below I will answer for Ubuntu.
The path is /usr/lib/rustlib/src/rust/src for Ubuntu 20.04
The way I did is:
Installed rustc from the repositories, which includes cargo
sudo apt install rustc
Then installed rust source package
sudo apt install rust-src
I used apt-file (can be installed with sudo apt install apt-file) to search for the install path of the sources
sudo apt-file update
apt-file list rust-src
This show the path as /usr/src/rustc-1.41.0/src .
But a ls -la in /usr/lib/rustlib/ will reveal symlinks and /usr/lib/rustlib/src/rust/src points to the previous found directory.
Using the symlink on IntelliJ will survive new rust versions.
For Fedora 32 install Rust using command:
dnf install cargo rust-src
and the path to standard libary source is:
/usr/lib/rustlib/src/rust
I used Ubuntu. I follow these steps:
sudo apt install rust-src
wait for the install, then
dpkg -L rust-src
copy the last line. For me it is the standard library path:
/usr/lib/rustlib/src/rust
For MacOS, you need to put /opt/homebrew/bin/.