Closed oqilipo closed 5 years ago
huh. It might be missing the -DMEX flag. I've also updated the cmakelists.txt so this might be fixed now.
Setup:
I have the same problem. When I compile with Matlab 2017a I get:
Function mexFunction is missing.
When using Matlab 2018b I get:
Gateway function is missing.
I think both errors are actually thrown due to the same reason, i.e. that the main-function of the mex-files is not correctly named (see here).
I already tried updating gptoolbox to the most recent version, but unfortunately that did not help.
What do you mean by
It might be missing the -DMEX flag.
?
Do you mean it is a CMake flag that should be set automatically and it would help to set it automatically? If so, then what kind of Flag is it? Boolean?
Thank you very much.
Perhaps this has something to do with the issue: https://github.com/DIPlib/diplib/issues/13 Unfortunately, I'm not familiar enough with your code and CMake in general to evaluate that myself.
I've made a change in 0121b32 that might fix some of these issues. Could you please try cmake, make again?
Thanks for tackling the problem so fast. Unfortunately, the problem persists for both 2017a and 2018b.
I'm not a windows user so this is difficult to debug. On Mac/linux I would check that the mexFunction
symbol is compiled using:
nm /usr/local/gptoolbox/mex/mesh_boolean.mexmaci64 | grep mexFunction
and see
0000000000022370 T _mexFunction
Is there a windows way to determine what symbols are ending up in the output?
VS2015 offers a tool called dumpbin.exe, which should provide what you are asking for. I attached the output of dumpbin /all C:\dev\gptoolbox\mex\mesh_boolean.mexw64
. Unfortunately, mexFunction
does not seem to occur.
Hmm, well this looks like it's not compiling anything in mesh_boolean.cpp. Are you sure you have the latest version? The first line should be:
and not
I just freshly downloaded everything yesterday. The first line is indeed:
#include <igl/copyleft/cgal/mesh_boolean.h>
could you try deleting cmake/FindMATLAB.cmake and recreating the vs project from cmake?
On Tue, Nov 27, 2018 at 9:28 AM Max Frei notifications@github.com wrote:
I just freshly downloaded everything yesterday. The first line is indeed:
include <igl/copyleft/cgal/mesh_boolean.h>
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alecjacobson/gptoolbox/issues/70#issuecomment-442077397, or mute the thread https://github.com/notifications/unsubscribe-auth/ACI0mR-ZtDxFccRnbl5UmqCDNjvcDn3qks5uzUwEgaJpZM4WFpjH .
Still the same error messages for 2017a as well as 2018a. I attached the new output of dumpbin. output_dumpbin.txt
Same here, after deleting the FindMATLAB.cmake
I'm still thinking this is an error in the FindMATLAB. I checked in a new version 60ceec3 . Could you please try a fresh cmake?
Sorry, still the same error: Gateway function is missing. This time tested on another machine with Windows 10, VS 2017, CMake 3.13.0, Boost 1.68.0, CGAL 4.13, MATLAB 2018b.
OK, we might need somebody with more VS experience. My guess is that this has something to do with the symbol "visibility" settings. MATLAB would like to have all symbols hidden except mexFunction
. My current guess is that even this symbol is somehow being hidden.
By the way: What compilation preset do you recommend? I always used Release. Is that actually correct?
By the way: What compilation preset do you recommend? I always used Release. Is that actually correct?
@maxfrei750 I always try both release and debug, but release should be fine.
By the way, if you only need a specific function of the toolbox, you can try to build it in MATLAB. Check out the attached file: compile_mesh_boolean.zip This still works for me. Let me know if you have any questions.
this could potentially be helpful. If the matlab mex command works, could you run it in verbose mode and send the full compilation command that it prints?
Then also send the compilation command that VS runs. We could compare the flags.
Here is the MATLAB log: mesh_boolean_compile_MATLAB.log This only works by replacing the two files assign_scalar.cpp & assign_scalar.h in ..\libigl\include\igl\copyleft\cgal with the files from the zip file.
The VS log will take some minutes.
(How come you have to comment out those lines in assign_scalar.h? I thought the #ifndef WIN32 would stop them from being compiled on windows already).
From looking at the log I'm guessing /EXPORT:mexFunction
is the key flag that we need during linking. Let's see if the visual studio output has that present.
(How come you have to comment out those lines in assign_scalar.h? I thought the #ifndef WIN32 would stop them from being compiled on windows already).
Sorry, don't know. I reported it here: https://github.com/libigl/libigl/issues/693#issuecomment-388749827
From looking at the log I'm guessing
/EXPORT:mexFunction
is the key flag that we need during linking. Let's see if the visual studio output has that present.
Cmake 1st trial: gptoolbox_cmake_1trial.log
Cmake 2nd trial after disabling eltopo & embree: gptoolbox_cmake_2trial_after_disabling_eltopo_and_embree.log
Debug in VS2015: mesh_boolean_compile_VS2015.log
OK, thanks. Can you try manually adding the /EXPORT:mexFunction
flag in VS ?
A more detailed log of a release build: mesh_boolean_compile_VS2015_release_detailed.log
OK, thanks. Can you try manually adding the
/EXPORT:mexFunction
flag in VS ?
I will try.
OK, thanks. Can you try manually adding the
/EXPORT:mexFunction
flag in VS ?
Wow, that worked.
I've added /EXPORT:mexFunction to:
Properties -> Linker -> Command Line -> Additonal
%(AdditionalOptions) /machine:x64 /EXPORT:mexFunction
Thanks a lot!
Awesome. So now I need to figure out how to get this into the cmake...
Maybe this helps: https://stackoverflow.com/a/11095194 or http://matitk-cmake.blogspot.com/
Thanks, could you give this new cmake a try ca64d68
Yes, works!
(How come you have to comment out those lines in assign_scalar.h? I thought the #ifndef WIN32 would stop them from being compiled on windows already).
Now this issue should not be very important anymore.
great. @maxfrei750 want to also give it a try?
Finally had the time to test it... and it works! Very nice! Thanks you two!
@oqilipo I think we can close this issue.
I''ve created a project for the mex files with CMake 13.12.1 and build it with VS2015 (Win7). Everything worked fine without errors using Boost 1.67 and CGAL 4.12 and the latest version of libigl.
But when I try to test the compiled mex files I receive the following error:
Any help is appreciated.
Thanks in advance