Build trouble on Ubuntu 17.10

From fresh checked-out master source, “make” produces:

test_potrs.o: In function __ctest_potrf_bug_695_run': test_potrs.c:(.text+0xc4): undefined reference to zpotrs_’
collect2: error: ld returned 1 exit status
Makefile:21: recipe for target ‘openblas_utest’ failed
make[3]: *** [openblas_utest] Error 1
Makefile:116: recipe for target ‘tests’ failed
make[2]: *** [tests] Error 2
*** Clean the OpenBLAS build with ‘make -C deps clean-openblas’. Rebuild with ‘make OPENBLAS_USE_THREAD=0’ if OpenBLAS had trouble linking libpthread.so, and with ‘make OPENBLAS_TARGET_ARCH=NEHALEM’ if there were errors building SandyBridge support. Both these options can also be used simultaneously. ***
/home/preda/julia/deps/blas.mk:88: recipe for target ‘scratch/openblas-5dde4e65d321076582a2fafe16949d2160551e81/build-compiled’ failed
make[1]: *** [scratch/openblas-5dde4e65d321076582a2fafe16949d2160551e81/build-compiled] Error 1
Makefile:83: recipe for target ‘julia-deps’ failed
make: *** [julia-deps] Error 2

I just ran into this. Check the Required Build Tools and External Libraries to make sure they’re all installed (via apt-get or equivalent). There were still a couple missing after I installed build-essential, including gfortran.

Otherwise, try doing what the error says, though it didn’t seem to help me:

*** Clean the OpenBLAS build with ‘make -C deps clean-openblas’. Rebuild with ‘make
 OPENBLAS_USE_THREAD=0’ if OpenBLAS had trouble linking libpthread.so, and with 
‘make OPENBLAS_TARGET_ARCH=NEHALEM’ if there were errors building SandyBridge 
support. Both these options can also be used simultaneously. ***

I had OpenBLAS-related build trouble a few days ago. While the errors were different, I did finally resolve it via simply installing OpenBLAS separately and then using system BLAS.
Just create a Make.user with lines like:

USE_SYSTEM_BLAS=1
USE_SYSTEM_LAPACK=1
LIBBLAS=-lopenblas
LIBBLASNAME=libopenblas
LIBLAPACK=-lopenblas
LIBLAPACKNAME=libopenblas

The easiest way to get openblas of course is just sudo apt-get install libopenblas-dev.
But I’ve also found that checking out OpenBLAS and building from source: https://github.com/xianyi/OpenBLAS
is a lot less prone to throwing errors and easier to debug than letting Julia build it.
If you’d like “inspiration” on what flags to use, you can look at:
https://github.com/JuliaLang/julia/blob/master/deps/blas.mk

So, were you able to fix this problem?

OK, just doing a clean of OpenBLAS as instructed fixes it:
make -C deps clean-openblas

Yes. In my case I was on a new Ubuntu install and was missing a couple of the required programs. It compiled fine once I installed them. I think I ran ‘make clean‘ to be safe.