@@ -894,6 +894,12 @@ if is_set $HOST; then
894894 fi
895895 else
896896 TARGET_ARCH=" $HOST "
897+ if ! $static_fst || ! $static_math || $dynamic_kaldi ; then
898+ echo " WARNING: Dynamic libraries are not currently supported when compiling to WASM. Overriding --static, --static-math, and --static-fst."
899+ fi
900+ dynamic_kaldi=false
901+ static_math=true
902+ static_fst=true
897903 fi
898904
899905 HOST_CXX=" $HOST -c++"
@@ -1360,14 +1366,6 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
13601366** You can also use other matrix algebra libraries. For information, see:
13611367** http://kaldi-asr.org/doc/matrixwrap.html"
13621368 fi
1363- if [ -f $OPENBLASROOT /lib/libopenblas.so ]; then
1364- OPENBLASLIBDIR=$OPENBLASROOT /lib
1365- elif [ -f $OPENBLASROOT /lib64/libopenblas.so ]; then
1366- # in REDHAT/CentOS package installs, the library is located here
1367- OPENBLASLIBDIR=$OPENBLASROOT /lib64
1368- else
1369- failure " Expected to find the file $OPENBLASROOT /lib/libopenblas.so"
1370- fi
13711369 if [ -f $OPENBLASROOT /include/cblas.h ] ; then
13721370 OPENBLASINCDIR=$OPENBLASROOT /include
13731371 elif [ -f $OPENBLASROOT /include/openblas/cblas.h ] ; then
@@ -1381,18 +1379,35 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
13811379 echo " ** if it is a package-based install)."
13821380 OPENBLASINCDIR=" /usr/include"
13831381 fi
1384- echo " Your math library seems to be OpenBLAS from $OPENBLASROOT . Configuring appropriately."
1385- # TODO(kkm): Probably, OpenBLAS required libgfortran.so.3 at some point, but
1386- # no longer does. *My* linker does not complain about a missing library, but
1387- # is it safe to keep the reference if no longer required? Try to figure out
1388- # how long ago the dependency was dropped.
13891382 if $static_math ; then
1383+ if [ -f $OPENBLASROOT /lib/libopenblas.a ]; then
1384+ OPENBLASLIBDIR=$OPENBLASROOT /lib
1385+ else
1386+ failure " Expected to find the file $OPENBLASROOT /lib/libopenblas.a"
1387+ fi
13901388 echo " Configuring static OpenBlas since --static-math=yes"
1391- OPENBLASLIBS=" -L$OPENBLASLIBDIR -l:libopenblas.a -lgfortran"
1389+ OPENBLASLIBS=" -L$OPENBLASLIBDIR -l:libopenblas.a"
1390+ # No Fortran for OpenBLAS
1391+ if [[ " $HOST " != WASM ]]; then
1392+ OPENBLASLIBS+=" -lgfortran"
1393+ fi
13921394 else
1395+ if [ -f $OPENBLASROOT /lib/libopenblas.so ]; then
1396+ OPENBLASLIBDIR=$OPENBLASROOT /lib
1397+ elif [ -f $OPENBLASROOT /lib64/libopenblas.so ]; then
1398+ # in REDHAT/CentOS package installs, the library is located here
1399+ OPENBLASLIBDIR=$OPENBLASROOT /lib64
1400+ else
1401+ failure " Expected to find the file $OPENBLASROOT /lib/libopenblas.so"
1402+ fi
13931403 echo " Configuring dynamically loaded OpenBlas since --static-math=no (the default)"
13941404 OPENBLASLIBS=" -L$OPENBLASLIBDIR -lopenblas -lgfortran -Wl,-rpath=$OPENBLASLIBDIR "
13951405 fi
1406+ echo " Your math library seems to be OpenBLAS from $OPENBLASROOT . Configuring appropriately."
1407+ # TODO(kkm): Probably, OpenBLAS required libgfortran.so.3 at some point, but
1408+ # no longer does. *My* linker does not complain about a missing library, but
1409+ # is it safe to keep the reference if no longer required? Try to figure out
1410+ # how long ago the dependency was dropped.
13961411 echo " OPENBLASINC = $OPENBLASINCDIR " >> kaldi.mk
13971412 echo " OPENBLASLIBS = $OPENBLASLIBS " >> kaldi.mk
13981413 echo >> kaldi.mk
0 commit comments