rtlsdrblog / rtl-sdr-blog

Modified Osmocom drivers with enhancements for RTL-SDR Blog V3 and V4 units.
https://www.rtl-sdr.com
GNU General Public License v2.0
297 stars 45 forks source link

"undefined reference to" errors when compiling on Cygwin #29

Open lwvmobile opened 1 year ago

lwvmobile commented 1 year ago

I get this error while compiling on Cygwin.

SDR@SDR-WIN7-32-VM ~/rtl-sdr-blog/build
$ cmake ..
-- The C compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Build type not specified: defaulting to release.
-- Extracting version information from git describe...
-- 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
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.9.3")
-- Checking for module 'libusb-1.0'
--   Found libusb-1.0, version 1.0.21
-- Udev rules not being installed, install them with -DINSTALL_UDEV_RULES=ON
-- Building with kernel driver detaching disabled, use -DDETACH_KERNEL_DRIVER=ON to enable
-- Building with usbfs zero-copy support disabled, use -DENABLE_ZEROCOPY=ON to enable
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Building for version: 0.6.0-105-g6299 / 0.6git
-- Using install prefix: /usr/local
-- Configuring done
-- Generating done
-- Build files have been written to: /home/SDR/rtl-sdr-blog/build

SDR@SDR-WIN7-32-VM ~/rtl-sdr-blog/build
$ make
[  3%] Building C object src/CMakeFiles/rtlsdr.dir/librtlsdr.c.o
[  6%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_e4k.c.o
[  9%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_fc0012.c.o
[ 12%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_fc0013.c.o
[ 15%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_fc2580.c.o
[ 18%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_r82xx.c.o
[ 21%] Linking C shared library cygrtlsdr-0.dll
[ 21%] Built target rtlsdr
[ 25%] Building C object src/CMakeFiles/rtlsdr_static.dir/librtlsdr.c.o
[ 28%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_e4k.c.o
[ 31%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc0012.c.o
[ 34%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc0013.c.o
[ 37%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_fc2580.c.o
[ 40%] Building C object src/CMakeFiles/rtlsdr_static.dir/tuner_r82xx.c.o
[ 43%] Linking C static library librtlsdr.a
[ 43%] Built target rtlsdr_static
[ 46%] Building C object src/CMakeFiles/convenience_static.dir/convenience.c.o
[ 50%] Linking C static library libconvenience_static.a
[ 50%] Built target convenience_static
[ 53%] Building C object src/CMakeFiles/rtl_sdr.dir/rtl_sdr.c.o
[ 56%] Linking C executable rtl_sdr.exe
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x18b): undefined reference to `rtlsdr_set_tuner_gain_mode'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x1a1): undefined reference to `rtlsdr_get_tuner_gains'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x1c4): undefined reference to `rtlsdr_get_tuner_gains'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x265): undefined reference to `rtlsdr_set_center_freq'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x2e5): undefined reference to `rtlsdr_set_sample_rate'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x365): undefined reference to `rtlsdr_set_direct_sampling'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x464): undefined reference to `rtlsdr_set_offset_tuning'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x4e4): undefined reference to `rtlsdr_set_tuner_gain_mode'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x565): undefined reference to `rtlsdr_set_tuner_gain_mode'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x57d): undefined reference to `rtlsdr_set_tuner_gain'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x654): undefined reference to `rtlsdr_set_freq_correction'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x6cc): undefined reference to `rtlsdr_reset_buffer'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x71b): undefined reference to `rtlsdr_get_device_count'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x780): undefined reference to `rtlsdr_get_device_usb_strings'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x80d): undefined reference to `rtlsdr_get_device_usb_strings'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x84a): undefined reference to `rtlsdr_get_device_name'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x95e): undefined reference to `rtlsdr_get_device_usb_strings'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0x98f): undefined reference to `rtlsdr_get_device_name'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0xa12): undefined reference to `rtlsdr_get_device_usb_strings'
/usr/lib/gcc/i686-pc-cygwin/11/../../../../i686-pc-cygwin/bin/ld: libconvenience_static.a(convenience.c.o):convenience.c:(.text+0xa58): undefined reference to `rtlsdr_get_device_name'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/rtl_sdr.dir/build.make:99: src/rtl_sdr.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:224: src/CMakeFiles/rtl_sdr.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I commented out lines 89-159 in the CMakeLists.txt file because I only needed the librtlsdr.h, .so, .a and dll file.

Any ideas on how to get the rest of it to compile?

rtlsdrblog commented 1 year ago

Probably the same dependency conflict issue as here https://github.com/rtlsdrblog/rtl-sdr-blog/issues/25. Can you try the fix I mentioned there?