Why do I get an error when my deployed application tries to access a TIFF image file?

1 view (last 30 days)
I compiled my MATLAB code, that reads TIFF files, into an executable using MATLAB Compiler 4.13 (R2010a). When I run the executable on the target machine I get the following error:
 
??? Invalid MEX-file 'C:\Program Files\MATLAB\MATLAB Compiler Runtime\v713\toolbox\matlab\imagesci\private\rtifc.mexw32': The specified
procedure could not be found.
Error in ==> readtif at 52
Error in ==> imread at 441
Error in ==> TiffShow at 5
MATLAB:invalidMEXFile

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jan 2017
MATLAB uses the third party library libtiff.dll to open TIFF files.
What is happening is that the rtifc.mexw32 calls a procedure from the libtiff.dll file. The right version of this library is shipped with the MCR, but the compiled executable picks up the wrong version of libtiff.dll.
This is because the customer has another version of the library in a system directory, such as:
C:\WINNT\system32
C:\Windows\system
C:\Windows\SysWOW64
C:\Windows\System32
The system directories are always searched before the MCR paths, so this library is picked up before the proper version. To solve this issue, there are two options:
1. Remove the libtiff.dll from the system directory.
However, this is not recommended because other programs may have been using it and put it there (despite it being poor practice to put application DLLs in the system directory). The removal of this will break those programs. There is no way for us to determine which programs put it there and use it.
It should be noted that Windows itself does not require the libtiff.dll library. In fact, most machines will not have libtiff.dll in their system directories and still work fine.
Alternatively,
2. Copy the proper libtiff.dll into the folder where the executable resides. This will ensure the right libtiff.dll is picked up. The right libtiff.dll is located in the following folders:
MCR_ROOT\MCR_VERSION\bin\MCR_ARCH\libtiff.dll
where MCR_ROOT is the directory where the MCR is installed, MCR_VERSION is the MCR version, like v713, and MCR_ARCH is the string representing the architecture of the OS, like 'win32' or 'win64'. You can also find the appropriate DLL in the MATLAB root folders below:
MATLABROOT\bin\MATLAB_ARCH\libtiff.dll

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Products


Release

R2010a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!