Gr-smart meters Setup on other distros

From RECESSIM, A Reverse Engineering Community
Revision as of 19:31, 8 February 2024 by L0scher (talk | contribs) (→‎Arch: added detail about the proper use of sudo if required.)
Jump to navigation Jump to search

The Gr-smart meters Setup Guide describes how to build the gr-smart meters setup on Ubuntu. This page documents how to do so on other Linux distributions. Note that the patches applied (pull_23 for gr-pdu_utils and pull_9 for gr-timing_utils) apply pull requests that have not yet been accepted into the respective Sandia Labs repositories. If and when they are ever merged into the main line code, these patches will no longer be necessary. Also note that with these patches applied, it is no longer necessary to build or use the gr-sandia_utils code.

Arch

This is a container file (for use with Docker or Podman) that shows how to build the relevant modules under Arch Linux.

FROM archlinux:base-20240101.0.204074
RUN mkdir -p /tmp/work
WORKDIR /tmp/work
RUN pacman --noconfirm -Sy git make cmake gcc gnuradio boost doxygen graphviz pybind11
RUN git clone https://github.com/sandialabs/gr-pdu_utils.git
RUN git clone https://github.com/sandialabs/gr-timing_utils.git
RUN git clone https://github.com/sandialabs/gr-fhss_utils.git
RUN for fn in * ; do pushd $fn && git checkout maint-3.10 && popd ; done
WORKDIR /tmp/work/gr-pdu_utils
RUN git fetch origin refs/pull/23/head:pull_23
RUN git checkout pull_23
RUN cmake -B build && cmake --build build -t install
WORKDIR /tmp/work/gr-timing_utils
RUN git fetch origin refs/pull/9/head:pull_9
RUN git checkout pull_9
RUN cmake -B build && cmake --build build -t install
WORKDIR /tmp/work/gr-fhss_utils
RUN cmake -B build && cmake --build build -t install

To run these commands on a real distribution (that is, not in a container), you can simply execute each "RUN" command exactly as it appears and then substitute `cd` commands for the "WORKDIR" lines (or use pushd/popd pairs as shown in the example below). You can ignore the "FROM" line. You will want to adjust the directories for your own computer. So for example, one could use the following commands:

mkdir FHSS_Utils
cd FHSS_Utils
pacman --noconfirm -Sy git make cmake gcc gnuradio boost doxygen graphviz pybind11
git clone https://github.com/sandialabs/gr-pdu_utils.git
git clone https://github.com/sandialabs/gr-timing_utils.git
git clone https://github.com/sandialabs/gr-fhss_utils.git
for fn in * ; do pushd $fn && git checkout maint-3.10 && popd ; done
pushd gr-pdu_utils
git fetch origin refs/pull/23/head:pull_23
git checkout pull_23
cmake -B build && cmake --build build -t install
popd
pushd gr-timing_utils
git fetch origin refs/pull/9/head:pull_9
git checkout pull_9
cmake -B build && cmake --build build -t install
popd
pushd gr-fhss_utils
RUN cmake -B build && cmake --build build -t install
popd

Note too, that you may need to use sudo to install. If that's the case, you can replace this:

cmake -B build && cmake --build build -t install

with this:

cmake -B build 
cmake --build build
sudo cmake --build build -t install

It's recommended to build an ordinary user and only use sudo for installing, as shown above. To speed up compiling on multicore machines, you can append -j to build commands as in cmake --build build -j.