vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 753 forks source link

Having problem in MatConvNet when compiling #650

Open mm5223 opened 8 years ago

mm5223 commented 8 years ago

Using R2016a in 64-bit Win7, and installed Microsoft Visual Studio 2015.

I was trying to install and compile MatConvNet library for CPU but I had some problem on compiling step. I follow the instructions in this website: http://www.vlfeat.org/matconvnet/install/

So the first step is Make sure that MATLAB is configure to use your compiler:

I tried "mex -setup" in command window and got MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.

When I tried to conduct second step

cd < MatConvNet > addpath matlab vl_compilenn

I got the error: 'cl.exe' is not recognized as an internal or external command, operable program or batch file.

Error using vl_compilenn>check_clpath (line 577) Unable to find cl.exe Error in vl_compilenn (line 400) check_clpath(); % check whether cl.exe in path Error in run (line 96) evalin('caller', [script ';']);

I have tried: add the path of visual studio cl.exe or copy the cl.exe file to MatConvNet download file

Anyone knows how to solve the problem?

Many thanks

Mei

hfarhidzadeh commented 8 years ago

Follow this http://stackoverflow.com/questions/32091593/cannot-install-windows-sdk-7-1-on-windows-10

mm5223 commented 8 years ago

@hamidfarhid So, it might cause by SDK being installed incorrectly?

mm5223 commented 8 years ago

I type "mex -setup" in Matlab command line and I got the following coomand:

MEX configured to use 'MinGW64 Compiler (C)' for C language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.

To choose a different C compiler, select one from the following: MinGW64 Compiler (C) mex -setup:C:\Users\Amir\AppData\Roaming\MathWorks\MATLAB\R2016a\mex_C_win64.xml C Microsoft Visual C++ 2015 Professional (C) mex -setup:'C:\Program Files\MATLAB\R2016a\bin\win64\mexopts\msvc2015.xml' C

Does this mean I am fine to use 64bit C/C++ compiler?

hfarhidzadeh commented 8 years ago

@mm5223 I am not sure, But when I followed that link, I could use SDK C++, and it worked fine. In compilers list, I have SDK and choose it for mexing

sofeikov commented 8 years ago

Hi, I know it an old topic,

but I had the same issue and it resolved by adding cl.exe path to system variable path, not to matlab path.

Something like this:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64

Moreover, most likely, you were not able to compile matconvnet with gpu support using MinGW, seems like it is only compiled normally with Microsoft Visual Studio compilers.

mm5223 commented 8 years ago

When I change to other beta like beta13 or beta17, it comes out another issue. "error: 'builtin_ia32_phaddw128' was not declared in this scope return (m128i) builtin_ia32_phaddw128 ((v8hi)X, (v8hi)__Y); something like this Did any one encounter before?

colinfernandes87 commented 6 years ago

the problem is with the visual studio setup folder layout

The matconvnet 'vl_compilenn' is trying to find for cl.exe in 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\bin\amd64\'. which has changed with new setup of visual studio.

If you have installed latest versions of Visual studio try searching for the 'cl.exe' in the subfolders below 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC'

eg: when i searched 'cl.exe' ; i found it under 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\Hostx86\x86'

so for above path i replace the variable 'cl_path' in 'vl_compilenn' line 646 (function- check_clpath) from --> cl_path = fullfile(cc.Location, 'VC', 'bin', 'amd64'); (in matconvnet beta 25) to --> cl_path = fullfile(cc.Location, 'VC', 'Tools','MSVC','14.13.26128','bin','Hostx64','x64');

let me know if it works

deniszhangqu commented 6 years ago

@colinfernandes87 your method works very well. thanks

Automatik commented 5 years ago

@colinfernandes87 's solution worked for me too. Remind to change in the path the version '14.13.26128' to your current version. And before trying again with vl_compilenn run mex -setup and mex -setup C++

davidsmithwj commented 5 years ago

@colinfernandes87 's method works!!! That great!!! many thanks!!. It is the easiest way to solve this problem.

yingtian991221 commented 5 years ago

the problem is with the visual studio setup folder layout

The matconvnet 'vl_compilenn' is trying to find for cl.exe in 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\bin\amd64'. which has changed with new setup of visual studio.

If you have installed latest versions of Visual studio try searching for the 'cl.exe' in the subfolders below 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC'

eg: when i searched 'cl.exe' ; i found it under 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\Hostx86\x86'

so for above path i replace the variable 'cl_path' in 'vl_compilenn' line 646 (function- check_clpath) from --> cl_path = fullfile(cc.Location, 'VC', 'bin', 'amd64'); (in matconvnet beta 25) to --> cl_path = fullfile(cc.Location, 'VC', 'Tools','MSVC','14.13.26128','bin','Hostx64','x64');

let me know if it works

Thanks so much for your solution! It really works!

og499823 commented 5 years ago

the problem is with the visual studio setup folder layout

The matconvnet 'vl_compilenn' is trying to find for cl.exe in 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\bin\amd64'. which has changed with new setup of visual studio.

If you have installed latest versions of Visual studio try searching for the 'cl.exe' in the subfolders below 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC'

eg: when i searched 'cl.exe' ; i found it under 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\Hostx86\x86'

so for above path i replace the variable 'cl_path' in 'vl_compilenn' line 646 (function- check_clpath) from --> cl_path = fullfile(cc.Location, 'VC', 'bin', 'amd64'); (in matconvnet beta 25) to --> cl_path = fullfile(cc.Location, 'VC', 'Tools','MSVC','14.13.26128','bin','Hostx64','x64');

let me know if it works

Thank you for your reply, It works really well!!!!!! :)

Have a nice day!

yunke-wang commented 5 years ago

the problem is with the visual studio setup folder layout

The matconvnet 'vl_compilenn' is trying to find for cl.exe in 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\bin\amd64'. which has changed with new setup of visual studio.

If you have installed latest versions of Visual studio try searching for the 'cl.exe' in the subfolders below 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC'

eg: when i searched 'cl.exe' ; i found it under 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\Hostx86\x86'

so for above path i replace the variable 'cl_path' in 'vl_compilenn' line 646 (function- check_clpath) from --> cl_path = fullfile(cc.Location, 'VC', 'bin', 'amd64'); (in matconvnet beta 25) to --> cl_path = fullfile(cc.Location, 'VC', 'Tools','MSVC','14.13.26128','bin','Hostx64','x64');

let me know if it works

it works well, thanks!

sautami26 commented 4 years ago

Hello, i am trying to install MatConvNet in Matlab2020a using visual studio 2019 and I am getting the following error: Error using mex data.cpp c1xx: fatal error C1356: unable to find mspdbcore.dll

Error in vl_compilenn>mex_compile (line 583) mex(args{:}) ;

Error in vl_compilenn (line 492) mex_compile(opts, srcs{i}, objfile, flags) ;

Can anybody help me in resolving this error? Please

danielmerinop97 commented 3 years ago

I have the same problem. Some one can help us?

Thank you

PjOnE7 commented 3 years ago

I have the same problem. Some one can help us?

Thank you

Same problem. Have you solved it?

nickdalfarra commented 3 years ago

As mentioned by @colinfernandes87, the problem seems to be from changes in the VS Studio directory structure. I think I've found a workaround. I'm using matconvnet-1.0-beta25 and VS Studio 2019 (Community) on Windows 10 w/ 64-bit processor.

Follow the instructions on the installation page up until the point of running "vl_compilenn". Then make two changes to \matlab\vl_compilenn.m:

Line 426 from --> cl_path = fileparts(check_clpath()); % check whether cl.exe in path to --> cl_path = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64\cl.exe';

Line 646 from --> % cl_path = fullfile(cc.Location, 'VC', 'bin', 'amd64'); to --> cl_path = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64\cl.exe';

Your hard-coded cl_path variable will depend on your hardware. You can find the one that suits your needs following these instructions.

After running vl_testnn, I fail 12 tests and succeed on 1781. I'm not sure if that's a reflection of my fix or some other issue. Hopefully this helps!

PjOnE7 commented 3 years ago

Thanks for ur reply, but I still got ‘clad: fatal error C1356: unable to find mspdbcore.dll’.
I’ve stuck with it for many days.😭