MATLAB Invalid MEX File - macos

So I'm running software I downloaded for analyzing the position of fluorescent proteins in microscopy images. The software is called plusTipTracker, and it runs off MATLAB.
So the first function (detecting 'spots' in the images) works fine, but the second function ("track spots") fails. In particular, it seems to be an error with a MEX file:
??? Invalid MEX-file
'/Users/ethanbuchman/Documents/MATLAB/plusTipTracker_1pt1pt3_2012-07-07/software/createDistanceMatrix.mexmaci64':
dlopen(/Users/ethanbuchman/Documents/MATLAB/plusTipTracker_1pt1pt3_2012-07-07/software/createDistanceMatrix.mexmaci64,
1): no suitable image found. Did find:
/Users/ethanbuchman/Documents/MATLAB/plusTipTracker_1pt1pt3_2012-07-07/software/createDistanceMatrix.mexmaci64:
unknown required load command 0x80000022.
I can locate this file in the software folder i downloaded. There are actually multiple versions, each with a different extension (eg. .mexa64, .mexmaci, .mexmaci64, etc.). There's also a .dll file. While there are other mex files in the folder, each with multiple extensions, none of the others have an associated dll file. Not sure if that's relevant.
But I have no idea what to do about this.
Im on MacOSX 10.5.8 using Matlab R2010b.
Any insight would be greatly appreciated. Thanks.

From what I'm reading here, it seems like the MEX file was compiled for a different version of Mac OS. Can you recompile the MEX files and DLL on your own system?

Related

wxwidgets platform.h error: no such file or directory wx/setup.h

I am using Code::Blocks with wxwidgets and I have include and lib folders under Document\wxwidgets. I am very new to c++ libraries. In Code::Blocks project initialization, I entered the location for wxwidgets. Then in setting/global enviornment variables I entered in base the Document\wxwidgets again. Still, I am not able to run the app. It shows the error in the include/wx/platform.h file where it says
C:\Users\Programming coder\Documents\wxwidgets\include\wx\platform.h|148|fatal error: wx/setup.h: No such file or directory|
I am not able to solve this and would appreciate some help. Also I checked and the wx folder does not seem to be there in the location. I don't know if that is normal.
Also, I downloaded the headers(include) from the wxwidgets github repo download page, wxWidgets-3.1.1-headers.7z. Any help appreciated.
Also, I am aware some questions exist already, but their problems are in different because most are using linux. Also I am using Code::Blocks IDE.
You need to build wxWidgets itself before building the applications using it. Its build process will create the setup.h file which is currently missing.
Note that, in principle, you could also use precompiled binaries, but in this case you must use exactly the same compiler as was used for compiling them, i.e. TDM gcc.

Dependency Walker parent import function list shows functions from a different lib

I am trying to include a external library (.lib pointing to a .dll) in my project. I am building on windows using QT (it appears to be using msvc2010 as the compiler) and have: LIBS += <path>/<libraryName>.lib in my .pro file. I have the corresponding .dll file in the directory where the executable is output so it can be found. When the program is run I get the following from QT:
Starting (program name)...
The program has unexpectedly finished.
(program name) exited with code -1073741515
Searching around it seems this type of error can come from .dll files being different in some way than you expect, which seems to be at least partially the problem here. When I open my program with dependency walker I can see that my .dll file found and the functions in it look to be correct as far as I can tell. However in the parent import function pane the functions do not agree or look correct (I think why I am getting my error). These function definitions exactly match the functions from another external library that I am using.
To me this indicates that somehow the .lib file is incorrect, however I have used this pair of .lib/.dll files before in a different program (not built in QT) and they worked fine. Also I have tried removing the reference to the .lib file from my .pro file and the correct functions calls complain (the ones from this library defined in the .dll file that is found). The .lib file looks exactly how I would expect it too using Dumpbin.exe /EXPORTS to view its content.
Any thoughts on what dependency walker is trying to tell me or what I should be trying now would be awesome.
edit 2/8: I have constructed a minimal example. It stops with the same error however in dependency walker instead of showing the functions from another library it shows no expected functions.
Looking at the explanation given for your minimal example it would seem what is happening here is that there are no MinGW function calls for the library (they are all MSVC calls). The functions found in the libraries are listed correctly because they are, just not being linked form the other compiler. As for why different libraries functions are showing up, I would guess its a bug in dependency walker.

How to compile opencv 245 with visual studio 2010 and openCL support?

I have much trouble compiling OpenCV 245 with GPU support. With some effort I managed to have cuda support up and running, but now I am stuck on opencl, here is the problem:
At some point during the compilation, the file kernels.cpp is generated, containing all kernel functions as strings. For what I understand, they are converted automatically from the .cl files with the cl2cpp.cmake script.
What I don't understand is that one file is excluded from the build: nonfree_surf.cl (which is on my disk, alongside all other .cl files) is not included, either in the visual studio project, or in the kernels.cpp that is automatically generated. This leads to an undefined error at link time.
I have tried manually adding the nonfree_surf.cl to the visual studio project. This does not change anything. In the CMakeLists.txt for ocl module, all the cl files seem to be automatically added with the line:
file(GLOB CL_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/kernels/*.cl")
I have tried manually adding nonfree_surf to CL_FILES, with no effect.
I have very little knowledge of CMake, hence I don't understand well what is going on. Can somebody give me a clue how I could find the reason of this behavior, namely:
Why are all .cl files added to my VS project, except nonfree_surf.cl ?
How can I correct this ?
Maybe I can execute cl2cpp.cmake script manually ? If so, how ?
Managed it by manually running the script:
cmake -DOUTPUT_PATH=c:/opencv/kernels2.cpp -DCL_DIR:PATH=c:/opencv/modules/ocl/src/kernels -P "c:\opencv\modules\ocl\cl2cpp.cmake"
For some reason (probably the same that makes nonfree_surf not be processed), not every necessary function are processed this way, so I juste copy-pasted the nonfree_surf string into kernels.cpp, and proceeded with the build.
If anyone needs the binaries, since they are a pain to compile, here they are:
Opencv 2.4.5 binaries compiled with VS2010 x86 (WIN32) including ocl and gpu library.

Reusing OpenCV 2.3.1 bundled image Stitching module

I am lost in a rabbit hole, please bear with me.
I'm trying to use the OpenCV Stitching module from the 2.3.1 Win superpack distribution. I dragged all the source files in /modules/stitching into a Visual Studio project, resolved the Includes and Libs as best I could, and got it to compile.*
The first strange runtime error I had was that I could not read a JPG file from disk with imread(). It did not throw an error, but was returning true for myImage.empty(). I reverted to cvLoadImage() and then it worked.
Now, after that, there is a new runtime error:
Unhandled exception at 0x00870d8f in MyStitcher.exe: 0xC0000005: Access violation writing location 0x010e7000.
This occurs in /modules/stitching/matchers.cpp when trying to pass reference to features.keypoints as a detector_->detect() argument. I assume detect() is supposed to populate the keypoints with its result. features appears to be uninitialized (it has 612933850 empty keypoints at the breakpoint). Now this is starting to sound like the source I'm trying to compile is just broken, but opencv_stitching.exe that comes prebuilt works just fine. Was it compiled from different source?
By the way, I do not know how to use the CMake system to generate Visual Studio projects, as recommended, for OpenCV. The CMakeLists.txt file in the /modules/stitching folder did not work. Is it not supposed to be used as a starting point?
*One note on this: CMakeLists.txt in /modules/stitching specifies some
libs named opencv_core, opencv_imgproc, opencv_highgui, etc. (without
a version indication) but the libs included with OpenCV 2.3.1 Win32
superpack (which I'm linking to) are named opencv_core231.lib,
opencv_imgproc231.lib, etc. Is this a clear indication that I am using
mismatched binaries for the stitching module?
I got this working after building the latest from the OpenCV SVN. The stitching module came a long way since the 231 release.

Problem with Boost::Asio for C++

For my bachelors thesis, I am implementing a distributed version of an algorithm for factoring large integers (finding the prime factorisation). This has applications in e.g. security of the RSA cryptosystem.
My vision is, that clients (linux or windows) will download an application and compute some numbers (these are independant, thus suited for parallelization). The numbers (not found very often), will be sent to a master server, to collect these numbers. Once enough numbers have been collected by the master server, it will do the rest of the computation, which cannot be easily parallelized.
Anyhow, to the technicalities. I was thinking to use Boost::Asio to do a socket client/server implementation, for the clients communication with the master server. Since I want to compile for both linux and windows, I thought windows would be as good a place to start as any. So I downloaded the Boost library and compiled it, as it said on the Boost Getting Started page:
bootstrap
.\bjam
It all compiled just fine. Then I try to compile one of the tutorial examples, client.cpp, from Asio, found (here.. edit: cant post link because of restrictions). I am using the Visual C++ compiler from Microsoft Visual Studio 2008, like this:
cl /EHsc /I D:\Downloads\boost_1_42_0 client.cpp
But I get this error:
/out:client.exe
client.obj
LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-s-1_42.lib'
Anyone have any idea what could be wrong, or how I could move forward? I have been trying pretty much all week, to get a simple client/server socket program for c++ working, but with no luck. Serious frustration kicking in.
Thank you in advance.
The reason the build is failing is because it cannot find the library file containing boost system. Boost includes a "handy" autolinking feature, such that when you include a header file for a binary libaray (as opposed to a header only library), boost automatically tells the compiler that it should link in the library. The downside to this is that boost doesn't tell the compiler where to find the library.
The short answer is to read a little further in the boost getting started guide. This page shows you how to add the necessary flags to the compiler command line: Getting started on windows: linking from the command line.
The first thing you have to do is find the .lib file. Boost hides them in a deep directory structure, so search for it starting in the directory you ran bjam from. Make note of the directory where the file is. You may also wish to use bootstrap --prefix=/some/install/location and bjam install to install boost somewhere other than the source directory in which you built it.
Are you building your project using a Visual Studio solution, or on the command line?
If you are using a solution file, find the link page in the solution properties. There should be a box where you can enter additional library paths. Add the directory in which you boost .lib files reside to this box.
If you are using cl on the command link, familiarize yourself with the command line options for cl and link. You can pass commands to the linker using the cl option /link, and the linker command you are looking for is /libpath.

Resources