Build fails on MacOS
yonghuier opened this issue · 7 comments
After I cloned the repository locally, I built by mkdir build && cd build && cmake .. && make,
The information obtained is as follows:
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make[2]: *** [libmpi_.a] Error 1
make[1]: *** [CMakeFiles/mpi_.dir/all] Error 2
make: *** [all] Error 2
I realized that this is a header-only library that I added directly to my cmake project. When I build, a bunch of errors are shown, like:
error: no match for call to '(const mpi::tool::session) (int32_t&)'
43 | else if (variable.bind_type == bind_type::session ) object_ = session (handle);
error: declaration of 'const mpi::tool::session& mpi::tool::performance_variable_handle::session() const' changes meaning of 'session' [-Wchanges-meaning]
error: declaration of 'const mpi::tool::session& mpi::tool::performance_variable_handle::session() const' changes meaning of 'session' [-Wchanges-meaning]
By the way, my computer info as follows:
$ sysctl -a | grep machdep.cpu
machdep.cpu.cores_per_package: 10
machdep.cpu.core_count: 10
machdep.cpu.logical_per_package: 10
machdep.cpu.thread_count: 10
machdep.cpu.brand_string: Apple M1 Pro
my mpi version is :
mpich 4.1.2
Dear Yonghui,
This is just a warning:
error: declaration of 'const mpi::tool::session& mpi::tool::performance_variable_handle::session() const' changes meaning of 'session' [-Wchanges-meaning]
The issue will disappear if you add the -fpermissive
or -Wno-changes-meaning
flags to your project. That being said, I dislike the fact that library emits warnings at all, and will find a better solution in the next release.
Regarding this one:
error: no match for call to '(const mpi::tool::session) (int32_t&)'
43 | else if (variable.bind_type == bind_type::session ) object_ = session (handle);
This is a bug. The handle is an int32_t
whereas the only session constructor accepts a MPI_T_pvar_session
which is not an int32_t
. As a quick workaround you can comment out #define MPI_USE_LATEST
on:
Line 6 in 4cbf8b3
which will disable the lines causing the problem. I will solve this soon, hopefully tonight. The reason it went undetected is because several 4.0+ sections (i.e. tool interface) were written before their implementations were released by the major vendors such as MPICH.
I'm installing Linux and will clear all GCC problems. I will also fix a bunch of linter warnings that emerged with the latest version of resharper and then release a new version. Need a little time.
I built successfully using the method you said earlier, very good work! And thank you very much for such a timely reply!
Hi, when I changed the implementation from mpich 4.1.2 to open-mpi 4.1.6, building the project failed again with the following error:
/Users/wyh/dev/mpi/include/mpi/core/type/data_type.hpp:67:26: error: 'MPI_Type_hvector' was not declared in this scope; did you mean 'MPI_Type_vector'? 67 | MPI_CHECK_ERROR_CODE(MPI_Type_hvector, (count, block_length, stride, that.native_, &native_))
/Users/wyh/dev/mpi/include/mpi/tool/control_variable_handle.hpp:44:94: error: no matching function for call to 'mpi::window::window(int32_t&)' 44 | else if (variable.bind_type == bind_type::window ) object_ = window (handle);
Dear Yonghui, thank you for these.
Please replace MPI_Type_hvector
which was deprecated in MPI 2 (and apparently removed in your case) with MPI_Type_create_hvector
. I will also fix this in the main repository. See this for more info:
https://www.mpi-forum.org/docs/mpi-2.2/mpi22-report/node327.htm
Regarding the second, you can take out the complete if statement there until I find a fix (and of course not use .object_). I think it is safe to say the bind variants do not work in the portable way that I wished them to.
I will fix both of these in the main repository along with the earlier changes.
Please keep it coming.
The majority of the problems are fixed in the develop branch. MPI_T_BIND_MPI_SESSION still appears to be unimplemented by most vendors hence may cause problems. I am working on a fix.
Very very well! Thanks!