Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem building / installing gr-radio_astro on Mac #42

Open
johncneal opened this issue Dec 4, 2021 · 29 comments
Open

Problem building / installing gr-radio_astro on Mac #42

johncneal opened this issue Dec 4, 2021 · 29 comments

Comments

@johncneal
Copy link

Problem building / installing gr-radio_astro on Mac

I managed to instal GNURadio 3.8 and SDR support on a MacBook Pro (OSX 10.15.7) and GR-Companion runs ok with a couple of test .GRC files.

I’ve also installed the nsfSDR image for Raspberry Pi on a new Raspi 4B and that all seems to be working ok. However, mindful of the statements that ‘analysis’ is better done on a separate computer, I wanted to install the gr-radio_astro components on the Macbook Pro.

I followed the instructions for Installing gr-radio_astro for GNUradio 3.8 on Github (https://github.com/WVURAIL/gr-radio_astro/wiki/Installing-gr-radio_astro ) - though, on the basis that GNURadio was already installed and working, I omitted the step -
sudo apt install gnuradio gr-osmosdr airspy python3-h5py python3-ephem

I unzipped the v2020.08-gr38 file and created the build folder. Unfortunately the ‘cmake ..’ step threw the below warnings and errors.

Do you have any suggestions how I might resolve this?

John Neal

(base) Johns-MacBook-Pro-2:gr-radio_astro-2020.08-gr38 johnneal$ cd build
(base) Johns-MacBook-Pro-2:build johnneal$ cmake ..
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- The C compiler identification is AppleClang 11.0.0.11000033
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Build type not specified: defaulting to release.
-- Found LOG4CPP: /opt/local/lib/liblog4cpp.dylib
CMake Warning (dev) at /opt/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to find_package_handle_standard_args (PkgConfig)
does not match the name of the calling package (GMP). This can lead to
problems in calling code that expects find_package result variables
(e.g., _FOUND) to follow a certain pattern.
Call Stack (most recent call first):
/opt/local/share/cmake-3.21/Modules/FindPkgConfig.cmake:70 (find_package_handle_standard_args)
/opt/local/share/cmake/gnuradio/FindGMP.cmake:2 (include)
/opt/local/share/cmake/gnuradio/FindMPLIB.cmake:1 (find_package)
/opt/local/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
/opt/local/share/cmake/gnuradio/GnuradioConfig.cmake:26 (find_dependency)
CMakeLists.txt:88 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2")
-- Checking for module 'gmp'
-- Found gmp, version 6.2.1
-- Found GMP: /opt/local/lib/libgmpxx.dylib
-- Using GMP.
-- Found MPLIB: /opt/local/lib/libgmpxx.dylib
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at /opt/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR date_time program_options
filesystem system regex thread unit_test_framework) (Required is at least
version "1.71.0")
Call Stack (most recent call first):
/opt/local/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/opt/local/share/cmake-3.21/Modules/FindBoost.cmake:2360 (find_package_handle_standard_args)
/opt/local/share/cmake-3.21/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
/opt/local/share/cmake/gnuradio/GnuradioConfig.cmake:45 (find_dependency)
CMakeLists.txt:88 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/johnneal/gr-radio_astro/gr-radio_astro-2020.08-gr38/build/CMakeFiles/CMakeOutput.log".
(

@fventuri
Copy link
Collaborator

fventuri commented Dec 4, 2021

@johncneal - that error message seems to indicate that the boost libraries are not installed (or perhaps not installed where cmake expects them) on your MacBook Pro.

I would try to use the same package manager you used to install GNU Radio to also install (or reinstall) the boost (or libboost) package to see if it helps (see also this section in the GNU Radio documentation: https://wiki.gnuradio.org/index.php/MacInstall#Background_Dependencies).

Franco

@johncneal
Copy link
Author

@fventuri
Thanks for the above - installing the boost package using MacPorts allowed the 'make ..' step to succeed.
However, the next step ('sudo make') threw the following error -

(base) Johns-MacBook-Pro-2:build johnneal$ sudo make
Password:
[ 6%] Building CXX object lib/CMakeFiles/gnuradio-radio_astro.dir/dedispersion_impl.cc.o
[ 12%] Building CXX object lib/CMakeFiles/gnuradio-radio_astro.dir/detect_impl.cc.o
[ 18%] Building CXX object lib/CMakeFiles/gnuradio-radio_astro.dir/vmedian_impl.cc.o
[ 25%] Linking CXX shared library libgnuradio-radio_astro.dylib
Undefined symbols for architecture x86_64:
"gr::radio_astro::detect_impl::update_buffer()", referenced from:
gr::radio_astro::detect_impl::event(std::__1::complex const
, std::__1::complex
) in detect_impl.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libgnuradio-radio_astro.v1.0-compat-xxx-xunknown.dylib] Error 1
make[1]: *** [lib/CMakeFiles/gnuradio-radio_astro.dir/all] Error 2
make: *** [all] Error 2
**

john

@PranavSanghavi
Copy link
Member

PranavSanghavi commented Dec 4, 2021 via email

@johncneal
Copy link
Author

Hi Pranav - thanks for getting back.
I'm not a frequent user of GIT so forgive the newbie question:
I don't believe I have a local git repository and 'git pull' appears (according to GIT) to simply merge changes to an existing repository. SO does it matter which folder I'm in on the Mac to do that 'git pull' ?? Should I do it from the folder containing the code I previously unzipped?? or will it create a folder for the source and download ALL required code prior to running the build?
Forgive my lack of GIT familiarity
john

@PranavSanghavi
Copy link
Member

PranavSanghavi commented Dec 5, 2021 via email

@johncneal
Copy link
Author

That doesn't seem to work - in Terminal I navigate to the gr-radio_astro folder where I unzipped the previous v2020.08-gr38 tagged version. But when I use 'git pull' it says fatal: not a git repository

(base) Johns-MacBook-Pro-2:gr-radio_astro johnneal$ git pull
fatal: not a git repository (or any of the parent directories): .git

@fventuri
Copy link
Collaborator

fventuri commented Dec 5, 2021

@johncneal - at this point I would try a clean build directly from the source code in the repo (it won't take very long).

These are the commands to do that (see here: https://github.com/WVURAIL/gr-radio_astro#installing-from-source):

mv gr-radio_astro gr-radio_astro.old
git clone https://github.com/WVURAIL/gr-radio_astro.git
cd gr-radio_astro
mkdir build
cd build
cmake ..
make
sudo make install  (only if the previous command is successful)

This way you should have all the latest fixes and enhancements.

Franco

@johncneal
Copy link
Author

johncneal commented Dec 5, 2021

Hi @fventuri and @PranavSanghavi
Thanks to both for ongoing help with this - much appreciated. But while, the complete rebuild on the Mac seemed to run ok in terms of build and install . . .
when I go into GR there is no 'radio_astro' category in the block list in the right hand panel of GR (which for comparison does appear in the nice gr-radio-astro Raspberry Pi image I installed). On the Mac, if I open one of the .GRC files (eg NsfIntegrate24.grc) from the gr-radio_astro/examples/nsf folder, it loads but GR shows several 'missing blocks' (see the screenshot below) - these include ra_ascii_sink, median, ra_integrate.

I assume this means either something hasn't worked correctly (I have the build output if that helps, though no errors were reported during the build) OR there are further setup steps to be completed ??

image

@PranavSanghavi
Copy link
Member

PranavSanghavi commented Dec 5, 2021 via email

@johncneal
Copy link
Author

johncneal commented Dec 5, 2021

@PranavSanghavi
GNU Radio Companion claims to be version 3.8.4.0 (Python 3.7.12)

On the Mac I appear to be on Python 3.7 - and there is NO directory usr/local/lib/python3.8/dist-packages

Instead there is a directory /usr/local/lib/python3.7/site-packages/radio_astro BUT I note this is site-packages rather than dist-packages. SO does this matter - should I adapt your above comments / instructions to reflect these 3.7 directories???

@PranavSanghavi
Copy link
Member

PranavSanghavi commented Dec 5, 2021 via email

@johncneal
Copy link
Author

Not sure if I'd restarted the Terminal session or not but since then I've rebooted the Mac and nothing has changed. gr-radio_astro components still not showing in the GR block selection panel and missing blocks showing when I open one of the NFS .GRC files. :-(

@fventuri
Copy link
Collaborator

fventuri commented Dec 5, 2021

@johncneal - the blocks for the GRC block selection should all be in a directory called something like /usr/local/share/gnuradio/grc/blocks; if you don't find that directory, please run this command to search for it:

find /usr -name blocks

Once you find that blocks directory, look at its contents; you should see files called radio_astro_ra_vmedian.block.yml and similar; the command ls | grep radio_astro might help you.

If you don't find those files, please run the last step from the gr-radio_astro install again (from the same build directory where you ran it for the first time), like this:

sudo make install

paying attention to where it copies the blocks files to; for instance you could run something like this:

sudo make install | grep blocks

The output should be able to give us some idea of what might be going on there.

Franco

@johncneal
Copy link
Author

@fventuri
@PranavSanghavi

Ok I can see the directory /usr/local/share/gnuradio/grc/blocks and it does contain the radio_astro_....block.yml files.

I spent some time trying to fing a .bashrc but couldn't. A little research on the web revealed the fact that MacOS doesnt use the .bashrc file and instead uses the .bash_profile file for modifying the PATH variable. Given I can find no trace of a .bashrc file on my Mac, but do have a .bash_profile file, this would appear to be correct??

Should I simply try adding additional path info to the bash_profile along the lines of your earlier suggestion. However, this would need to be amended given the Mac appears to have a /usr/local/lib/python3/site-packages directory and not a /usr/local/lib/python3/dist-packages directory.

Does this make sense?

John

@PranavSanghavi
Copy link
Member

PranavSanghavi commented Dec 6, 2021 via email

@johncneal
Copy link
Author

@PranavSanghavi
Ok - its getting late here in the UK so I'll probably leave this until tomorrow.
Leave the issue open for now and I'll post again with the outcome. More than happy to help get things right.
john

@fventuri
Copy link
Collaborator

fventuri commented Dec 6, 2021

@johncneal - when you have a few minutes, could you run this command on your MacBook Pro:

python3 -c 'import radio_astro'

if it returns and error, please run this command:

python3 -c 'import sys; print(sys.path)'

and make sure that one of the directories listed in the command above contains a directory called radio_astro.

If none of them does, please run the usual sudo make install (in the usual build directory) again, like this:

sudo make install | grep python

to see where that radio_astro directory is created.

Franco

@kbandura
Copy link
Contributor

kbandura commented Dec 6, 2021

It looks like all your troubles are due to some of the mac install fixes not making it to the main branch yet. If you use the gr38 branch (with new git skills) or this link https://github.com/WVURAIL/gr-radio_astro/archive/refs/heads/gr38.zip
the make/make install process should work and it will (hopefully) put thinks where a mac with macports will need them.

@johncneal
Copy link
Author

@fventuri and @kbandura

Ok - @fventuri first -
python3 -c 'import radio_astro' DID return an error - ModuleNotFoundError: No module named 'radio_astro'
python3 -c 'import sys; print(sys.path)' returned the following - ['', '/Users/johnneal/anaconda3/lib/python37.zip', '/Users/johnneal/anaconda3/lib/python3.7', '/Users/johnneal/anaconda3/lib/python3.7/lib-dynload', '/Users/johnneal/anaconda3/lib/python3.7/site-packages', '/Users/johnneal/anaconda3/lib/python3.7/site-packages/aeosa']

Ie NO reference to a folder named 'radio_astro' HOWEVER as previously mentioned there IS a folder of that name at /usr/local/lib/python3.7/site-packages/radio_astro which contains a lot of Radio-Astro related .py, .pyo, .pyc files. This was presumably created by the earlier build process?? So what now ? Do I go ahead and re-run the sudo make install ? Is it likely to do anything different to what it did last time ??

Alternatively should I have another try at the gr38 version as per @kbandura suggestion??

@fventuri
Copy link
Collaborator

fventuri commented Dec 6, 2021

@johncneal - I would definitely try @kbandura suggestion first; hopefully it will solve your problem.

Also the output from the print(sys.path) command makes me think perhaps you have multiple versions of Python3 installed there.
If the gr38 branch doesn't work, please run these two commands:

/usr/bin/python3 -c 'import radio_astro'

and

/usr/bin/python3 -c 'import sys; print(sys.path)'

Thanks,
Franco

@johncneal
Copy link
Author

@kbandura and @fventuri
Ok - I'll re-extract the GR38.zip file again into a gr-radio_astro folder in my home directory. I assume the instructions at https://github.com/WVURAIL/gr-radio_astro/wiki/Installing-gr-radio_astro#installing-gr-radio_astro-for-gnuradio-38 are the ones I should follow.(we obviously fixed the earlier make problem by installing BOOST) I will however, again skip the GR install step since that is already installed and appears to be working.

@johncneal
Copy link
Author

@kbandura - given I'm on a Mac I assume I should modify the instructions to put path info into the bash_profile file given the Mac doesn't have a .bashrc file ????

@kbandura
Copy link
Contributor

kbandura commented Dec 6, 2021

Shouldn't need any additional bash/path additions on mac once use the right version.

@johncneal
Copy link
Author

@kbandura , @fventuri , @PranavSanghavi
Ok, looks like I may have a working gr-radio_astro setup !!!

Since I don't yet have an actual SDR device (shame on me - but that will be addressed very soon) this is based only on the ability to load several of the Example GRC files. There were no missing blocks (except the Lime SDR block but I hadn't explicitly installed that so no surprise. I had loaded the RTL-SDR block and this looks fine when I load the NSF Integrate24 GRC file. I obviously haven't been able to run that yet since I haven't yet got a device. However, the three Example vector demo GRC files load and run happily.

This install was finally based on the @kbandura suggestion of repeating the build using the GR38.zip file. I did add a suitable line pointing to my python37/site-packages directory in my .bash_profile file but will try this with that commented out later.

I did have a slight issue initially since I'd already got GNU Radio installed and I'd missed the need to install the h5py and ephem modules. Not having 'apt' on the Mac I installed these using the MacPorts versions of them - that seems to work but for Mac users that isn't obvious from the Git instructions. It would generally help if the instructions were clearer about how to install gr-radio_astro where the GR core is already installed which i likely to be the case for a proportion of users.

The GR38 zip install instructions also tell you to do a 'sudo ldconfig' - ldconfig is not present on the Mac and doesn't seem to be required anyway.

Thanks for your support and help with sorting this out and shout if there is any further info you want. I guess I'm now at the start of a long road of how to to make productive use of this excellent facility. I'll be building an initial H1 Line antenna in the New Year and hopefully doing some low res galactic mapping - following in the footsteps of DSPIRA and others before venturing into related areas.

john

@glangsto
Copy link
Collaborator

glangsto commented Dec 6, 2021 via email

@johncneal
Copy link
Author

Hi Glen
Yes - I did run the vector demo's and they run fine. I'd previously installed the ephem module so no problems.
Looking forward to using these tools in earnest. Time to start the learning curve in radio dsp - hopefully a challenging but rewarding extension to my astronomy interests. I'll be hitting the various tutorials and other online resources available.

Out of interest I see you have a separate Analyze repo. Am I right in thinking these are a separate set of facilities but designed to support analysis of data captured using the gr-radio_astro tools? If they are separate, I'll take a look at getting these onto the Mac as well, since I've built out a Raspberry Pi for acquisition and I'll move the data onto the Mac for analysis.

John

@PranavSanghavi
Copy link
Member

PranavSanghavi commented Dec 6, 2021 via email

@glangsto
Copy link
Collaborator

glangsto commented Dec 6, 2021 via email

@johncneal
Copy link
Author

@PranavSanghavi
By way of background -

  • I'm in Essex, UK. Biomedical scientist - drifted into biomedical software development in the 1980's - recently retired.
  • Coded in many languages - specialist in interoperability solutions (messaging and REST API's etc) for 16 yrs.
  • Amateur astronomer since completing one year University distance learning course in Astronomy in 2014.
  • Developed an interest in stellar evolution - most of my practical observing has been low res visual spectroscopy.
  • Recently retired and most of my coding is now in Apple Swift and Python (use AstroPy, Matplotlib etc) .
  • My interest in stellar evolution has inevitably led me to widen my astronomical interest into areas of the EM spectrum beyond the visible. So now getting interested in what is possible to amateurs in the radio bands.

So initially this is likely to be a personal project but I do have a couple of colleagues at my local astronomical society who also are interested so I suspect others may get involved as it progresses.

I discovered the DSPIRA site a few weeks ago when I started to explore amateur radio astronomy. The Light Work memo's showed up in my browsing a few days ago and I've started reading through them. There does seem to be a lot of enthusiastic work going on and I shall certainly be exploring it. The plan is to start building a simple Hydrogen line antenna shortly. Not sure yet which design I'll go for yet - 2.4 GHz grid antenna or diy horn option. The 2.4GHz grid antennas seem to be completely unavailable in the UK at present. So could try getting hold of an old 80 - 100 cm satellite dish and make a tin can LNB.

Initial goal would be to achieve some basic galactic scale mapping - albeit at low resolution. While this would simply be repeating work others have done its seems like a good place to start in terms of getting basic hardware and software in place and learning about the simpler end of radio astronomy data acquisition and analysis.

As far as contributing to the Light Work memo's is concerned, I'll endeavour to document the issues I encountered and see if I can pull together a set of instructions with respect to gr-radio_astro installs on MacOS. I'm a little nervous about trying to improve the core GNU-Radio installation process which seems a bit more straightforward since it doesn't involve build stages - just Installation. Its also the case that the Mac world seems likely to be a little unpredictable in the immediate future with Apple migrating their products away from Intel processors to Apple Silicon (the M1 chip etc) - not clear if or how that may impact the Python world and GNU-Radio in particular. Add to that the fact that many scientific Mac users have Python virtual envs courtesy of Anaconda etc - might add further unpredictability around gr-radio_astro installs. Such users are potentially also going to want Glen Langstons 'analyse' repo as well. Thats next on my list - the only point of capturing data is if your going to do something with it !!

Seems to me like a pretty dynamic space !!! Lets see how it goes.

John

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants