Closed PureTryOut closed 1 year ago
Can you change
/usr/lib/ccache/bin/g++ -Os -fomit-frame-pointer -Os -DNDEBUG -Wl,--as-needed -lcblas -llapack src/matrix/CMakeFiles/sparse-matrix-test.dir/sparse-matrix-test.cc.o
to
/usr/lib/ccache/bin/g++ -Os -fomit-frame-pointer -Os -DNDEBUG src/matrix/CMakeFiles/sparse-matrix-test.dir/sparse-matrix-test.cc.o -Wl,--as-needed -lcblas -llapack
and retry?
That is, put -Wl,--as-needed -lcblas -llapack
after sparse-matrix-test.cc.o
.
Not sure how using CMake? Like I said right now I'm just executing LDFLAGS="$LDFLAGS -lcblas -llapack" cmake <other flags>
, I didn't choose the order in which it appeared in the compiler command.
How did you invoke cmake?
LDFLAGS="$LDFLAGS -lcblas -llapack" cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DKALDI_VERSION="$pkgver"
With $pkgver
being 5.5 currently (not sure why CMakeLists.txt doesn't have that set itself).
Could you try the following changes
diff --git a/cmake/gen_cmake_skeleton.py b/cmake/gen_cmake_skeleton.py
index 5925c6369..88df4a0b6 100644
--- a/cmake/gen_cmake_skeleton.py
+++ b/cmake/gen_cmake_skeleton.py
@@ -269,7 +269,7 @@ class CMakeListsLibrary(object):
if len(self.depends) > 0:
ret.append("target_link_libraries(" + self.target_name + " PUBLIC")
- for d in self.depends:
+ for d in self.depends + ['-lcblas', '-llapack'] :
ret.append(" " + d)
ret.append(")\n")
and rerun cmake and ninja
?
Assume that libcblas.so
and liblapack.so
are on your library search path.
Yup, that did the trick! Now I don't even need to manually specify ldflags anymore, awesome.
Hello, I also just hit this issue, so thank you for the help. Should this be PRed? More research to be done?
This issue has been automatically marked as stale by a bot solely because it has not had recent activity. Please add any comment (simply 'ping' is enough) to prevent the issue from being closed for 60 more days if you believe it should be kept open.
I'm trying to build kaldi on Alpine Linux which uses Musl libc rather than glibc. I managed to make it compile with
configure
by settingLDFLAGS="$LDFLAGS -lcblas -llapack"
but the same does not seem to work with CMake. Of course, blas and lapack are installed.Why does it fail to link properly to blas?