merbanan / rtl_433

Program to decode radio transmissions from devices on the ISM bands (and other frequencies)
GNU General Public License v2.0
6.04k stars 1.31k forks source link

Debian build fails (warnings and two breaking errors) #1235

Closed wsw70 closed 4 years ago

wsw70 commented 4 years ago

I tried to build rtl_433 in a docker image but the build issues warnings and breaks twice. I am not sure if I should open separate issues for each problem - please let me know and I will break this down into unrelated issues if needed.

The image is based on Debian (buster). The Dockerfile is

FROM debian
RUN apt update && apt install -y libtool libusb-1.0-0-dev librtlsdr-dev rtl-sdr build-essential autoconf cmake pkg-config git
RUN git clone --depth 1 https://github.com/merbanan/rtl_433.git
WORKDIR rtl_433
RUN autoreconf --install
RUN ./configure
RUN make && make install

The output issues warnings and finally breaks:

Step 1/7 : FROM debian
 ---> 67e34c1c9477
Step 2/7 : RUN apt update && apt install -y libtool libusb-1.0-0-dev librtlsdr-dev rtl-sdr build-essential autoconf cmake pkg-config git
 ---> Using cache
 ---> d34956aea2b3
Step 3/7 : RUN git clone --depth 1 https://github.com/merbanan/rtl_433.git
 ---> Using cache
 ---> 7c218fe78868
Step 4/7 : WORKDIR rtl_433
 ---> Using cache
 ---> 067ffc51a822
Step 5/7 : RUN autoreconf --install
 ---> Using cache
 ---> 148ef978c62a
Step 6/7 : RUN ./configure
 ---> Using cache
 ---> eebdcc4a3aee
Step 7/7 : RUN make && make install
 ---> Running in b419dac3da57
echo UNKNOWN > .version-t && mv .version-t .version
make  all-recursive
make[1]: Entering directory '/rtl_433'
Making all in include
make[2]: Entering directory '/rtl_433/include'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/rtl_433/include'
Making all in src
make[2]: Entering directory '/rtl_433/src'
  CC       abuf.o
  CC       am_analyze.o
  CC       baseband.o
  CC       bitbuffer.o
  CC       compat_paths.o
  CC       compat_time.o
  CC       confparse.o
  CC       data.o
  CC       decoder_util.o
  CC       fileformat.o
  CC       list.o
  CC       mongoose.o
mongoose.c: In function 'mg_send_ssi_file.part.42':
mongoose.c:9525:40: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
     snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name);
                                        ^
mongoose.c:9525:5: note: 'snprintf' output 2 or more bytes (assuming 4097) into a destination of size 4096
     snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       optparse.o
  CC       output_influx.o
  CC       output_mqtt.o
  CC       pulse_demod.o
  CC       pulse_detect.o
  CC       pulse_detect_fsk.o
  CC       r_api.o
  CC       r_util.o
  CC       rtl_433.o
  CC       samp_grab.o
  CC       sdr.o
sdr.c:25:10: fatal error: libusb.h: No such file or directory
 #include <libusb.h> /* libusb_error_name(), libusb_strerror() */
          ^~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:1139: sdr.o] Error 1
make[2]: Leaving directory '/rtl_433/src'
make[1]: *** [Makefile:497: all-recursive] Error 1
make[1]: Leaving directory '/rtl_433'
make: *** [Makefile:383: all] Error 2
Error response from daemon: The command '/bin/sh -c make && make install' returned a non-zero code: 2

It looks that the code is looking for libusb.h in the wrong place. After modifying the Dockerfile to add a link in the expected place, another issue arises (see also https://github.com/merbanan/rtl_433/issues/952):

The new Dockerfile with an ugly hack:

FROM debian
RUN apt update && apt install -y libtool libusb-1.0-0-dev librtlsdr-dev rtl-sdr build-essential autoconf cmake pkg-config git
RUN ln -s /usr/include/libusb-1.0/libusb.h /usr/include/libusb.h
RUN git clone --depth 1 https://github.com/merbanan/rtl_433.git
WORKDIR rtl_433
RUN autoreconf --install
RUN ./configure
RUN make && make install

The output from the build:

Step 1/8 : FROM debian
 ---> 67e34c1c9477
Step 2/8 : RUN apt update && apt install -y libtool libusb-1.0-0-dev librtlsdr-dev rtl-sdr build-essential autoconf cmake pkg-config git
 ---> Using cache
 ---> d34956aea2b3
Step 3/8 : RUN ln -s /usr/include/libusb-1.0/libusb.h /usr/include/libusb.h
 ---> Using cache
 ---> b88f7ccdb77e
Step 4/8 : RUN git clone --depth 1 https://github.com/merbanan/rtl_433.git
 ---> Using cache
 ---> c78504913721
Step 5/8 : WORKDIR rtl_433
 ---> Using cache
 ---> 34d33b7d75ac
Step 6/8 : RUN autoreconf --install
 ---> Using cache
 ---> d454adfacedb
Step 7/8 : RUN ./configure
 ---> Using cache
 ---> ed64989fa870
Step 8/8 : RUN make && make install
 ---> Running in ce87e3f65152
echo UNKNOWN > .version-t && mv .version-t .version
make  all-recursive
make[1]: Entering directory '/rtl_433'
Making all in include
make[2]: Entering directory '/rtl_433/include'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/rtl_433/include'
Making all in src
make[2]: Entering directory '/rtl_433/src'
  CC       abuf.o
  CC       am_analyze.o
  CC       baseband.o
  CC       bitbuffer.o
  CC       compat_paths.o
  CC       compat_time.o
  CC       confparse.o
  CC       data.o
  CC       decoder_util.o
  CC       fileformat.o
  CC       list.o
  CC       mongoose.o
mongoose.c: In function 'mg_send_ssi_file.part.42':
mongoose.c:9525:40: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
     snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name);
                                        ^
mongoose.c:9525:5: note: 'snprintf' output 2 or more bytes (assuming 4097) into a destination of size 4096
     snprintf(path, sizeof(path), "%s/%s", opts->document_root, file_name);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       optparse.o
  CC       output_influx.o
  CC       output_mqtt.o
  CC       pulse_demod.o
  CC       pulse_detect.o
  CC       pulse_detect_fsk.o
  CC       r_api.o
  CC       r_util.o
  CC       rtl_433.o
  CC       samp_grab.o
  CC       sdr.o
  CC       term_ctl.o
  CC       util.o
  CC       devices/acurite.o
  CC       devices/akhan_100F14.o
  CC       devices/alecto.o
  CC       devices/ambient_weather.o
  CC       devices/ambientweather_tx8300.o
  CC       devices/ambientweather_wh31e.o
  CC       devices/auriol_hg02832.o
  CC       devices/blyss.o
  CC       devices/brennenstuhl_rcs_2044.o
  CC       devices/bresser_3ch.o
  CC       devices/bresser_5in1.o
  CC       devices/bt_rain.o
  CC       devices/calibeur.o
  CC       devices/cardin.o
  CC       devices/chuango.o
  CC       devices/companion_wtr001.o
  CC       devices/current_cost.o
  CC       devices/danfoss.o
  CC       devices/digitech_xc0324.o
  CC       devices/directv.o
  CC       devices/dish_remote_6_3.o
  CC       devices/dsc.o
  CC       devices/ecowitt.o
  CC       devices/efergy_e2_classic.o
  CC       devices/efergy_optical.o
  CC       devices/elro_db286a.o
  CC       devices/elv.o
  CC       devices/emontx.o
  CC       devices/esa.o
  CC       devices/esic_emt7110.o
  CC       devices/esperanza_ews.o
  CC       devices/eurochron.o
  CC       devices/fineoffset.o
  CC       devices/fineoffset_wh1050.o
  CC       devices/fineoffset_wh1080.o
  CC       devices/flex.o
  CC       devices/fordremote.o
  CC       devices/fs20.o
  CC       devices/ft004b.o
  CC       devices/ge_coloreffects.o
  CC       devices/generic_motion.o
  CC       devices/generic_remote.o
  CC       devices/generic_temperature_sensor.o
  CC       devices/gt_tmbbq05.o
  CC       devices/gt_wt_02.o
  CC       devices/gt_wt_03.o
  CC       devices/hcs200.o
  CC       devices/hideki.o
  CC       devices/holman_ws5029.o
  CC       devices/hondaremote.o
  CC       devices/honeywell.o
  CC       devices/honeywell_wdb.o
  CC       devices/ht680.o
  CC       devices/ibis_beacon.o
  CC       devices/ikea_sparsnas.o
  CC       devices/infactory.o
  CC       devices/inovalley-kw9015b.o
  CC       devices/interlogix.o
  CC       devices/intertechno.o
  CC       devices/kedsum.o
  CC       devices/kerui.o
  CC       devices/lacrosse.o
  CC       devices/lacrosse_TX141TH_Bv2.o
  CC       devices/lacrosse_tx35.o
  CC       devices/lacrosse_ws7000.o
  CC       devices/lacrossews.o
  CC       devices/lightwave_rf.o
  CC       devices/m_bus.o
  CC       devices/maverick_et73.o
  CC       devices/maverick_et73x.o
  CC       devices/mebus.o
  CC       devices/new_template.o
  CC       devices/newkaku.o
  CC       devices/nexa.o
  CC       devices/nexus.o
  CC       devices/norgo.o
  CC       devices/oil_standard.o
  CC       devices/oil_watchman.o
  CC       devices/opus_xt300.o
  CC       devices/oregon_scientific.o
  CC       devices/oregon_scientific_sl109h.o
  CC       devices/oregon_scientific_v1.o
  CC       devices/philips_aj3650.o
  CC       devices/philips_aj7010.o
  CC       devices/prologue.o
  CC       devices/proove.o
  CC       devices/quhwa.o
  CC       devices/radiohead_ask.o
  CC       devices/rftech.o
  CC       devices/rubicson.o
  CC       devices/rubicson_48659.o
  CC       devices/s3318p.o
  CC       devices/schraeder.o
  CC       devices/silvercrest.o
  CC       devices/simplisafe.o
  CC       devices/smoke_gs558.o
  CC       devices/solight_te44.o
  CC       devices/springfield.o
  CC       devices/steelmate.o
  CC       devices/tfa_30_3196.o
  CC       devices/tfa_pool_thermometer.o
  CC       devices/tfa_twin_plus_30.3049.o
  CC       devices/thermopro_tp11.o
  CC       devices/thermopro_tp12.o
  CC       devices/tpms_citroen.o
  CC       devices/tpms_elantra2012.o
  CC       devices/tpms_ford.o
  CC       devices/tpms_jansite.o
  CC       devices/tpms_pmv107j.o
  CC       devices/tpms_renault.o
  CC       devices/tpms_toyota.o
  CC       devices/ts_ft002.o
  CC       devices/ttx201.o
  CC       devices/vaillant_vrt340f.o
  CC       devices/waveman.o
  CC       devices/wg_pb12v1.o
  CC       devices/wssensor.o
  CC       devices/wt0124.o
  CC       devices/wt450.o
  CC       devices/x10_rf.o
  CC       devices/x10_sec.o
  CCLD     rtl_433
libtool:   error: require no space between '-L' and '-lrtlsdr'
make[2]: *** [Makefile:976: rtl_433] Error 1
make[2]: Leaving directory '/rtl_433/src'
make[1]: *** [Makefile:497: all-recursive] Error 1
make[1]: Leaving directory '/rtl_433'
make: *** [Makefile:383: all] Error 2
Error response from daemon: The command '/bin/sh -c make && make install' returned a non-zero code: 2
zuckschwerdt commented 4 years ago

We recommend building with CMake. Autotools might be broken and we don't really support it. PR with fixes much welcome. What you are seeing might be a problem with pkg-config.

wsw70 commented 4 years ago

@zuckschwerdt Thank you Christian for the hint.

With CMake the build is seamless (it is even surprising that the warnings are gone). If there is interest I will make a PR with instructions for docker (and probably a Docker Hub version based on a nightly build)