daniestevez / gr-satellites

GNU Radio decoder for Amateur satellites
GNU General Public License v3.0
769 stars 160 forks source link

Error building maint-3.8 from source #294

Closed g4dpz closed 1 year ago

g4dpz commented 3 years ago

GNURadio 3.8 built successfully from source.

Trying to build gr-satellites:

[ 57%] Built target satellites_swig_swig_compilation Scanning dependencies of target satellites_swig [ 58%] Building CXX object swig/CMakeFiles/satellites_swig.dir/CMakeFiles/satellites_swig.dir/satellites_swigPYTHON_wrap.cxx.o /home/g4dpz/dev/gr-satellites/build/swig/CMakeFiles/satellites_swig.dir/satellites_swigPYTHON_wrap.cxx: In function ‘PyTypeObject* SwigPyObject_TypeOnce()’: /home/g4dpz/dev/gr-satellites/build/swig/CMakeFiles/satellites_swig.dir/satellites_swigPYTHON_wrap.cxx:1770:5: warning: missing initializer for member ‘_typeobject::tp_vectorcall’ [-Wmissing-field-initializers] 1770 | };

daniestevez commented 3 years ago

Hi Dave,

Thanks for the bug report. This bugs with swig are often not so easy to solve. I can say that it builds correctly on several of my my systems, so there must be something different about your system. Some questions that perhaps might help: What distribution are you using? Do you have a clean build/ folder when trying this? Can you attach the full build log (including cmake) in case there is a subtle non-fatal error before?

juliaschatz commented 3 years ago

I'm having an issue that might be related, trying to build release v3.10.0 (and maint-3.8) using either repository provided SWIG 4.0.1 or 4.0.2 from source. Ubuntu 20.04 x86_64, gnuradio/-dev from repositories at version 3.8.1.0~rc1-2build2. Cmake log and make logs are attached. Would appreciate any guidance you can give on this issue. cmake.log make.log

daniestevez commented 3 years ago

Hi Julia,

Your problem looks definitely very similar to Dave's. I don't know what distribution Dave was using. Perhaps there is something wrong with SWIG on Ubuntu 20.04. I might try replicating this in a Docker container perhaps, but these problems with SWIG are very difficult to debug.

I have an Ubuntu PPA for gr-satellites and v3.10 is building correctly against Ubuntu 21.04. The previous versions were building fine against Ubuntu 20.10 (but that release of Ubuntu is now unmaintained). It would be interesting to have packages for Ubuntu 20.04 because it's the current LTS, but unfortunately the version of python-construct that it ships is too old (if you're trying to install gr-satellites on your own this is not a problem, though, because you can install construct with pip). I think I've never tested building gr-satellites for Ubuntu 20.04.

Some workarounds I see here are upgrading to Ubuntu 21.04, and perhaps using the package from the PPA, which is more convenient (but building from source should work) or installing GNU Radio 3.9 on Ubuntu 20.04 (it's possible to build it from source or to install it from a PPA) and then install gr-satellites v4.3 by building from source. Fortunately GNU Radio 3.9 uses pybind11 instead of SWIG. Another alternative is using conda to install both GNU Radio and gr-satellites.

daniestevez commented 3 years ago

I confirm that this Dockerfile reproduces the compile errors that SWIG is giving:

# syntax=docker/dockerfile:1
FROM ubuntu:20.04
RUN apt-get update \
    &&  DEBIAN_FRONTEND="noninteractive" apt-get -y upgrade \
    && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
           gnuradio build-essential cmake git swig liborc-0.4-dev \
    && git clone https://github.com/daniestevez/gr-satellites \
    && cd gr-satellites \
    && git checkout v3.10.0 \
    && mkdir build \
    && cd build \
    && cmake .. \
    && make -j$(nproc) \
    && make test \
    && make install

The same happens with the ubuntu:20.10, but with ubuntu:21.04 it builds correctly. The make test fails with ubuntu:21.04, but that is probably another problem.

I'm a bit puzzled, since the previous releases (such as gr-satellites v3.9) that I did for the Ubuntu 20.10 PPA built fine when uploading the Debian source package to the Launchpad.

daniestevez commented 3 years ago

I have sorted out the problem with make test under ubuntu:21.04. I had forgotten to install construct with pip3.

daniestevez commented 3 years ago

The Dockerfile that does work (in case someone finds it useful) is

# syntax=docker/dockerfile:1
FROM ubuntu:21.04
RUN apt-get update \
    &&  DEBIAN_FRONTEND="noninteractive" apt-get -y upgrade \
    && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
           gnuradio build-essential cmake git swig liborc-0.4-dev \
       python3-pip \
    && pip3 install construct \
    && git clone https://github.com/daniestevez/gr-satellites \
    && cd gr-satellites \
    && git checkout v3.10.0 \
    && mkdir build \
    && cd build \
    && cmake .. \
    && make -j$(nproc) \
    && make test \
    && make install
juliaschatz commented 3 years ago

I tried installing gr-satellites 4.3 with gnuradio 3.9 but kept getting segfaults. Unsure if they're related to satellites or not as it's pretty impossible to debug. Additionally installing gnuradio 3.8 and satellites 3.9 using conda seems to work fine, but apparently I can't use my hackrf in this configuration. Not sure where I'll go from here, maybe just narrowing down where the segfaults are coming from.

Appreciate the help.

daniestevez commented 3 years ago

The segfaults are rather weird. Perhaps you could try to use GDB to see where these happen. Here are some indications.

Also, how did you install GNU Radio 3.9 and gr-satellites 3.4?

Regarding conda, have you installed gnuradio-osmosdr as well? If not, then that would explain why you can't use the HackRF. If you do have gnuradio-osmosdr, what's the problem you find?

juliaschatz commented 3 years ago

I eventually figured it out- gnuradio 3.9 and satellites 4.3 (both from source) was actually working fine except for a file sink which had a path in it that the user didn't have permissions for. For some reason this was causing a segfault. After fixing this (and swapping out the osmosdr block for the soapysdr hackrf source because I broke osmosdr somehow) I got an FFT to show up at least. Regarding conda I think this was a problem with the conda gnuradio-osmosdr not being compiled with hackrf enabled as this seemed to be a common problem, but I didn't look into it that much. So I'm in a working state now at least. Again I really appreciate you responding so quickly!

daniestevez commented 3 years ago

Glad you got this working!

Very weird thing regarding the file sink. That's definitely a bug (it should give a fatal error but not segfault), so if you can reproduce that with a simple flowgraph it might be good to open an issue in the GNU Radio repo.

daniestevez commented 1 year ago

I'm closing this issue, since it has been inactive for long, I think g4dpz has now successfully built a more recent version of gr-satellites and juliaschatz's problem was solved. People finding similar installation problems can open a new issue.