Trouble linking cython-generated C file against openblas

Trouble linking cython-generated C file against openblas

Can anyone see what I'm doing wrong. I'm no C expert, but I thought this
would work.
This is just a dummy example more or less.
dot.pyx:
cimport numpy as cnp
import numpy as np
ctypedef cnp.float64_t DOUBLE
cdef extern from "cblas.h":
void dgemm "cblas_dgemm"(char storage, char transa, char transb, int m,
int n, int k, double alpha, double *A, int lda,
double *B, int ldb, double beta, double *C,
int ldc)
# 101 = c-order, 111 = no transpose, 112 = transpose (XY')
def fast_dot(cnp.ndarray[DOUBLE, ndim=2] X, cnp.ndarray[DOUBLE, ndim=2] Y,
cnp.ndarray[DOUBLE, ndim=1] out):
dgemm(101, 111, 112,
1, # X rows hard-coded
3, # Y rows hard-coded
3, # X cols hard-coded
1.0,
<DOUBLE *> X.data, X.strides[0] / sizeof(double),
<DOUBLE *>Y.data, Y.strides[0] / sizeof(double), 0.0,
<DOUBLE *>out.data, out.strides[0] / sizeof(double))
return out
I then do
cython dot.pyx
gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing
-I/usr/include/python2.7
-I/usr/local/lib/python2.7/dist-packages/numpy/core/include/
-I~/.local/include/ -L~/.local/lib/ -lopenblas -o dot.so dot.c
When I try to do from dot import fast_dot, I get
ImportError: ./dot.so: undefined symbol: dgemm
Indeed
$ nm dot.so | grep dgemm
U cblas_dgemm
But
$ nm ~/.local/lib/libopenblas.so | grep dgemm
000000000009c1e0 T cblas_dgemm
000000000009afa0 T dgemm_
What am I missing?