I’m trying to package this speech recognition library which is a fork of kaldi and a dependency for a dictation program I want to try out. It requires either MKL or OpenBLAS. If I try to use MKL, it will complain that it can’t find libmkl_intel_lp64.a
. MKL from nixpkgs instead provides libmkl_intel_lp64.so
. It’s the exact same situation with OpenBLAS. I’m not a C/C++ programmer, but I understand that the .a
versions are static libraries, right? Is there anyway to make use of MKL or OpenBLAS from nixpkgs in my derivation for the fork of kaldi?
Alternatively, that library includes scripts for installing OpenBLAS and MKL. If I try to use the one for installing OpenBLAS, I end up with errors that look like this
/nix/store/3b3ighb83nhifa1v4n7855hlbdl1mhf9-binutils-2.31.1/bin/ld: /nix/store/9cyy1lisy7gh44i9mqcmwlrkpiqbgwjw-gfortran-9.3.0/lib/libgfortran.a(read.o): relocation R_X86_64_32S against `.rodata.masks.13171' can not be used when making a shared object; recompile with -fPIC
/nix/store/3b3ighb83nhifa1v4n7855hlbdl1mhf9-binutils-2.31.1/bin/ld: final link failed: nonrepresentable section on output
That was using this derivation:
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "kaldi-fork-active-grammar";
src = fetchgit {
url = "https://github.com/daanzu/kaldi-fork-active-grammar";
rev = "3f56242df335792756ca17f46a348ca2b36238d7";
sha256 = "1fmyzyxb94br0kxdfczrhdv2f25zz71a96r8brbzbqmwcjlkpm0j";
};
buildInputs = [ zlib automake autoconf subversion sox gfortran gfortran.cc libtool python27 openfst ];
postPatch = ''
mkdir -p python && touch python/.use_default_python && tools/extras/check_dependencies.sh
find . -type f | xargs -i@ sed -i 's:/bin/bash:${stdenv.shell}:g' @
sed -i '1069s/.*/OPENFST_VER=1.7.4/' src/configure
'';
postConfigure = ''
(
cd tools
make -j4 && \
make -j openblas
) && \
(
cd src
./configure --shared --static-math --mathlib=OPENBLAS --fst-root=${openfst} && \
make -j4 depend && make -j4 dragonfly dragonflybin bin fstbin lmbin
)
'';
}
It fails at make -j openblas
in postConfigure
. The build process is based on the build commands here, in a separate project.