You are here

ARM64 Apple M1Error compiling Rosetta with extras=mpi

6 posts / 0 new
Last post
ARM64 Apple M1Error compiling Rosetta with extras=mpi
#1

I'm trying to build Rosetta-3.13 "rosetta.source.release-334" with the following command:

./scons.py mode=release bin extras=mpi

I have also updated the site.settings file to prepend the mpicxx and mpicc compilers for openmpi installed in my system.

I got the following error:

ld: warning: ignoring file /opt/programs/openmpi/4.1.4/lib/libmpi.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64

.... lots of lines...

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

scons: *** [build/src/release/macos/10.16/64/x86/clang/14.0/mpi/libutility.dylib] Error 1

scons: building terminated because of errors.

I successfully built the same release without extras=mpi. So it looks like the problem is with my openmpi compiler.

I did installed the OpenMPI v.4.1.4 without using homebrew/macports. I downloaded the source binaries from openmpi.org and installed it using the following command:

./configure --prefix=/opt/programs/openmpi/4.1.4 

and used the GCC pre-installed with Xcode (which looks to be a Clang version).

I have no clue on how to troubleshoot this. Don't know if the problem is with any kind of compatibility with my instalation of openmpi and the new Apple M1 chip. Any ideas?

Thanks,

Danilo.

 

Category: 
Post Situation: 
Fri, 2023-01-27 13:46
dfcoelho

An uptade about this.

I recompiled the OpenMPI with the following command, to ensure compatibility with Apple M1:

./configure --prefix=/opt/programs/openmpi/4.1.4 --build=arm64-apple-darwin21.6.0

After make install, I tried to build rosetta-3.13 "rosetta.source.release-334" with the following command, also to try ensuring  proc compatibility:

./scons.py bin mode=release extras=mpi -j8 arch=arm build=apple-darwin21.6.0

 Weirdly I've got the following error:

scons: Reading SConscript files ...
Traceback (most recent call last):
  File "/opt/programs/rosetta/3.13/rosetta.source.release-334/main/source/SConstruct", line 183, in main
    build = SConscript("tools/build/setup.py")
  File "/opt/programs/rosetta/3.13/rosetta.source.release-334/main/source/external/scons-local/scons-local-3.0.4/SCons/Script/SConscript.py", line 667, in __call__
    return method(*args, **kw)
  File "/opt/programs/rosetta/3.13/rosetta.source.release-334/main/source/external/scons-local/scons-local-3.0.4/SCons/Script/SConscript.py", line 604, in SConscript
    return _SConscript(self.fs, *files, **subst_kw)
  File "/opt/programs/rosetta/3.13/rosetta.source.release-334/main/source/external/scons-local/scons-local-3.0.4/SCons/Script/SConscript.py", line 285, in _SConscript
    call_stack[-1].globals)
  File "/opt/programs/rosetta/3.13/rosetta.source.release-334/main/source/tools/build/setup.py", line 451, in <module>
    build = setup()
  File "/opt/programs/rosetta/3.13/rosetta.source.release-334/main/source/tools/build/setup.py", line 441, in setup
    build.options_requested, build.options = setup_build_options()
  File "/opt/programs/rosetta/3.13/rosetta.source.release-334/main/source/tools/build/setup.py", line 140, in setup_build_options
    supported, actual.os, requested.arch
  File "/opt/programs/rosetta/3.13/rosetta.source.release-334/main/source/tools/build/setup_platforms.py", line 194, in select_arch
    raise ValueError("Actual processor architecture '%s' does not match requested version '%s'" % (actual, requested))

ValueError: Actual processor architecture 'x86' does not match requested version 'arm'

So it looks like the setup_platforms.py is getting the wrong arch for my system.

Still no success to compile with MPI. Any help?

Wed, 2023-02-01 13:33
dfcoelho

Just to make sure about the arch of my chip, the output for the command uname -a is as follow:

Darwin Kernel Version 21.6.0: Sun Nov  6 23:29:57 PST 2022; root:xnu-8020.240.14~1/RELEASE_ARM64_T8101 arm64

So, indeed the arch is arm64 and not x86 as the Rosetta setup_platforms.py seems to find.

Wed, 2023-02-01 13:18
dfcoelho

To some extent, the important thing is what Python thinks the platform is, rather than the command line.

In particular, setup_platforms.py uses whatever `import platform; platform.processor()` returns (either that or `os.uname()[4]`) -- if the python you're running the Rosetta complilation off of thinks the platform is "x86", then that's probably what the setup_platforms.py is going to go with.

You can try using a different python (one which is arm64 native), or you can try monkey-patching the `_get_arch()` function in setup_platforms.py to just return `arm` regardless of what Python thinks the platform is.

Mon, 2023-02-06 14:52
rmoretti

Hi Moretti,

Thanks for your response. I will try your suggestions and let you know if worked or not.

Best,

Danilo.

Thu, 2023-02-09 10:54
dfcoelho

Hi all,

Sorry for the late reply. I had some personal issues but finally I've got time to take a look into this compilation.

What I have found is that in the macOS enviroment there are different Python versions, all of them pre-installed by Apple (I did not install any of them).

The current working version (i.e. the one first defined in the $PATH) is a version of python2/python2.7 which is natively installed in /Library/Frameworks/Python.framework/Versions/2.7/bin and put in my bash env automatically by Apple; my .bash_profile has the following lines, also not included by me:.

# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

This pre-defined is the python that was giving me problem with misleading the actual arch of the chip.

Meanwhile, I also found another python version pre-installed in /usr/bin/python3.

So, I guessed that for some reason the Aple version of python2.7 is not arm64 native, as pointed out by Moretti.

Tried to recompile using python3 and it worked flawlessly. 

 

Thanks for all suport.

 

Best,

Danilo

Sun, 2023-03-05 17:07
dfcoelho