mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

cpp-package: Cannot open include file: 'mxnet-cpp/op.h'

Open rococopeach opened this issue 9 years ago • 20 comments

I synced latest code and tried to build mxnet . Build fails with the following error message.

cpp-package\include\mxnet-cpp/optimizer.hpp(19): fatal error C1083: Cannot open include file: 'mxnet-cpp/op.h': No such file or directory

It seems 00b2b47f70283e0706256b8585b97b63efd25c57 change set removed mxnet-cpp/op.h. but other code is still including "mxnet-cpp/op.h"

MxNetCpp.h optimizer.hpp .cpp files under cpp-package/example/ these file include "mxnet-cpp/op.h".

Environment info

Operating System:Windows 10 Compiler: Visual Studio 2013 Package used (Python/R/Scala/Julia):Cpp-package MXNet commit hash (git rev-parse HEAD):3f75c41fb3cd176089bfd06ab76a0e04723cefe0

Error Message:

10>D:\nvTFS2\External\Mxnet\mxnet_20170517_3f75c41fb3cd176089bfd06ab76a0e04723cefe0\cpp-package\include\mxnet-cpp/optimizer.hpp(19): fatal error C1083: Cannot open include file: 'mxnet-cpp/op.h': No such file or directory

Minimum reproducible example

#include "MxNetCpp.h"

rococopeach avatar May 17 '17 21:05 rococopeach

Did you try to set USE_CPP_PACKAGE=1 and make -j from ~/mxnet?

eric-haibin-lin avatar May 17 '17 21:05 eric-haibin-lin

How did you create the project in vs?

conopt avatar May 17 '17 22:05 conopt

I use cmake to make vs project. image

rococopeach avatar May 18 '17 00:05 rococopeach

What's the output when building in visual studio. Could you searchRunning OpWrapperGenerator.py in the output window?

conopt avatar May 18 '17 00:05 conopt

I see . Does OpWrapperGeneratoer.py generate op.h? I miss this error. 9> "Running: OpWrapperGenerator.py" 9> Traceback (most recent call last): 9> File "OpWrapperGenerator.py", line 402, in 9> raise(e) 9> WindowsError: [Error 126] The specified module could not be found

Which python package do I need to install? I could not find setupenv.cmd which is mentioned at http://mxnet.io/get_started/windows_setup.html.

rococopeach avatar May 18 '17 01:05 rococopeach

Could you edit this line https://github.com/dmlc/mxnet/blob/master/cpp-package/CMakeLists.txt#L14 to COMMAND echo "Running: OpWrapperGenerator.py $<TARGET_FILE:mxnet>"

then regenerate the solution and paste the output here?

conopt avatar May 18 '17 02:05 conopt

i know what's happening. some dependencies (probably blas or opencv) are missing. you need to register the dlls systemwide.

conopt avatar May 18 '17 04:05 conopt

Built is succeeded after I edited CmakeList.txt and added blas path. Thank you.

rococopeach avatar May 22 '17 23:05 rococopeach

Got error below building mxnet in windows! image

Environment info

Operating System:Windows 7 Compiler: Visual Studio 2013 x64 Package used (Python/R/Scala/Julia):Cpp-package

Build Options

image

qingyuanxingsi avatar Jan 22 '18 05:01 qingyuanxingsi

i meet the same problem but my error tip is 7>"Running: OpWrapperGenerator.py E:/MxNet/incubator-mxnet/build/Debug/libmxnet.dll" 7>Traceback (most recent call last): 7> File "OpWrapperGenerator.py", line 426, in 7> raise(e) 7>WindowsError: [Error 126] how can i solve this ? thank for much

Rangocold avatar May 03 '18 10:05 Rangocold

@Rangocold Do you have openblas dll registered?

conopt avatar May 03 '18 10:05 conopt

Alright. I have the same problem than explained here. But I would be interested to know how @rococopeach managed to solve the problem! Because I have no idea why openblas can't be found, and if it is really openblas that is the problem...

dmidge8 avatar May 24 '18 18:05 dmidge8

@dmidge8 i give up openblas because i config the environment many days but not work i use mkl final, it works when u cmake , add an item ENABLE_MODULE_MKL is key if u want to use openblas, i find a video may help u https://www.bilibili.com/video/av18047152/

Rangocold avatar May 25 '18 01:05 Rangocold

@Rangocold Thank you for your help! Unfortunately, I still didn't manage to make it work. Except the fact that I didn't include OpenCV during the Cmake (there is the USE_OPENCV that you can turn off if you want to avoid using it). And I confirm, openblas is hard to properly use, it seems... If MKL is the Intel Math Kernel Library, I would rather not use it. But it seems the problem comes from the header file that is not generated, because the python script get stucks with OSError: [WinError 126]. The problem is during the cdll.LoadLibrary. Would it be possible to generate the header file another way?

dmidge8 avatar May 28 '18 15:05 dmidge8

@dmidge8 You have to use some linear algebra library (openblas, MKL or something equivalent) to make it work, because if the header generator can't read the API information from the mxnet dll, it means other programs that depend on mxnet.dll won't work either.

conopt avatar May 28 '18 16:05 conopt

@lx75249 Indeed. But I have Openblas in my path, which is also configured in cmake, and I even tried to put openblas directly in the build\Debug\libmxnet.dll folder, altogether with other possibly missing dlls...

dmidge8 avatar May 28 '18 17:05 dmidge8

Alright, I get it a bit better. Openblas requires some MinGW library to have all its dependencies satisfied. I had to download them and make them available in the path to have them working.

dmidge8 avatar May 28 '18 21:05 dmidge8

Had the same problem, "Cannot open include file: 'mxnet-cpp/op.h". I fixed it by edit output_file_name = "cpp-package/include/mxnet-cpp/op.h", in OpWrapperGenerator.py file.

morsinai77 avatar Dec 11 '18 12:12 morsinai77

Hi, I got the same problem when generating op.h: Windows 10, Mxnet 1.4, MVSC 14, CMake3.10, Cuda9.0 set USE_CPP_PACKAGE=1 BLAS = MKL (installed version from Intel site) Opencv3.42

I ran D:\Paul\libs_sources\mxnet14\cpp-package\scripts>python OpWrapperGenerator.py d:/Paul/libs_sources/mxnet14/build/Release/libmxnet.dll

and got an error:

kernel32 0
dll name to load d:/Paul/libs_sources/mxnet14/build/Release/libmxnet.dll
d:/Paul/libs_sources/mxnet14/build/Release/libmxnet.dll 0
Traceback (most recent call last):
  File "OpWrapperGenerator.py", line 432, in <module>
    raise(e)
  File "OpWrapperGenerator.py", line 426, in <module>
    f.write(patternStr % ParseAllOps())
  File "OpWrapperGenerator.py", line 319, in ParseAllOps
    cdll.libmxnet = cdll.LoadLibrary(sys.argv[1])
  File "C:\Users\dev_admin\AppData\Local\Continuum\anaconda3\envs\Mxnet131GPUPy36\lib\ctypes\__init__.py", line 428, in LoadLibrary
    return self._dlltype(name)
  File "C:\Users\dev_admin\AppData\Local\Continuum\anaconda3\envs\Mxnet131GPUPy36\lib\ctypes\__init__.py", line 349, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found


Do you know how to generate correctly op.h? help please!

kvcuong avatar Dec 21 '18 17:12 kvcuong

You need to put every dependency dll of mxnet.dll in your windows path (and restart visual studio to be sure that the change is applied).

dmidge8 avatar Dec 21 '18 21:12 dmidge8