Cannot Compile MatConvNEt

236 views
Skip to first unread message

alaa elhelaly

unread,
Sep 29, 2018, 2:59:23 PM9/29/18
to MatConvNet: CNNs for MATLAB
I am still at the beginning and I receive the following message while compiling:

Error using vl_compilenn>check_clpath (line
656)
Unable to find cl.exe

Error in vl_compilenn (line 426)
    cl_path = fileparts(check_clpath()); %
    check whether cl.exe in path

Please advise

rbe...@aucklanduni.ac.nz

unread,
Jan 31, 2019, 6:00:22 PM1/31/19
to MatConvNet: CNNs for MATLAB
Hello,

I know this is late but found a solution. Hopefully you fixed this yourself a while ago. Either way, I hope this will be helpful for people finding this now (as it appears at the top of the message search).

Okay, this solution applies to those that have installed Microsoft Visual Studio (2015 or later). I took a brief look at vl_compilenn, and noticed that for me, the program was looking for cl.exe in a folder that didn't exist...

Here is the function itself:
function cl_path = check_clpath()
% --------------------------------------------------------------------
% Checks whether the cl.exe is in the path (needed for the nvcc). If
% not, tries to guess the location out of mex configuration.
cc
= mex.getCompilerConfigurations('c++');
cl_path
= fullfile(cc.Location, 'VC', 'bin', 'amd64');
[status, ~] = system('cl.exe -help');
if status == 1
 
% Add cl.exe to system path so that nvcc can find it.
  warning
('CL.EXE not found in PATH. Trying to guess out of mex setup.');
  prev_path
= getenv('PATH');
  setenv
('PATH', [prev_path ';' cl_path]);
  status
= system('cl.exe');
 
if status == 1
    setenv
('PATH', prev_path);
    error
('Unable to find cl.exe');
 
else
    fprintf
('Location of cl.exe (%s) successfully added to your PATH.\n', ...
      cl_path
);
 
end
end

I have Visual Studio Community and the folder specified in cl_path doesn't exist.

So the simple fix for me was to copy cl.exe (where you can find it depends on your installation of Visual Studio) into a new directory. Alternatively, you can alter your cl_path variable (either in code or by altering your mex configuration) to point to an existing folder with cl.exe in it.
Reply all
Reply to author
Forward
0 new messages