apple M1 support

1,405 views
Skip to first unread message

Younghwa Park

unread,
Jan 31, 2022, 4:38:41 PM1/31/22
to ProjectChrono
I want to install projecto chrono using git source files.
But, error encountered.

clang: error: invalid arch name '-arch=native'

make[2]: *** [src/chrono/CMakeFiles/ChronoEngine.dir/core/ChLog.cpp.o] Error 1

make[1]: *** [src/chrono/CMakeFiles/ChronoEngine.dir/all] Error 2



1. What should I type in CMAKE_OSX_ARCHITECTURES in case of apple M1.

2. IRRLICHT_ROOT also does not automatically designate. Can I specify like 

'/opt/homebrew/Cellar/irrlicht/1.8.5'. I think that PATH of brew is diffrent with native mac.

3.MATLAB_SDK_ROOT can be specified like '/Applications/MATLAB_R2021b.app/extern'



Thanks.

Enrique Losoya

unread,
Feb 2, 2022, 9:54:10 PM2/2/22
to ProjectChrono
Hi,

It should be  -arch=arm64  for the M1/M1-Max chips; CMAKE_OSX_ARCHITECTURES=arm64...

You would probably have to change the -AVX optimization flags in CMakeLists to -mcpu=apple-m1 (assuming you have Apple Clang >13.0).

-Enrique 

Colin Vanden Heuvel

unread,
Feb 3, 2022, 6:37:13 AM2/3/22
to ProjectChrono
I suspect that this will be an ongoing issue for a little while, especially if our developers don't have Apple silicon to test on. I've created a GitHub issue to track the progress of the problem; feel free to post your error messages here or there so we can take them into consideration.

Younghwa Park

unread,
Feb 9, 2022, 3:43:16 PM2/9/22
to ProjectChrono

Thanks for the quick issue support. But, I got a mesage with matlab.
How do I have to when I need MATLAB?
I think that some file that include some dyanmic lilbrary for matlab trying to compile for x86_64 arch.
I am using apple m1 silicon.


ld: warning: ignoring file /Applications/MATLAB_R2021b.app/extern/../bin/maci64/libeng.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Applications/MATLAB_R2021b.app/extern/../bin/maci64/libmat.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /Applications/MATLAB_R2021b.app/extern/../bin/maci64/libmx.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"_engClose", referenced from:
chrono::ChMatlabEngine::~ChMatlabEngine() in ChMatlabEngine.cpp.o
"_engEvalString", referenced from:
chrono::ChMatlabEngine::Eval(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
"_engGetVariable", referenced from:
chrono::ChMatlabEngine::GetVariable(Eigen::Matrix<double, -1, -1, 1, -1, -1>&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
"_engOpen", referenced from:
chrono::ChMatlabEngine::ChMatlabEngine() in ChMatlabEngine.cpp.o
"_engPutVariable", referenced from:
chrono::ChMatlabEngine::PutVariable(Eigen::Ref<Eigen::Matrix<double, -1, -1, 1, -1, -1> const, 0, Eigen::OuterStride<-1> > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
"_engSetVisible", referenced from:
chrono::ChMatlabEngine::SetVisible(bool) in ChMatlabEngine.cpp.o
"_mxCreateDoubleMatrix_800", referenced from:
chrono::ChMatlabEngine::PutVariable(Eigen::Ref<Eigen::Matrix<double, -1, -1, 1, -1, -1> const, 0, Eigen::OuterStride<-1> > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
"_mxDestroyArray_800", referenced from:
chrono::ChMatlabEngine::PutVariable(Eigen::Ref<Eigen::Matrix<double, -1, -1, 1, -1, -1> const, 0, Eigen::OuterStride<-1> > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
chrono::ChMatlabEngine::GetVariable(Eigen::Matrix<double, -1, -1, 1, -1, -1>&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
"_mxGetDimensions_800", referenced from:
chrono::ChMatlabEngine::GetVariable(Eigen::Matrix<double, -1, -1, 1, -1, -1>&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
"_mxGetNumberOfDimensions_800", referenced from:
chrono::ChMatlabEngine::GetVariable(Eigen::Matrix<double, -1, -1, 1, -1, -1>&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
"_mxGetPr_800", referenced from:
chrono::ChMatlabEngine::PutVariable(Eigen::Ref<Eigen::Matrix<double, -1, -1, 1, -1, -1> const, 0, Eigen::OuterStride<-1> > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
chrono::ChMatlabEngine::GetVariable(Eigen::Matrix<double, -1, -1, 1, -1, -1>&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in ChMatlabEngine.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libChronoEngine_matlab.dylib] Error 1
make[1]: *** [src/chrono_matlab/CMakeFiles/ChronoEngine_matlab.dir/all] Error 2
make: *** [all] Error 2

Radu Serban

unread,
Feb 9, 2022, 4:54:18 PM2/9/22
to ProjectChrono

I suspect the Matlab library you have includes code for x86_64.   A quick Google search indicates that Mathworks is still working on a native version for Apple Silicon. 

In any case, you can easily check that running the ‘file’ command on the libeng.dylib.

I don’t think you can mix libraries of different architectures, but I have no way of testing this.

 

--Radu

--
You received this message because you are subscribed to the Google Groups "ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email to projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/2ecd1776-5114-438e-8d04-ee7e98700561n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages