0

I am trying to use GSL on a raspberrypi but I am having some trouble compiling on the raspberry pi. I am writing my code on a ubuntu machine and it is working, but when I tried running the same code on my raspberry pi zero I get this:

gcc -L/usr/local/lib -lgsl -o interface example.o -pthread -lgsl -lcblas -lm pkg-config --cflags --libs gtk+-3.0 -export-dynamic /usr/bin/ld: cannot find -lcblas collect2: error: ld returned 1 exit status make: *** [makefile:26: all] Error 1

I tried compiling the example that GSL gives on how to use the library, but I get the same error. I tried compiling and installing OpenBLAS on the raspberry but I get the same error. Can someone tell me what I am doing wrong and how I can get GSL to work? also I tried asking on the raspberrypi stack, but idk if I will gen an answer there..

this is the makefile I am using:

TARGET=interface

# compiler
CC=gcc
# debug
DEBUG=-g
# optimisation
OPT=-O0
# warnings
WARN=-Wall

PTHREAD=-pthread -lgsl -lcblas -lm

CCFLAGS=$(DEBUG) $(OPT) $(WARN) $(PTHREAD) -pipe

GTKLIB=`pkg-config --cflags --libs gtk+-3.0`

# linker
LD=gcc
LDFLAGS=$(PTHREAD) $(GTKLIB) -export-dynamic

OBJS=    test.o

all: $(OBJS)
    $(LD) -o $(TARGET) $(OBJS) $(LDFLAGS)
    
main.o: src/main.c
    $(CC) -c $(CCFLAGS) test.c $(GTKLIB) -o test.o

clean:
    rm -f *.o $(TARGET)
user169808
  • 503
  • 1
  • 6
  • 27
  • You're missing the _gsl_ library (GNU scientific library). Did you install _that_? `OpenBLAS` [probably] doesn't provide (e.g.) `libgsl.so` et. al. You may be able to install the developer package for this for the raspberry pi (e.g. the raspian repo). How did you get it for ubuntu? Since ubuntu and raspbian have debian packages under the hood, the package probably exists. It may have to be the full source version if there isn't a prebuilt. Option B: consult the GSL homepage: https://www.gnu.org/software/gsl to download the source – Craig Estey Aug 31 '20 at 20:20
  • On my ubuntu I installed from source Just like I did on the raspberry. I also tried sudo apt-get install libgsl-dev on the raspberry and I get the same result. I thought the problem was OpenBlas because the error message says it cant find lcblas – user169808 Aug 31 '20 at 20:30
  • 1
    Oops, my bad. Yes, it's complaining about `libcblas.*` On ubuntu, what is the package that has libcblas? You could then install that on Rpi. Also, [ubuntu] installed where (e.g. /usr/lib64, /usr/local/lib64, ...)? Or, on Rpi, do a wildcard file search for `*libcblas*` using `apt` to see which pkgs have it. You may want to do a [manual] `ldconfig`. Or, `find / -xdev -name '*libcblas*'` on both. – Craig Estey Aug 31 '20 at 20:45
  • 1
    Or, see: https://askubuntu.com/questions/481/how-do-i-find-the-package-that-provides-a-file – Craig Estey Aug 31 '20 at 20:49
  • 1
    I did the search here: https://packages.ubuntu.com/ for `libcblas` and it found `libatlas3-dev` et. al. – Craig Estey Aug 31 '20 at 20:55
  • yes I just ran dpkg -S libcblas and got libatlas3-dev so I'm going to try and install it on the raspberry thanks, I am going to test it out: libatlas-base-dev:amd64: /usr/lib/x86_64-linux-gnu/libcblas.so libatlas3-base:amd64: /usr/lib/x86_64-linux-gnu/libcblas.so.3 libatlas-base-dev:amd64: /usr/lib/x86_64-linux-gnu/libcblas.a libatlas3-base:amd64: /usr/lib/x86_64-linux-gnu/libcblas.so.3.10.3 – user169808 Aug 31 '20 at 20:58
  • @CraigEstey thanks you solved it. I had to run sudo apt-get install libatlas-base-dev on the raspberry pi and it started working. – user169808 Aug 31 '20 at 21:10

0 Answers0