scateu / kalibrate-hackrf

kalibrate for hackrf
BSD 2-Clause "Simplified" License
267 stars 78 forks source link

ld: library not found for -lrt #5

Closed gyaresu closed 8 years ago

gyaresu commented 9 years ago

bootstrap and configure seem to complete successfully.

But then I get the error on make. It looks like I'm missing a library.

make error

$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src
g++ -I/usr/local/Cellar/fftw/3.3.4_1/include  -I/usr/local/Cellar/hackrf/2015.07.2/include/ -I/usr/local/Cellar/libusb/1.0.19/include/libusb-1.0  -g -O2   -o kal kal-arfcn_freq.o kal-c0_detect.o kal-circular_buffer.o kal-fcch_detector.o kal-kal.o kal-offset.o kal-usrp_source.o kal-util.o -L/usr/local/Cellar/fftw/3.3.4_1/lib -lfftw3  -L/usr/local/Cellar/hackrf/2015.07.2/lib -lhackrf  -lrt
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [kal] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

HackRF info

Found HackRF board 0:
USB descriptor string: 0000000000000000457863c82e33551f
Board ID Number: 2 (HackRF One)
Firmware Version: 2015.07.2
Part ID Number: 0xa000cb3c 0x00484f3e
Serial Number: 0x00000000 0x00000000 0x457863c8 0x2e33551f

OS X 10.10.4

gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix

Any ideas? Thanks!

samuelheinrich commented 8 years ago

Is there any fix? I'm having the same issue with OSX 10.11.2.

I found this post in another project: https://github.com/wjwwood/serial/issues/24

where someone suggest to remove the linking to the library for OSX systems.

Could the same be done for this project as well?

samuelheinrich commented 8 years ago

I managed to compile the code!

find and edit the following files in the src directory:

flexbook:kalibrate-hackrf samuelheinrich$ ls -lha src/ total 1160 drwxr-xr-x 35 samuelheinrich staff 1.2K Jan 6 19:09 . drwxr-xr-x 32 samuelheinrich staff 1.1K Jan 6 19:09 .. drwxr-xr-x 10 samuelheinrich staff 340B Dec 30 16:36 .deps -rw-r--r-- 1 samuelheinrich staff 30K Jan 6 19:09 Makefile -rw-r--r-- 1 samuelheinrich staff 431B Jan 6 19:09 Makefile.am -rw-r--r-- 1 samuelheinrich staff 33K Jan 6 19:09 Makefile.in

you'll find the following line in each file:

flexbook:src samuelheinrich$ cat Makefile | grep lrt kal_LDADD = $(FFTW3_LIBS) $(LIBHACKRF_LIBS) -lrt

flexbook:src samuelheinrich$ cat Makefile.am | grep lrt kal_LDADD = $(FFTW3_LIBS) $(LIBHACKRF_LIBS) -lrt

flexbook:src samuelheinrich$ cat Makefile.in | grep l kal_LDADD = $(FFTW3_LIBS) $(LIBHACKRF_LIBS) -lrt

remove "-lrt" behind each line.

flexbook:kalibrate-hackrf samuelheinrich$ make /Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive Making all in src make[2]: Nothing to be done for `all'. flexbook:kalibrate-hackrf samuelheinrich$

flexbook:kalibrate-hackrf samuelheinrich$ sudo make install Password: Making install in src /opt/local/bin/gmkdir -p '/usr/local/bin' /opt/local/bin/ginstall -c kal '/usr/local/bin' make[2]: Nothing to be done for install-data-am'. make[2]: Nothing to be done forinstall-exec-am'. make[2]: Nothing to be done for `install-data-am'. flexbook:kalibrate-hackrf samuelheinrich$

flexbook:kalibrate-hackrf samuelheinrich$ kal --help kal: illegal option -- - kalibrate v0.4.1-hackrf, Copyright (c) 2010, Joshua Lackey modified for use with hackrf devices, Copyright (c) 2014, scateu@gmail.com Usage: GSM Base Station Scan: kal <-s band indicator> [options]

Clock Offset Calculation:
    kal <- f frequency | -c channel> [options]

Where options are: -s band to scan (GSM850, GSM-R, GSM900, EGSM, DCS, PCS) -f frequency of nearby GSM base station -c channel of nearby GSM base station -b band indicator (GSM850, GSM-R, GSM900, EGSM, DCS, PCS) -a rf amplifier enable -g vga (bb) gain in dB, 0-40dB, 8dB step -l lna (if) gain in dB, 0-62dB, 2dB step -d rtl-sdr device index -e initial frequency error in ppm -v verbose -D enable debug messages -h help flexbook:kalibrate-hackrf samuelheinrich$

scateu commented 8 years ago

Thanks for your report, and sorry for my delay.

I have fixed the configure scripts, adding an OS X detection.

Besides, I have added a build instruction in homebrew environment in INSTALL.homebrew.