CMake error not providing FindGnuradio.cmake - gnuradio

Getting the following error when running cmake and am unsure how to fix it. It seems like it's telling me exactly what to do, but not very familiar with Linux.
CMake Error at CMakeLists.txt:153 (find_package):
By not providing "FindGnuradio.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Gnuradio",
but CMake did not find one.
Could not find a package configuration file provided by "Gnuradio"
(requested version 3.7.3) with any of the following names:
GnuradioConfig.cmake
gnuradio-config.cmake
Add the installation prefix of "Gnuradio" to CMAKE_PREFIX_PATH or set
"Gnuradio_DIR" to a directory contaning one of the above files. If
"Gnuradio" provides a separate development package or SDK, be sure it has
been installed.
EDIT: So I've located something called FindGnuradioRuntime.cmake but am still unsure what to do with it. The error message makes me think it was looking for something named "FindGnuradio.cmake" when it was actually called "FindGnuradioRuntime.cmake"
Commands that were run on a fresh Ubuntu install:
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig
git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr/
mkdir build
cd build/
cmake ../ (here is where I ran into a the problem above)

Install / build GNU Radio.
Remove the CMakeCache.txt
When you call cmake .. you can pass arguments. Add the path to the parent directory of GnuradioConfig.cmake or FindGnuRadio.cmake as in
cmake -DCMAKE_PREFIX_PATH=/gnu/radio/path ..

Making my somewhat hidden response an actual answer:
Just found out that the install script provided on GNURadio's website not only installs GNURadio, but also the RTL SDR requirements as well, so I wiped my VM and started over and was successful. It takes a few hours, but it is complete and automated so definitely the best way to install GNURadio. Script is here http://www.sbrac.org/files/build-gnuradio

As previous answers noted you didn't describe where you ran into this problem. I'm going to assume it happened when creating an Out Of Tree (OOT) module.
On the OOT Module Page, see the "Notes" Section. They note that you need to install gr-dev. That package will install GnuradioConfig.cmake. You can find it in the standard yum repos, and install it with sudo yum install gnuradio-devel.

Related

Environment variables (zsh terminal) installed through npm on MacOS 12.4 Monterey - SOLVED

Background:
Dear Stackoverflow community. I recently switched from Windows to MacOS and am at a loss how to configure environment variables. Many of the previous questions asked here are about bash instead of zsh.
Goal:
I am trying to install an npm package globally. For instance:
npm install -g vercel
or any other package, and use it in my Visual Studio Code terminal (also zsh). If I want to deploy code I have to use 'npx vercel deploy' every time. I want to be able to use "vercel deploy" but instead I get:
zsh: command not found: vercel
What I tried so far:
Installing the package in zsh and visual studio code terminals (didn't work)
Setting the path equal on both VS and terminal: export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I learned that you need to add environment variabels to a .zshrc file. I don't seem to have a zshrc file. When I do:
sudo ~/.zshrc
Password: XXXXXX
sudo: /Users/vincent/.zshrc: command not found
I am getting another error.
I read in the zsh man file that you should use $HOME/.zshrc instead. Again I am getting the same errors:
vincent#Vincents-MacBook-Air-2 ~ % $HOME/.zshrc
zsh: permission denied: /Users/vincent/.zshrc
vincent#Vincents-MacBook-Air-2 ~ % sudo $HOME/.zshrc
sudo: /Users/vincent/.zshrc: command not found
Update 1:
#slebetman Thank you for your explanation. When I open the terminal I go to home via "cd $HOME" which puts me in in the home directory. However there is no way for me to create a .zshrc file in that directory. Neither via touch or vs code. I am getting the following error: "Unable to write file '/home/.zshrc' (Unknown (FileSystemError): Error: ENOTSUP: operation not supported on socket, open '/home/.zshrc')"
Update 2:
I did manage to find the .zshrc file in visual studio code under /etc. I hope this will work. I was able to overwrite the file with Sudo and add environment variables to it.
Add this to the file .zshrc file under /etc and force overwrite it:
export vercel=/Users/vincent/.npm-global/bin/vercel
Screenshots below for those who will try in the future:
Image with .zshrc file layout
Final remarks:
I don't understand how it is so difficult to add environment variables on Mac while everything else is so easy.
I have read many different questions on stackoverflow, and I can't seem to solve it. Also since I am a newbie I am not allowed to comment on there so I post here in the hope that anyone can help me :)
Best,
Vincent
Note that when you do:
npx vercel deploy
Npm will execute vercel for you without installing it. It does that by temporarily downloading vercel. If you want to run vercel directly without using npx then simply don't use npx. Install it instead:
npm install -g vercel
The -g flag installs the module globally and if the module has a CLI it will be available globally as well (note that depending on your setup you may need admin/sudo privileges to use the -g flag). Now you can run vercel by simply typing:
vercel deploy
This works in all operating systems supported by node.js and npm. That means you can even do this in Windows. In fact I use npm to distribute my tools in a simple cross-platform way so I don't have to support multiple package managers like chocolatey (Windows), homebrew (Mac OS), deb (Debian based distros), rpm (Redhat based distros) etc. (npm does not require your software to be written in node.js - I have published packages on npm written in tcl and bash).

CMake support "make uninstall"?

I am trying to find some sudo-free solution to enable my users install and unistall my application. Using
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/opt/${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}/")
SET(CMAKE_INSTALL_RPATH "$ENV{HOME}/${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}/")
I can direct the files to the user's home directory, and
make install
works fine. With reference to
What's the opposite of 'make install', ie. how do you uninstall a library in Linux?
I did not find any idea, which is sudo-free and is not complex for a non-system-admin person.
Is anyhow make uninstall supported by CMake?
My uninstall is quite simple: all files go in a subdirectory of the user's home. In principle, removed that new subdirectory could solve the problem. Has make install, with parameters above, any side effect, or I can write in my user's guide that the newly produced subdirectory can be removed as 'uninstall'?
If you want to add an uninstall target you can take a look to the official CMake FAQ at:
https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake
If you just want a quick way to uninstall all files, just run:
xargs rm < install_manifest.txt
install_manifest.txt file is created when you run make install.
No there is not. See in the FAQ from CMake wiki:
By default, CMake does not provide the "make uninstall" target, so you
cannot do this. We do not want "make uninstall" to remove useful files
from the system.
If you want an "uninstall" target in your project,
then nobody prevents you from providing one. You need to delete the
files listed in install_manifest.txt file. [followed by some example code]
Remove files and folders (empty only) added by make install from a cmake project:
cat install_manifest.txt | sudo xargs rm
cat install_manifest.txt | xargs -L1 dirname | sudo xargs rmdir -p
The second command will print a bunch of errors because it recursively deletes folders until it finds one that is not empty. I like seeing those errors to know which folders are left. If you want to hide these errors you can add --ignore-fail-on-non-empty to rmdir.
From the source folder:
open install_manifest.txt (created by make install)
remove all the directories/files listed
remove any remaining files you missed:
xargs rm < install_manifest.txt
remove any hidden directories/files:
$rm -rf ~/.packagename
Remove the source folder.
# make uninstall
add_custom_target("uninstall" COMMENT "Uninstall installed files")
add_custom_command(
TARGET "uninstall"
POST_BUILD
COMMENT "Uninstall files with install_manifest.txt"
COMMAND xargs rm -vf < install_manifest.txt || echo Nothing in
install_manifest.txt to be uninstalled!
)
Add this to CMakeLists.txt, then an uninstall target is made by hand.
One solution is to use packaging with CPack. In Linux, that will create a package that can be installed/uninstalled by your package manager. In Windows with the NSIS generator, you'll get an installer which also deploys uninstall.exe to your program files.
Here's a basic example of creating a debian package:
$ touch file
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
install(FILES file DESTINATION etc)
set(CPACK_PACKAGE_NAME foo)
set(CPACK_PACKAGE_CONTACT "me <me#example.com>")
set(CPACK_GENERATOR DEB)
include(CPack)
$ cmake .
$ cpack
Then instead of make install DESTDIR=/usr/local use sudo dpkg -i foo-0.1.1-Linux.deb.
To uninstall use sudo dpkg -P foo or sudo apt purge foo.
The advantage of using a package manager over make install are numerous. Here are a few:
If you lose the source code, you can still uninstall the software.
If you dpkg -S /etc/foo, it will tell you which package "owns" this file.
If you want to install a new version of the software, you won't need to manually uninstall the previous version. It's all automatic.
You can publish the package so others can install it.
If your package deploys a file that is also owned by another package, it will fail to install. That's good because it prevents you from accidentally destroying other packages.
You have the ability to add scripts to the installation. Instead of simply copying files, you can add system users, enable serves, or perform compatibility operations on old databases during upgrade.

All AUR packages..after builded by makepkg .. necessarily create an *.pkg.tar.xz file?

Well .. this question came from another one closed question that i posted here. I installed android using yaourt.. and that was ok.. it worked fine.
But, before that i was trying doing manually.. using makepkg. But it seems that it did not create any package named *.pkg.tar.xz .
After a search.. and some question for my friends.. they told me that maybe the make process had problems and, it had some silent problem that not created the *.pkg.tar.xz.
So.. what do you think.. all AUR packages necessarily create *.pkg.tar.xz file and it was a problem when i was trying to build. Or has certain packages , as android , that do not create such *.pkg.tar.xz files?
An AUR package is a PKGBUILD file with instructions to makepkg to build a package (which is a .pkg.tar.xz file), so yes, unless there is any error on the build process, all AUR packages create a .pkg.tar.xz file.
You could try downloading the PKGBUILD file and running the makepkg -si manually to check any build error. Here's an example to build and install the android-sdk package, adjust accordingly to your desired package. This should create a android-sdk-*-x86_64.pkg.tar.xz file.
cd $(mktemp -d)
wget https://aur.archlinux.org/packages/an/android-sdk/android-sdk.tar.gz
tar xzvf android-sdk.tar.gz
cd android-sdk/
makepkg -si
Used arguments to makepkg:
-s, --syncdeps Install missing dependencies with pacman
-i, --install Install package after successful build

Where are makepkg outputs packages built?

I'm trying to install a AUR package.
It seems easy, and I follow the Wiki description for it.
I downloaded the tarball, did makepkg -S to download the source and build it.
Apparently no error messages at output.
The process created some tar.gz files, that I tried to target when I use pacman -U
But none of them is the file expected by this command,
'missing metadata package in' ....
I did a research on web. I found that the place that makepkg output the package for Pacman is set in makepkg.conf, using PKGDEST item.
I changed that in /etc/makepkg.conf. It didn't create any file in that place when I tried to make that AUR package again (makepkg -S -f).
How to find the package for Pacman? Did the build go wrong and have no obvious message?
--Well .. after hours of search.. i give up and installed yaourt.. using that this to insall my package
According to https://wiki.archlinux.org/index.php/Makepkg and my firsthand experience, they are put into the working directory by default:
Next, one can configure where source files and packages should be placed and identify themselves as the packager. This step is optional; packages will be created in the working directory where makepkg is run by default.

Yo unaware of installed generators

I just installed Yeoman and some generators. However, because the /usr/lib folder is protected, I chose to change the prefix of the location where NPM installs its packages.
Right now, everything is getting installed under ~/.node. I also changed my $PATH and added ~/.node/bin. However, when I execute yo <name of generator>, I get the following:
Error node
You don't seem to have a generator with the name node installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 0 registered generators run yo with the `--help` option.
As you can read here, it's telling me there are 0 registered generators, but I installed them correctly (and it completed without errors). I'm able to find the installed generators, for example ~/.node/lib/node_modules/generator-node exists and when I execute the following command:
npm list -g
I can find the generators that I installed (so I assume it isn't a problem with npm).
So I think Yeoman (or Yo to be more precisely) is unaware of the generators being installed in the custom folder, but I haven't found any way to configure this.
In addition to adding it to your path, you should also set a NODE_PATH environment variable. The yeoman/generator code will look there first:
// We tried using NPM to get the global modules path, but it haven't work out
// because of bugs in the parseable implementation of `ls` command and mostly
// performance issues. So, we go with our best bet for now.
if (process.env.NODE_PATH) {
_.compact(process.env.NODE_PATH.split(/[;:]/g)).forEach(this.appendPath, this);
return;
}
Looks like a NODE_PATH issue, try to execute the following command:
echo "export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules" >> ~/.bashrc && source ~/.bashrc^C
Or just type yo doctor to figure out what's happening