Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling mfemm - R2022a Windows #21

Open
pierrepesc opened this issue Nov 22, 2024 · 3 comments
Open

Error compiling mfemm - R2022a Windows #21

pierrepesc opened this issue Nov 22, 2024 · 3 comments

Comments

@pierrepesc
Copy link

pierrepesc commented Nov 22, 2024

Hi,

First time xfemm user. I tried to set up the matlab interface to xfemm by running mfemm_setup(). It started compiling nicely (see below) but then I got an error

>> mfemm_setup()

mex -c -O -D_GLIBCXX_USE_CXX11_ABI=1 -I"../cfemm/fmesher" -I"../cfemm/fmesher/triangle" -I"../cfemm/libfemm" -I"../cfemm/libfemm/liblua" -DCPU86 -DNDEBUG  GCC="$GCC" OPTIMFLAGS="" CXXFLAGS="$CXXFLAGS -std=c++11  -fpermissive" LDFLAGS="$LDFLAGS -static-libstdc++ '-Wl,--no-undefined'" C:\Users\hp\Downloads\xfemm-master\xfemm-master\mfemm\..\cfemm\libfemm\liblua\femmcomplex.cpp -outdir C:\Users\hp\Downloads\xfemm-master\xfemm-master\mfemm\..\cfemm\libfemm\liblua
Building with 'MinGW64 Compiler (C++)'.
MEX completed successfully.

... on and on until I got the following error

mex -c -O -D_GLIBCXX_USE_CXX11_ABI=1 -I"../cfemm/fmesher" -I"../cfemm/fmesher/triangle" -I"../cfemm/libfemm" -I"../cfemm/libfemm/liblua" -DCPU86 -DNDEBUG  GCC="$GCC" OPTIMFLAGS="" CXXFLAGS="$CXXFLAGS -std=c++11  -fpermissive" LDFLAGS="$LDFLAGS -static-libstdc++ '-Wl,--no-undefined'" C:\Users\hp\Downloads\xfemm-master\xfemm-master\mfemm\..\cfemm\libfemm\femmversion.cpp -outdir C:\Users\hp\Downloads\xfemm-master\xfemm-master\mfemm\..\cfemm\libfemm
Building with 'MinGW64 Compiler (C++)'.
Error using mex
C:\Users\hp\Downloads\xfemm-master\xfemm-master\cfemm\libfemm\femmversion.cpp:1:25: fatal error: femmversion.h: No such file or directory
 #include "femmversion.h"

when I looked in C:\Users\hp\Downloads\xfemm-master\xfemm-master\cfemm\libfemm I saw that the file was actually called femmversion.h.in ? I tried to rename it to simply femmversion.h and ran again mfemm_setup but then got this issue (only pasting below the beginning of the error:

Error using mex
In file included from C:\Users\hp\Downloads\xfemm-master\xfemm-master\cfemm\libfemm\LuaInstance.cpp:21:0:
C:\Users\hp\Downloads\xfemm-master\xfemm-master\cfemm\libfemm\femmversion.h:21:28: error: stray '@' in program
 #define FEMM_VERSION_MAJOR @XFEMM_VERSION_MAJOR@

I'm a bit stuck with that, would appreciate a hand.

Thanks

@pierrepesc
Copy link
Author

@reos-rcrozier ?

@reos-rcrozier
Copy link
Contributor

Yes, you need to first run cmake on the cfemm folder to generate this file, then mfemm_setup will work

@pierrepesc
Copy link
Author

pierrepesc commented Dec 3, 2024

Thanks a lot, didn't read the instructions well enough...

So not sure I compiled it correctly as Matlab is consistently crashing when running mexfmesher...

Below is the summary of the cmake

-- Building for: Visual Studio 17 2022
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):      
  Compatibility with CMake < 3.10 will be removed from a future version of   
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax 
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.42.34435.0
-- The CXX compiler identification is MSVC 19.42.34435.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- This is xfemm version 0.0.0-dev...
CMake Warning at fmesher/CMakeLists.txt:6 (find_package):
  By not providing "FindTriangle.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Triangle",
  but CMake did not find one.

  Could not find a package configuration file provided by "Triangle" with any
  of the following names:

    TriangleConfig.cmake
    triangle-config.cmake

  Add the installation prefix of "Triangle" to CMAKE_PREFIX_PATH or set
  "Triangle_DIR" to a directory containing one of the above files.  If
  "Triangle" provides a separate development package or SDK, be sure it has
  been installed.


Using builtin version of triangle...
-- Configuring done (19.2s)
-- Generating done (0.8s)
-- Build files have been written to: C:/repos/xfemm/cfemm

and some info on the crash in matlab :

Abnormal termination:
Access violation
Current Thread: 'MCR 0 interpreter thread' id 808

Stack Trace (from fault):
[  0] 0x000000006f3d97af C:\repos\xfemm\mfemm\xfemm_mex_files_for_win64\mexfmesher.mexw64+00104367 mexfilerequiredapiversion+00095087
[  1] 0x000000006f3db710 C:\repos\xfemm\mfemm\xfemm_mex_files_for_win64\mexfmesher.mexw64+00112400 mexfilerequiredapiversion+00103120
[  2] 0x000000006f3de035 C:\repos\xfemm\mfemm\xfemm_mex_files_for_win64\mexfmesher.mexw64+00122933 mexfilerequiredapiversion+00113653
[  3] 0x000000006f3df756 C:\repos\xfemm\mfemm\xfemm_mex_files_for_win64\mexfmesher.mexw64+00128854 mexfilerequiredapiversion+00119574
[  4] 0x000000006f3c1a58 C:\repos\xfemm\mfemm\xfemm_mex_files_for_win64\mexfmesher.mexw64+00006744 mexFunction+00001224
[  5] 0x00007ffaf2e98149 C:\Program Files\MATLAB\R2022a\bin\win64\libmex.dll+00557385 mexfile::Inspector::needs_upgrade+00027305
[  6] 0x00007ffaf2e9bbf2 C:\Program Files\MATLAB\R2022a\bin\win64\libmex.dll+00572402 MexRetrieveVersion+00011778
[  7] 0x00007ffaf2e9bd67 C:\Program Files\MATLAB\R2022a\bin\win64\libmex.dll+00572775 MexRetrieveVersion+00012151
[  8] 0x00007ffaf2e9bf17 C:\Program Files\MATLAB\R2022a\bin\win64\libmex.dll+00573207 MexRetrieveVersion+00012583
[  9] 0x00007ffaf2e7a2f2 C:\Program Files\MATLAB\R2022a\bin\win64\libmex.dll+00434930 mexUnlock+00016914
[ 10] 0x00007ffaf33cc254                     bin\win64\pgo\m_dispatcher.dll+00639572 Mfh_file::dispatch_file_common+00000168
[ 11] 0x00007ffaf33cba16                     bin\win64\pgo\m_dispatcher.dll+00637462 Mfh_error::lookup+00002546
[ 12] 0x00007ffaf33cc1a5                     bin\win64\pgo\m_dispatcher.dll+00639397 Mfh_file::dispatch+00000045
[ 13] 0x00007ffaf2b81324 C:\Program Files\MATLAB\R2022a\bin\win64\libmwlxemainservices.dll+00332580 mwboost::archive::codecvt_null<wchar_t>::do_always_noconv+00071588
[ 14] 0x00007ffaf2b8f720 C:\Program Files\MATLAB\R2022a\bin\win64\libmwlxemainservices.dll+00390944 mwboost::archive::codecvt_null<wchar_t>::do_always_noconv+00129952

Would you have any suggestions? Could it be linked to the "CMake Warning at fmesher"?

@reos-rcrozier

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants