I am running Alpine Linux inside Termux using proot.

I installed gcc, libc-dev and openblas, and tried to compile a C program requiring cblas.h.

But it gives the following error.

/usr/lib/gcc/armv6-alpine-linux-musleabihf/8.3.0/../../../../armv6-alpine-linux-musleabihf/bin/ld: cannot find -lblas         
collect2: error: ld returned 1 exit statusmake: *** [Makefile:8: time_of_pendulum.exe] Error 1

The same code has worked in Ubuntu, with the pakcage libopenblas-dev installed.

  • If you needed the development package libopenblas-dev on Ubuntu, why aren't you using the same on Apline? The error's pretty obvious, isn't it (ld: cannot find -lblas)? – roaima Nov 5 '19 at 20:36
  • There is no package called libopenblas-dev or libblas-dev in alpine. I installed lapack-dev, which has cblas.h but it gave another error (/usr/lib/gcc/armv6-alpine-linux-musleabihf/8.3.0/../../../../armv6-alpine-linux-musleabihf/bin/ld: ode.c:(.text+0x940): undefined reference to cblas_daxpy'` while cblas_daxpy is a standard function in BLAS) – Archisman Panigrahi Nov 6 '19 at 8:03
  • You probably need a linker flag, of the form -lsomething, added to your compilation command. For example, if I want to use something from math.h I need the -lm linker flag : gcc -o myprog myprog.c -lm . I don't have any experience with openblas, but I think the docs will tell you what linker flag you need to add. – schaiba Nov 6 '19 at 11:48

You would probably also need to install the development libraries of openblas, just as you did on the Ubuntu system:

apk add openblas-dev

Alpine maintains an extensive package search tool that can help find out if packages are split into multiples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.