Error(s) compiling libdeepspeech.so

I modified deepspeech.cc to accept samples as float in addition to short because my audio sample source gives them as float and having to convert them to short just to have deepspeech convert them right back to float is a waste.

However, to make this easier to reproduce, I will try to compile it without any modification.

I configured tensorflow with nothing (no cuda, etc) but /arch:AVX2 (/arch:AVX is the default).

The command to build libdeepspeech I used is as follows:
bazel build --workspace_status_command="bash native_client/bazel_workspace_status_cmd.sh" --config=monolithic -c opt --copt=-O3 --copt="-D_GLIBCXX_USE_CXX11_ABI=0" --copt=-fvisibility=hidden //native_client:libdeepspeech.so
This is copied verbatim from the building guide at the official guide

I run it, and after dowloading needed librearies and compiling for a few minutes I get this error: error - Pastebin.com
PD: MSVC is generating logs in spanish. If you don’t understand the logs, the error code is C2678: binary 'operator' : no operator defined which takes a left-hand operand of type 'const Proxy' (or there is no acceptable conversion)

I am running on Windows 10 LTCS build 17763. All msvc c++ 2013, 2015 and 2019 libraries are installed. The bazel version is 3.1.0 as stated in the guide. The tensorflow version is the same as in the deepspeech repo.

Please share full text here instead of pastebin

Hm, this might be too linux/macOS specific, I know we have WIndows-only docs in https://github.com/mozilla/DeepSpeech/tree/385c8c769bc4aed5e6979a239591486c44f3471d/native_client/dotnet#building-deepspeech-native-client-for-windows

Please cross-check those instructions, they are the one we apply for CI.

BTW we are really lacking of people with good Windows building experience, so contributions are welcome.

Honestly, I have 0 idea why and I think it might just be you following the wrong doc.

Sure

Resumen
ERROR: C:/deepspeech/tensorflow/native_client/BUILD:63:1: C++ compilation of rule '//native_client:kenlm' failed (Exit 2): cl.exe failed: error executing command
  cd C:/users/fuyusaki/_bazel_cesar/baohmz5h/execroot/org_tensorflow
  SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt
    SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\\Extensions\Microsoft\IntelliCode\CLI;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\;;C:\WINDOWS\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\x64\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
    SET PWD=/proc/self/cwd
    SET PYTHON_BIN_PATH=C:/msys64/mingw64/bin/python.exe
    SET PYTHON_LIB_PATH=C:/msys64/mingw64/lib/python3.8/site-packages
    SET RUNFILES_MANIFEST_ONLY=1
    SET TEMP=C:\Users\fuyusaki\AppData\Local\Temp
    SET TF2_BEHAVIOR=1
    SET TF_CONFIGURE_IOS=0
    SET TF_ENABLE_XLA=1
    SET TMP=C:\Users\fuyusaki\AppData\Local\Temp
  C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/HostX64/x64/cl.exe /nologo /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 /EHsc /wd4351 /wd4291 /wd4250 /wd4996 /I. /Ibazel-out/x64_windows-opt/bin /Inative_client/kenlm /Ibazel-out/x64_windows-opt/bin/native_client/kenlm /DKENLM_MAX_ORDER=6 /showIncludes /MD /O2 /Oy- /DNDEBUG /wd4117 -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted" /Gy /Gw -DTFLITE_WITH_RUY_GEMV /w /D_USE_MATH_DEFINES -DWIN32_LEAN_AND_MEAN -DNOGDI -O3 -D_GLIBCXX_USE_CXX11_ABI=0 -fvisibility=hidden /std:c++14 -std=c++11 /Fobazel-out/x64_windows-opt/bin/native_client/_objs/kenlm/vocab.obj /c native_client/kenlm/lm/vocab.cc
Execution platform: @local_execution_config_platform//:platform
cl : Línea de comandos warning D9002 : se omite la opción desconocida '-O3'
cl : Línea de comandos warning D9002 : se omite la opción desconocida '-fvisibility=hidden'
cl : Línea de comandos warning D9002 : se omite la opción desconocida '-std=c++11'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): error C2678: '=' binario: no se encontró un operador que adopte un operando en la parte izquierda de tipo 'const Proxy' (o bien no existe una conversión aceptable)
        with
        [
            Proxy=util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>
        ]
native_client/kenlm\util/joint_sort.hh(82): note: puede ser 'util::detail::JointProxy<KeyIter,ValueIter> &util::detail::JointProxy<KeyIter,ValueIter>::operator =(const util::detail::JointProxy<KeyIter,ValueIter>::value_type &)'
        with
        [
            KeyIter=uint64_t *,
            ValueIter=util::PairedIterator<lm::ProbBackoff *,StringPiece *>
        ]
native_client/kenlm\util/joint_sort.hh(76): note: o       'util::detail::JointProxy<KeyIter,ValueIter> &util::detail::JointProxy<KeyIter,ValueIter>::operator =(const util::detail::JointProxy<KeyIter,ValueIter> &)'
        with
        [
            KeyIter=uint64_t *,
            ValueIter=util::PairedIterator<lm::ProbBackoff *,StringPiece *>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): note: al hacer coincidir la lista de argumentos '(const Proxy, util::detail::JointProxy<KeyIter,ValueIter>::value_type)'
        with
        [
            Proxy=util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>
        ]
        and
        [
            KeyIter=uint64_t *,
            ValueIter=util::PairedIterator<lm::ProbBackoff *,StringPiece *>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(7541): note: Vea la referencia a la creación de una instancia de la función plantilla "_BidIt std::_Insertion_sort_unchecked<_RanIt,_Pr>(const _BidIt,const _BidIt,_Pr)" que se está compilando
        with
        [
            _BidIt=util::ProxyIterator<util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>>,
            _RanIt=util::ProxyIterator<util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>>,
            _Pr=util::detail::LessWrapper<util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>,std::less<unsigned __int64>>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(7571): note: Vea la referencia a la creación de una instancia de la función plantilla "void std::_Sort_unchecked<_RanIt,_Fn>(_RanIt,_RanIt,__int64,_Pr)" que se está compilando
        with
        [
            _RanIt=util::ProxyIterator<util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>>,
            _Fn=util::detail::LessWrapper<util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>,std::less<unsigned __int64>>,
            _Pr=util::detail::LessWrapper<util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>,std::less<unsigned __int64>>
        ]
native_client/kenlm\util/joint_sort.hh(136): note: Vea la referencia a la creación de una instancia de la función plantilla "void std::sort<util::ProxyIterator<util::detail::JointProxy<KeyIter,ValueIter>>,util::detail::LessWrapper<util::detail::JointProxy<KeyIter,ValueIter>,Less>>(const _RanIt,const _RanIt,_Pr)" que se está compilando
        with
        [
            KeyIter=uint64_t *,
            ValueIter=util::PairedIterator<lm::ProbBackoff *,StringPiece *>,
            Less=std::less<unsigned __int64>,
            _RanIt=util::ProxyIterator<util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>>,
            _Pr=util::detail::LessWrapper<util::detail::JointProxy<unsigned __int64 *,util::PairedIterator<lm::ProbBackoff *,StringPiece *>>,std::less<unsigned __int64>>
        ]
native_client/kenlm\util/joint_sort.hh(141): note: Vea la referencia a la creación de una instancia de la función plantilla "void util::JointSort<KeyIter,ValueIter,std::less<unsigned __int64>>(const KeyIter &,const KeyIter &,const ValueIter &,const Less &)" que se está compilando
        with
        [
            KeyIter=uint64_t *,
            ValueIter=util::PairedIterator<lm::ProbBackoff *,StringPiece *>,
            Less=std::less<unsigned __int64>
        ]
native_client/kenlm/lm/vocab.cc(199): note: Vea la referencia a la creación de una instancia de la función plantilla "void util::JointSort<uint64_t*,util::PairedIterator<T *,StringPiece *>>(const KeyIter &,const KeyIter &,const ValueIter &)" que se está compilando
        with
        [
            T=lm::ProbBackoff,
            KeyIter=uint64_t *,
            ValueIter=util::PairedIterator<lm::ProbBackoff *,StringPiece *>
        ]
native_client/kenlm/lm/vocab.cc(128): note: Vea la referencia a la creación de una instancia de la función plantilla "void lm::ngram::SortedVocabulary::GenericFinished<lm::ProbBackoff>(T *)" que se está compilando
        with
        [
            T=lm::ProbBackoff
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): error C2678: '=' binario: no se encontró un operador que adopte un operando en la parte izquierda de tipo 'const Proxy' (o bien no existe una conversión aceptable)
        with
        [
            Proxy=util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>
        ]
native_client/kenlm\util/joint_sort.hh(82): note: puede ser 'util::detail::JointProxy<KeyIter,ValueIter> &util::detail::JointProxy<KeyIter,ValueIter>::operator =(const util::detail::JointProxy<KeyIter,ValueIter>::value_type &)'
        with
        [
            KeyIter=uint64_t *,
            ValueIter=lm::ProbBackoff *
        ]
native_client/kenlm\util/joint_sort.hh(76): note: o       'util::detail::JointProxy<KeyIter,ValueIter> &util::detail::JointProxy<KeyIter,ValueIter>::operator =(const util::detail::JointProxy<KeyIter,ValueIter> &)'
        with
        [
            KeyIter=uint64_t *,
            ValueIter=lm::ProbBackoff *
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(7419): note: al hacer coincidir la lista de argumentos '(const Proxy, util::detail::JointProxy<KeyIter,ValueIter>::value_type)'
        with
        [
            Proxy=util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>
        ]
        and
        [
            KeyIter=uint64_t *,
            ValueIter=lm::ProbBackoff *
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(7541): note: Vea la referencia a la creación de una instancia de la función plantilla "_BidIt std::_Insertion_sort_unchecked<_RanIt,_Pr>(const _BidIt,const _BidIt,_Pr)" que se está compilando
        with
        [
            _BidIt=util::ProxyIterator<util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>>,
            _RanIt=util::ProxyIterator<util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>>,
            _Pr=util::detail::LessWrapper<util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>,std::less<unsigned __int64>>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\algorithm(7571): note: Vea la referencia a la creación de una instancia de la función plantilla "void std::_Sort_unchecked<_RanIt,_Fn>(_RanIt,_RanIt,__int64,_Pr)" que se está compilando
        with
        [
            _RanIt=util::ProxyIterator<util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>>,
            _Fn=util::detail::LessWrapper<util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>,std::less<unsigned __int64>>,
            _Pr=util::detail::LessWrapper<util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>,std::less<unsigned __int64>>
        ]
native_client/kenlm\util/joint_sort.hh(136): note: Vea la referencia a la creación de una instancia de la función plantilla "void std::sort<util::ProxyIterator<util::detail::JointProxy<KeyIter,ValueIter>>,util::detail::LessWrapper<util::detail::JointProxy<KeyIter,ValueIter>,Less>>(const _RanIt,const _RanIt,_Pr)" que se está compilando
        with
        [
            KeyIter=uint64_t *,
            ValueIter=lm::ProbBackoff *,
            Less=std::less<unsigned __int64>,
            _RanIt=util::ProxyIterator<util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>>,
            _Pr=util::detail::LessWrapper<util::detail::JointProxy<unsigned __int64 *,lm::ProbBackoff *>,std::less<unsigned __int64>>
        ]
native_client/kenlm\util/joint_sort.hh(141): note: Vea la referencia a la creación de una instancia de la función plantilla "void util::JointSort<KeyIter,ValueIter,std::less<unsigned __int64>>(const KeyIter &,const KeyIter &,const ValueIter &,const Less &)" que se está compilando
        with
        [
            KeyIter=uint64_t *,
            ValueIter=lm::ProbBackoff *,
            Less=std::less<unsigned __int64>
        ]
native_client/kenlm/lm/vocab.cc(208): note: Vea la referencia a la creación de una instancia de la función plantilla "void util::JointSort<uint64_t*,T*>(const KeyIter &,const KeyIter &,const ValueIter &)" que se está compilando
        with
        [
            T=lm::ProbBackoff,
            KeyIter=uint64_t *,
            ValueIter=lm::ProbBackoff *
        ]
Target //native_client:libdeepspeech.so failed to build
INFO: Elapsed time: 243.030s, Critical Path: 21.41s
INFO: 480 processes: 480 local.
FAILED: Build did NOT complete successfully

I didn’t know that existed, thank you. Will follow it and see if I can get it to work.

Not that I want to be picky, but if you can share errors messages in English, it’s easier. Though I have no idea how to do that on Windows :confused:

I guess for once the error is on our side, we have everything on one place except that, mostly for historical reasons and lack of people giving feedback on windows builds.

Mostly, the .Net / Windows build has been bootstrapped / hacked by @carlfm01 and we are just following / updating on top of his work :slight_smile:

The previous problem is solved. Now this

ERROR: C:/deepspeech/tensorflow/tensorflow/core/util/BUILD:351:1: error executing shell command: 'C:/msys64/usr/bin/bash.exe -c bazel-out/x64_windows-opt-ST-e0f78fafe98f9cd48032f8d6a9732902b210aba3b30f85849d3455fe9d9fb327/bin/tensorflow/tools/git/gen_git_source.exe --generate "$@" --git_tag_ove...' failed (Exit 2): bash.exe failed: error executing command
  cd C:/users/fuyusaki/_bazel_cesar/baohmz5h/execroot/org_tensorflow
  SET PATH=C:\msys64\usr\bin;C:\msys64\bin;C:\WINDOWS;C:\WINDOWS\System32;C:\WINDOWS\System32\WindowsPowerShell\v1.0
    SET PYTHON_BIN_PATH=C:/msys64/mingw64/bin/python.exe
    SET PYTHON_LIB_PATH=C:/msys64/mingw64/lib/python3.8/site-packages
    SET RUNFILES_MANIFEST_ONLY=1
    SET TF2_BEHAVIOR=1
    SET TF_CONFIGURE_IOS=0
    SET TF_ENABLE_XLA=1
  C:/msys64/usr/bin/bash.exe -c bazel-out/x64_windows-opt-ST-e0f78fafe98f9cd48032f8d6a9732902b210aba3b30f85849d3455fe9d9fb327/bin/tensorflow/tools/git/gen_git_source.exe --generate "$@" --git_tag_override=${GIT_TAG_OVERRIDE:-}  external/local_config_git/gen/spec.json external/local_config_git/gen/head external/local_config_git/gen/branch_ref bazel-out/x64_windows-opt/bin/tensorflow/core/util/version_info.cc
Execution platform: @local_execution_config_platform//:platform
C:/msys64/mingw64/bin/python.exe: can't open file '\\gen_git_source.py': [Errno 2] No such file or directory
Target //native_client:libdeepspeech.so failed to build
INFO: Elapsed time: 387.768s, Critical Path: 56.49s
INFO: 933 processes: 933 local.
FAILED: Build did NOT complete successfully

I don’t know the bazel toolchain but looks like get_git_source.py isn’t copied to X dir at some point?

Unfortunately, that’s really TensorFlow / Windows related, and it’s not an error I remember we had to fix on CI, so I have mostly 0 idea.

Only really useful thing I could share was that most of the “No such file or directory” errors on Windows CI I had to fix were related to an interpreter not found, e.g., like python.exe

maybe adding -s --verbose_explanations to your bazel build can shed more light? maybe you should share more complete logs, there might be hints earlier.

Sometimes on Windows it’s also breaking because of lengths of path :confused:

Will do.
PD: Is there a way to cross-compile this from linux for windows? I have a feeling it would solve these weird issues.

Latest master CI task for windows/cpu: https://community-tc.services.mozilla.com/tasks/AWAnsgobSIKFaYrBpFKfhw

full build log (deepspeech): https://community-tc.services.mozilla.com/tasks/AWAnsgobSIKFaYrBpFKfhw/runs/0/logs/public/logs/live.log

full build log for tensorflow parts: https://community.taskcluster-artifacts.net/I3bYN3i1SL2994LJ7FAIrA/0/public/logs/live_backing.log

I’d wish, but TensorFlow build system does not provide that, and I don’t know MSVC well enough (nor have time to do it), sadly. We have it for linux on armv7/aarch64, but that’s it.

I got it to compile. I had to edit the build script to skip a non essential part that just replaced macros with the git version (deleted the part that run get_git_source.py, which was the cause of the problem). As of the compile errors, I found it was related to a library used by deepspeech. The problem was fixed upstream but the deepspeech repo has not updated yet. With that, the rest of the build can complete.

That’s still weird why you got into that error in the first place, but unless I have time and repro on a Windows machine, or you get time to dig into TensorFlow bazel build system, I fear there’s not a lot that can be done here.

Unfortunately, it seems to be tied to some compiler version to trigger the bug. That might explain why we have not experienced the issue.

Maybe it’s worth you file an issue on GitHub then, and share more details on your MSVC setup? Looks like the fix is an easy one.

From https://github.com/mozilla/community-tc-config/blob/bea5baeca2b9b683e73400a1205c36e3560a04ee/imagesets/deepspeech-win2012r2/bootstrap.ps1#L57-L59 we install 16.5.4.0

So yeah, I think filing a github issue would be nice.

https://deepspeech.readthedocs.io/en/master/BUILDING_DotNet.html