diff --git a/src/configure b/src/configure index 1186c6d12a8e9841f8ddb83b690db3bfc18603d0..60132c0a5672ae24c3b923e7d7316ef73629ad5e 100755 --- a/src/configure +++ b/src/configure @@ -194,7 +194,7 @@ function check_compiler { You need g++ >= 4.7, Apple clang >= 5.0 or LLVM clang >= 3.3." else COMPILER_VER_INFO=$($COMPILER --version 2>/dev/null) - if [[ $COMPILER_VER_INFO == *"g++"* ]]; then + if [[ $COMPILER_VER_INFO == *[gc]"++"* ]]; then GCC_VER=$($COMPILER -dumpversion) GCC_VER_NUM=$(echo $GCC_VER | sed 's/\./ /g' | xargs printf "%d%02d%02d") if [ $GCC_VER_NUM -lt 40700 ]; then @@ -430,7 +430,7 @@ function configure_cuda { fi COMPILER_VER_INFO=$($CXX --version 2>/dev/null) - if [[ $COMPILER_VER_INFO == *"g++"* ]]; then + if [[ $COMPILER_VER_INFO == *[gc]"++"* ]]; then GCC_VER=$($COMPILER -dumpversion) GCC_VER_NUM=$(echo $GCC_VER | sed 's/\./ /g' | xargs printf "%d%02d%02d") case $CUDA_VERSION in diff --git a/src/cudadecoderbin/Makefile b/src/cudadecoderbin/Makefile index 9c7ec7837a71b84206d01403a33d4ad663ff1a71..ea0d89c9640d76b71f30aa289a996082c7d9d6c9 100644 --- a/src/cudadecoderbin/Makefile +++ b/src/cudadecoderbin/Makefile @@ -12,6 +12,7 @@ endif LDFLAGS += $(CUDA_LDFLAGS) LDLIBS += $(CUDA_LDLIBS) +EXTRA_LDLIBS += -lrt BINFILES = batched-wav-nnet3-cuda batched-wav-nnet3-cuda2 batched-wav-nnet3-cuda-online diff --git a/src/makefiles/cuda_64bit.mk b/src/makefiles/cuda_64bit.mk index 459cfa652eff60669426151ad24c7336c4d417be..34c4f1fb3fb690841d9bb5b8ba3278190735f3b0 100644 --- a/src/makefiles/cuda_64bit.mk +++ b/src/makefiles/cuda_64bit.mk @@ -13,5 +13,10 @@ CUDA_FLAGS = --machine 64 -DHAVE_CUDA \ -std=c++11 -DCUDA_API_PER_THREAD_DEFAULT_STREAM -lineinfo \ --verbose -Xcompiler "$(CXXFLAGS)" +ifeq ($(shell test -e $(CUDATKDIR)/lib64/libcudart_static.a && echo -n yes),yes) CUDA_LDFLAGS += -L$(CUDATKDIR)/lib64 -Wl,-rpath,$(CUDATKDIR)/lib64 +else +CUDA_LDFLAGS += -L$(CUDATKDIR)/lib -Wl,-rpath,$(CUDATKDIR)/lib +endif + CUDA_LDLIBS += -lcublas -lcusparse -lcudart -lcurand -lcufft -lnvToolsExt #LDLIBS : The .so libs are loaded later than static libs in implicit rule diff --git a/src/makefiles/default_rules.mk b/src/makefiles/default_rules.mk index 14989e8afaff754328c3c8d7c5899128520b6d18..42d4e9d12f69428eaef7072fc9f286613112f74e 100644 --- a/src/makefiles/default_rules.mk +++ b/src/makefiles/default_rules.mk @@ -50,7 +50,7 @@ $(LIBFILE): $(LIBNAME).a ln -sf $(shell pwd)/$@ $(KALDILIBDIR)/$@ else ifeq ($(shell uname), Linux) # Building shared library from static (static was compiled with -fPIC) - $(CXX) -shared -o $@ -Wl,--no-undefined -Wl,--as-needed -Wl,-soname=$@,--whole-archive $(LIBNAME).a -Wl,--no-whole-archive $(LDFLAGS) $(LDLIBS) + $(CXX) -shared -o $@ -Wl,--as-needed -Wl,-soname=$@,--whole-archive $(LIBNAME).a -Wl,--no-whole-archive $(LDFLAGS) $(LDLIBS) ln -sf $(shell pwd)/$@ $(KALDILIBDIR)/$@ else # Platform not supported $(error Dynamic libraries not supported on this platform. Run configure with --static flag.) @@ -82,7 +82,7 @@ endif $(MAKE) -C ${@D} ${@F} clean: - -rm -f *.o *.a *.so $(TESTFILES) $(BINFILES) $(TESTOUTPUTS) tmp* *.tmp *.testlog + -rm -f *.o *.a *.so *.dylib $(OBJFILES) $(TESTFILES) $(BINFILES) $(TESTOUTPUTS) tmp* *.tmp *.testlog distclean: clean -rm -f .depend.mk diff --git a/tools/Makefile b/tools/Makefile index fb19fb37e8ee02b8ad23291bd73d78749c115169..2735ac3a59e5d6a90cbd5bb8cba4cf8c1c959c1e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -86,6 +86,12 @@ else endif openfst-$(OPENFST_VERSION)/Makefile: openfst-$(OPENFST_VERSION) | check_required_programs + # modify src/extensions/far/Makefile.am to make it work with gcc >= 5, while keep its timestamp to avoid autoreconf + $(eval make_file=openfst-$(OPENFST_VERSION)/src/extensions/far/Makefile.in) + $(eval STAMP="$(shell date -r $(make_file))") + sed -i -r 's~am__DEPENDENCIES_1 =$$~& libfstfar.la~' $(make_file) + sed -i -E 's~(@LDADD = libfstfarscript.la) \.\.~\1 libfstfar.la ..~' $(make_file) + touch -d $(STAMP) $(make_file) cd openfst-$(OPENFST_VERSION)/ && \ ./configure --prefix=`pwd` $(OPENFST_CONFIGURE) CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS) $(openfst_add_CXXFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="-ldl" diff --git a/tools/extras/check_dependencies.sh b/tools/extras/check_dependencies.sh index 6c7343697fcf6d5620508b73ad7685cfdbe30a9d..ea3e157ccfa2f0470961873b8e0c9a462548070e 100755 --- a/tools/extras/check_dependencies.sh +++ b/tools/extras/check_dependencies.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash CXX=${CXX:-g++} +CXXFLAGS=${CXXFLAGS} status=0 # at some point we could try to add packages for Cywgin or macports(?) to this @@ -25,12 +26,13 @@ case $compiler_ver_info in add_packages gcc-c++ g++ status=1 ;; + *"c++ "* ) ;& "g++ "* ) gcc_ver=$($CXX -dumpversion) gcc_ver_num=$(echo $gcc_ver | sed 's/\./ /g' | xargs printf "%d%02d%02d") if [ $gcc_ver_num -lt 40803 ]; then echo "$0: Compiler '$CXX' (g++-$gcc_ver) is not supported." - echo "$0: You need g++ >= 4.8.3, Apple clang >= 5.0 or LLVM clang >= 3.3." + echo "$0: You need g++ >= 4.9.1, Apple clang >= 5.0 or LLVM clang >= 3.3." status=1 fi ;; @@ -59,7 +61,7 @@ case $compiler_ver_info in esac # Cannot check this without a compiler. -if have "$CXX" && ! echo "#include <zlib.h>" | $CXX -E - >&/dev/null; then +if have "$CXX" && ! echo "#include <zlib.h>" | $CXX $CXXFLAGS -E - &>/dev/null; then echo "$0: zlib is not installed." add_packages zlib-devel zlib1g-dev fi @@ -136,7 +138,7 @@ case $(uname -m) in # installed in an alternative location (this is unlikely). MKL_ROOT="${MKL_ROOT:-/opt/intel/mkl}" if [ ! -f "${MKL_ROOT}/include/mkl.h" ] && - ! echo '#include <mkl.h>' | $CXX -I /opt/intel/mkl/include -E - >&/dev/null; then + ! echo '#include <mkl.h>' | $CXX -I /opt/intel/mkl/include -E - &>/dev/null; then if [[ $(uname) == Linux ]]; then echo "$0: Intel MKL is not installed. Run extras/install_mkl.sh to install it." else @@ -149,7 +151,7 @@ case $(uname -m) in *) # Suggest OpenBLAS on other hardware. if [ ! -f $(pwd)/OpenBLAS/install/include/openblas_config.h ] && ! echo '#include <openblas_config.h>' | - $CXX -I $(pwd)/OpenBLAS/install/include -E - >&/dev/null; then + $CXX -I $(pwd)/OpenBLAS/install/include -E - &>/dev/null; then echo "$0: OpenBLAS not detected. Run extras/install_openblas.sh ... to compile it for your platform, or configure with --openblas-root= if you ... have it installed in a location we could not guess. Note that packaged