Failed to build cpp_package on Windows

Hello,

tried to build the cpp_package but it fails:

1>------ Build started: Project: cpp_package_op_h, Configuration: Release x64 ------
1>“Running: OpWrapperGenerator.py”
1>C:/Projects/MxNet-130/build/Release/libmxnet.dll
1>Traceback (most recent call last):
1> File “OpWrapperGenerator.py”, line 429, in
1> raise(e)
1> File “OpWrapperGenerator.py”, line 423, in
1> f.write(patternStr % ParseAllOps())
1> File “OpWrapperGenerator.py”, line 318, in ParseAllOps
1> cdll.libmxnet = cdll.LoadLibrary(sys.argv[1])
1> File “C:\Program Files\Anaconda3\lib\ctypes_init_.py”, line 422, in LoadLibrary
1> return self.dlltype(name)
1> File "C:\Program Files\Anaconda3\lib\ctypes_init
.py", line 344, in init
1> self._handle = _dlopen(self._name, mode)
1>OSError: [WinError 126] The specified module could not be found
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: “cmd.exe” exited with code 1.
1>Done building project “cpp_package_op_h.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

MXNET builds in release and debug mode, but the cpp_package fails on the opwrapper to generate the op.h include file. I have put a print statement in opwrapper.py, to see which file is in the command line, but that seems OK.

System: Windows 10 Pro X64
MXNet 1.3.0
Visual Studio 17 professional, using toolset v14.16
OpenCV 3.4.4
MKL
No CUDA/CUDNN
CMake 3.12.4
Anaconda3 64 bit

Looking for a solution

Found the solution by setting the OpenCV release dir to the PATH. Now it generates the OpWrapper.h include file.

But compiling the examples breaks because mxnet_static.lib not found by the linker.

This problem can be solved by changing the mxnet_static.lib library reference to (SolutionDir)(Configuration)\libmxnet.lib in the linker properties of the example project files (need to do that for every example).

Hi, can you share the CMakeList.txt configuration file that you used and successfully built mxnet? because of my environtment and version are same as yours

Thank you in advance…

Hi, you can download my CMakeList from here: https://www.dropbox.com/s/vdefwj4dibc9da6/CMakeLists.txt?dl=0

That should do the job, just have a look at path to 3rd party software (MKL) I have set, you need to put in your own. I ran CMake from the CMake GUI (ignoring some red highlighted problems). Running CMake from VS2017 didn’t work out for me. Please let me know if you succeed!