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.
An uptade about this.
I recompiled the OpenMPI with the following command, to ensure compatibility with Apple M1:
After make install, I tried to build rosetta-3.13 "rosetta.source.release-334" with the following command, also to try ensuring proc compatibility:
Weirdly I've got the following error:
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?
Just to make sure about the arch of my chip, the output for the command uname -a is as follow:
So, indeed the arch is arm64 and not x86 as the Rosetta setup_platforms.py seems to find.
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.
Hi Moretti,
Thanks for your response. I will try your suggestions and let you know if worked or not.
Best,
Danilo.
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:.
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
Hello Danilo,
(RESOLVED, SEE POST BELOW)
I'm also attempting to build Rosetta with mpi on an M1 Macbook. I have ran into the same problem as you. I've updated my site.settings to use mpicxx and mpicc. I'm also using the same scons arguments as you. One difference is that I'm using the brew version of mpicxx and mpicc. However, I'm running into the same issue you were having in post #2 of the thread.
It seems you found a solution by chaning the version of python you were using for one specific for arm. However, I'm not sure how you changed the python version being called. Did you change the python being called in your .bash_profile? Or did you change the executable in the scons.py file? Either way, I'm now running into an issues with package installation:
Any help is appreciated :)
Best,
Austin
Update,
I'm attempting to install openmpi and build it with your arguments. However, I don't have a /opt/programs directory, so I tried install to /opt/local/bin. Whenever I try to build, it doesn't show up in /opt/local/bin.
Best,
Austin
Update,
Was able to resolve, inexperience from me. Here's help for any needing it with the same problem.
For openmpi, brew version also didn't work for me. I downloaded the latest openmpi v4. First uncompress with tar -xzvf. Change into the directory of openmpi. Then use configure command, I used (run "uname -a" for build number):
Then run:
Now with rosetta, modify the first line of scons.py to be (resolve the x86 version issue):
Then modify tools/build/site.settings to be (uncomment "cxx" and "cc" lines and point to openmpi executables you just installed):
I then ran:
Best,
Austin