cant build. SoapySdr not found. Please help
dave-88 opened this issue · 9 comments
Hi please help me have this error message after compiled the code
I put code into pastebin
For any successfully help im willing to donate to you
pastebin.com/iVQZZdaH
Thanks for help!!!
make
cc -std=gnu11 -O3 -Wall -Wextra -march=native -lliquid -lm -lSoapySDR fm_tune.c -o fm_tune
/tmp/ccOYxC5X.o: In function enumerate': fm_tune.c:(.text+0xc2): undefined reference to
SoapySDRDevice_enumerate'
fm_tune.c:(.text+0x15a): undefined reference to SoapySDRKwargsList_clear' fm_tune.c:(.text+0x184): undefined reference to
SoapySDRKwargs_toString'
/tmp/ccOYxC5X.o: In function create_lowpass': fm_tune.c:(.text+0x1c8): undefined reference to
estimate_req_filter_len'
fm_tune.c:(.text+0x1e1): undefined reference to firfilt_crcf_create_kaiser' fm_tune.c:(.text+0x1f6): undefined reference to
firfilt_crcf_set_scale'
/tmp/ccOYxC5X.o: In function create_pilot_bandpass': fm_tune.c:(.text+0x2d7): undefined reference to
firdespm_run'
fm_tune.c:(.text+0x2e4): undefined reference to firfilt_rrrf_create' /tmp/ccOYxC5X.o: In function
run':
fm_tune.c:(.text+0x3b0): undefined reference to freqdem_create' fm_tune.c:(.text+0x3e8): undefined reference to
estimate_req_filter_len'
fm_tune.c:(.text+0x403): undefined reference to firfilt_crcf_create_kaiser' fm_tune.c:(.text+0x41a): undefined reference to
firfilt_crcf_set_scale'
fm_tune.c:(.text+0x504): undefined reference to firdespm_run' fm_tune.c:(.text+0x511): undefined reference to
firfilt_rrrf_create'
fm_tune.c:(.text+0x525): undefined reference to nco_crcf_create' fm_tune.c:(.text+0x540): undefined reference to
nco_crcf_set_frequency'
fm_tune.c:(.text+0x5bf): undefined reference to SoapySDRDevice_readStream' fm_tune.c:(.text+0x619): undefined reference to
nco_crcf_mix_up'
fm_tune.c:(.text+0x621): undefined reference to nco_crcf_step' fm_tune.c:(.text+0x62e): undefined reference to
firfilt_crcf_push'
fm_tune.c:(.text+0x639): undefined reference to firfilt_crcf_execute' fm_tune.c:(.text+0x651): undefined reference to
freqdem_demodulate'
fm_tune.c:(.text+0x66d): undefined reference to firfilt_rrrf_push' fm_tune.c:(.text+0x67c): undefined reference to
firfilt_rrrf_execute'
fm_tune.c:(.text+0x852): undefined reference to nco_crcf_set_frequency' fm_tune.c:(.text+0x8e5): undefined reference to
freqdem_destroy'
fm_tune.c:(.text+0x8ed): undefined reference to firfilt_crcf_destroy' fm_tune.c:(.text+0x8f9): undefined reference to
firfilt_rrrf_destroy'
fm_tune.c:(.text+0x901): undefined reference to nco_crcf_destroy' fm_tune.c:(.text+0x92c): undefined reference to
SoapySDRDevice_lastError'
/tmp/ccOYxC5X.o: In function init_sdr': fm_tune.c:(.text+0x9c9): undefined reference to
SoapySDRKwargs_fromString'
fm_tune.c:(.text+0x9d3): undefined reference to SoapySDRDevice_make' fm_tune.c:(.text+0x9eb): undefined reference to
SoapySDRDevice_getFrequencyRange'
fm_tune.c:(.text+0xa64): undefined reference to SoapySDRDevice_setSampleRate' fm_tune.c:(.text+0xa84): undefined reference to
SoapySDRDevice_setFrequency'
fm_tune.c:(.text+0xaae): undefined reference to SoapySDRDevice_setupStream' fm_tune.c:(.text+0xac7): undefined reference to
SoapySDRDevice_activateStream'
fm_tune.c:(.text+0xae9): undefined reference to SoapySDRDevice_lastError' fm_tune.c:(.text+0xb11): undefined reference to
SoapySDRDevice_lastError'
fm_tune.c:(.text+0xb20): undefined reference to SoapySDRDevice_lastError' /tmp/ccOYxC5X.o: In function
deinit_sdr':
fm_tune.c:(.text+0xb41): undefined reference to SoapySDRDevice_deactivateStream' fm_tune.c:(.text+0xb4c): undefined reference to
SoapySDRDevice_closeStream'
fm_tune.c:(.text+0xb5a): undefined reference to `SoapySDRDevice_unmake'
collect2: error: ld returned 1 exit status
: recipe for target 'fm_tune' failed
make: *** [fm_tune] Error 1
You don't have the SoapySDR library installed.
I do, but still got some error and can't compile.
Sorry, I haven't noticed this issue for a while. Please check with the latest master. It should use pkg-config to detect the correct paths. (6c62d27)
If it doesn't work, please post your config: what system are you using, is the soapysdr installed from a package, or from source. If from source, what's the install location?
You can also override the options on your own now with:
make SOAPYSDR_LDFLAGS="-lSoapySDR -Lyour/soapy/libs/path" SOAPYSDR_CFLAGS="-Iyour/soapy/include/path"
Closing for now. Feel free to reopen if that didn't solve the issue.
I'm getting exactly the same results as dave-88. Confirmed that the makefile has the pkg-config changes. Tried with Soapy SDR installed from package and also built from source, with same results.
Question: Your "orverride" make command sets SOAPYSDR_LDFLAGS and SOAPYSDR_CFLAGS. Should these actually be SOAPY_LDFLAGS and SOAPY_CFLAGS, the variables used in the makefile?
You're right, the override version should be:
make SOAPY_LDFLAGS="-lSoapySDR -Lyour/soapy/libs/path" SOAPY_CFLAGS="-Iyour/soapy/include/path"
@adrianboyko Could you post which OS/version are you using and what's the result of running pkg-config --cflags --libs SoapySDR
I have the same issue, my OS is Ubuntu 19.10 and I've tried compiling using this command cc -std=gnu11 -O3 -Wall -Wextra -march=native -lliquid -lm -lSoapySDR fm_tune.c -o fm_tune
and it finds the libraries without any problem but I get linking errors saying that it cannot find some SoapySDR functions. I have these packages installed libsoapysdr-dev
libsoapysdr0.6
and I get the same error even when I explicitly tell the gcc to link with /usr/lib/x86_64-gnu-linux/libSoapySDR
.
My SoapySDR lib package is exactly this libsoapysdr-dev/eoan,now 0.6.1-4 amd64
.
Yeah so I figured out the problem, it seems like that the GCC resolves the linking order based on the position of the arguments, so the translation unit that uses a library must be specified before the library is specified. So this would be the correct command
cc fm_tune.c -std=gnu11 -O3 -Wall -Wextra -march=native -lliquid -lm -lSoapySDR -o fm_tune
notice how the file name is before the libraries. This fixes the problem for me. And this is the wrong command that the make
command produces: cc -std=gnu11 -O3 -Wall -Wextra -march=native -lliquid -lm -lSoapySDR fm_tune.c -o fm_tune
Also I've noticed that the GCC that is provided with some distros is okay with the order of the arguments being wrong.