Open weizhi-lin opened 2 years ago
Hi! I suppose you met the error when compiling the code. Could you provide more details like a screenshot? I am not able to test it myself since I do not have an M1 computer. It is neither supported in Github Actions as I know.
Hi, thank you for replying! Attached please find all the information I have when compiling the codes. Thanks!
Warning Messages when compiling the codes in the terminal:
weizhilin@Tobys-MacBook-Air src % make debug
g++ -c ./geodesic_matlab_api.cpp -o ./geodesic_matlab_api.o -Wall -O2 -fPIC -DDEBUG -g
In file included from ./geodesic_matlab_api.cpp:14:
./geodesic_algorithm_subdivision.h:22:3: warning: field 'm_previous' will be initialized after field 'm_distance' [-Wreorder-ctor]
m_previous(NULL),
^~~~
m_distance(0.0)
./geodesic_algorithm_subdivision.h:29:3: warning: field 'm_previous' will be initialized after field 'm_distance' [-Wreorder-ctor]
m_previous(NULL),
^~~~
m_distance(0.0)
In file included from ./geodesic_matlab_api.cpp:15:
./geodesic_algorithm_exact.h:449:19: warning: array subscript is of type 'char' [-Wchar-subscripts]
double x = inter[i];
^~
./geodesic_algorithm_exact.h:452:14: warning: array subscript is of type 'char' [-Wchar-subscripts]
good_start[Ngood_start++] = x;
^~~~~~
./geodesic_algorithm_exact.h:455:12: warning: array subscript is of type 'char' [-Wchar-subscripts]
good_start[Ngood_start++] = right;
^~~~~~
./geodesic_algorithm_exact.h:460:27: warning: array subscript is of type 'char' [-Wchar-subscripts]
double mid = (good_start[i] + good_start[i+1])0.5;
^~
./geodesic_algorithm_exact.h:461:10: warning: array subscript is of type 'char' [-Wchar-subscripts]
mid_map[i] = zero->signal(mid) <= one->signal(mid) ? OLD : NEW;
^~
./geodesic_algorithm_exact.h:565:16: warning: unused variable 'list' [-Wunused-variable]
list_pointer list = interval_list(edge);
^
./geodesic_matlab_api.cpp:37:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^
./geodesic_matlab_api.cpp:45:14: warning: unused variable 'mesh_id' [-Wunused-variable]
std::size_t mesh_id = find_mesh_id(algorithm->mesh());
^
In file included from ./geodesic_matlab_api.cpp:14:
./geodesic_algorithm_subdivision.h:22:3: warning: field 'm_previous' will be initialized after field 'm_distance' [-Wreorder-ctor]
m_previous(NULL),
^~~~~~~
m_distance(0.0
./geodesic_algorithm_subdivision.h:102:22: note: in instantiation of function template specialization 'geodesic::SubdivisionNode::SubdivisionNode<geodesic::Vertex >' requested here
m_nodes.push_back(Node(v)); //!!
^
./geodesic_algorithm_subdivision.h:29:3: warning: field 'm_previous' will be initialized after field 'm_distance' [-Wreorder-ctor]
m_previous(NULL),
^~~~~~~
m_distance(0.0
./geodesic_algorithm_subdivision.h:126:23: note: in instantiation of function template specialization 'geodesic::SubdivisionNode::SubdivisionNode<geodesic::Edge *, double>' requested here
m_nodes.push_back(Node(e, offset));
^
12 warnings generated.
g++ -shared -o ./geodesic_debug.so ./geodesic_matlab_api.o
Error when run example1 in the MATLAB
Error using loadlibrary There was an error loading the library "/Users/weizhilin/Downloads/geodesic_matlab-master/matlab/geodesic_debug.so" dlopen(/Users/weizhilin/Downloads/geodesic_matlab-master/matlab/geodesic_debug.so, 0x0006): tried: '/Users/weizhilin/Downloads/geodesic_matlab-master/matlab/geodesic_debug.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/geodesic_debug.so' (no such file), '/usr/lib/geodesic_debug.so' (no such file)
Error in geodesic_new_mesh (line 9) loadlibrary([geodesic_library '.so'], hfile);
Error in example1 (line 13) mesh = geodesic_new_mesh(vertices,faces); %initilize new mesh
Caused by: Error using loaddefinedlibrary dlopen(/Users/weizhilin/Downloads/geodesic_matlab-master/matlab/geodesic_debug.so, 0x0006): tried: '/Users/weizhilin/Downloads/geodesic_matlab-master/matlab/geodesic_debug.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/geodesic_debug.so' (no such file), '/usr/lib/geodesic_debug.so' (no such file)
Looks like you have finished:
cd src
make debug
cp ./geodesic_debug.so ../matlab/
Can you try:
cd src
make example0
./example0.out hedgehog_mesh.txt 3 14
It is highly possible to be a matlab issue if example0
exits successfully.
Hi, thanks again for your reply. I run the codes. It finished smoothly in the terminal. But when I tried Example1 in the matlab. It gave me the same error.
On Thu, May 19, 2022 at 10:54 PM Zishun Liu @.***> wrote:
Looks like you have finished:
cd src make debug cp ./geodesic_debug.so ../matlab/
Can you try:
cd src make example0 ./example0.out hedgehog_mesh.txt 3 14
It is highly possible to be a matlab issue if example0 exits successfully.
— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/zishun/geodesic_matlab/issues/8*issuecomment-1132502170__;Iw!!LIr3w8kk_Xxm!pJ4aZ7cdGRjFbZ1ujBj5DfhD0fHCSTin60os2AlqRbqZPzJQ07ha93LLdC7YD6-AplqVUjiwISd7-heTorL14bqA$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AN3JERQHDQKDM6IYUUB5PKLVK4SJNANCNFSM5WOFDMLQ__;!!LIr3w8kk_Xxm!pJ4aZ7cdGRjFbZ1ujBj5DfhD0fHCSTin60os2AlqRbqZPzJQ07ha93LLdC7YD6-AplqVUjiwISd7-heTogabybhZ$ . You are receiving this because you authored the thread.Message ID: @.***>
I see. I think the problem happens inside loadlibrary
. We can do nothing with the C++ code here. You may already come up with several potential solutions like
loadlibrary
.Good luck with your work!
I was having the same problem. What happens is that when we compile on M1, we get an arm64 binary, but currently (as of 2023a), Matlab is still x86_64 (even when we install on Apple Silicon).
The workaround, therefore, is to compile in an old Intel Mac, then transfer the geodesic_debug.so file to the newer M1 Mac. I just did that and it worked. If it helps, I'm attaching the file here (gzipped; use at your own risk).
Hi, thank you very much for the wonderful solutions on the geodesic distance computation toolbox. It works with windows and old macOS perfectly. However, I encountered issues with new Apple model with M1 chip. The error was:
"... (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), ..."
I would appreciate it sincerely if you can help with this issue. Many thanks!