`CCDLFLAGS` is missing `-fPIC`. Instead `-fPIC` is set only in `CFLAGS` and because of this C++ code is compiled without it (breaking partial static linking).