pavels / spektrum

rtl-sdr spectrum analyzer
BSD 3-Clause "New" or "Revised" License
577 stars 91 forks source link

Unable to build librtlpower.so for arm/Raspberry Pi #38

Closed whackyhack closed 3 years ago

whackyhack commented 3 years ago

I am trying to build spektrum under PiAaware 4.0 (5.4.51-v7+ armv7l). But librtlpower won't build properly.

Source is your fork of rtl-sdr. Two separate problems arise while following https://osmocom.org/projects/rtl-sdr/wiki.

  1. The autoreconf method fails to compile librtlpower at all.
    make[2]: Entering directory '/home/pi/rtl-sdr/src'
    CCLD     rtl_power
    /usr/bin/ld: rtl_power.o: in function `scanner':
    /home/pi/rtl-sdr/src/rtl_power.c:245: undefined reference to `scan_tune'
    /usr/bin/ld: rtl_power.o: in function `init_misc':
    /home/pi/rtl-sdr/src/rtl_power.c:282: undefined reference to `rectangle'
    /usr/bin/ld: rtl_power.o: in function `main':
    /home/pi/rtl-sdr/src/rtl_power.c:340: undefined reference to `rectangle'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:340: undefined reference to `hamming'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:340: undefined reference to `blackman'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:340: undefined reference to `blackman_harris'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:340: undefined reference to `hann_poisson'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:340: undefined reference to `youssef'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:340: undefined reference to `kaiser'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:340: undefined reference to `bartlett'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:410: undefined reference to `frequency_range'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:491: undefined reference to `generate_sine_tables'
    /usr/bin/ld: /home/pi/rtl-sdr/src/rtl_power.c:319: undefined reference to `frequency_range'
    collect2: error: ld returned 1 exit status
  2. The cmake method completes build without error. But after make install, only librtlsdr.so is installed into /usr/local/lib/. Even though a file librtlpower.so is produced in build/src/ directory, processing ends in segmentation fault if that file is substituted as shared library. Apparently build/src/ librtlpower.so is a PIE executable.
    pi@piaware:~/rtl-sdr $ file build/src/librtlpower.so.0.5git 
    build/src/librtlpower.so.0.5git: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=20a4989056d206fe71c990d2de5208d604a0bc42, not stripped
pavels commented 3 years ago

Let's track everything pi related in one place - i think there will be more problems on the way to get this running on pi

https://github.com/pavels/spektrum/issues/39