Closed ntoex062 closed 3 weeks ago
At a guess, you need to install gcc v11 (the real gcc, not the fake gcc which is an alias for clang by default in OSX). I think you can do it using brew install gcc
.
Verify that it is v11 using gcc --version
, if it isn't then to a web search for how do install this version specifically under Mac OSX. An alternative is to recompile following the instructions on the Wiki, see this page and scroll down to OSX: https://github.com/rcedgar/muscle/wiki/Building-MUSCLE.
Thanks @rcedgar ! The gcc command made the trick !
Re-opening the issue because installing gcc-11 does not seem like a good solution. After poking around on google, it seems that there is no simple solution to creating a MacOS binary that runs on different releases of the O/S without requiring gcc installed. Under Linux, static linking has worked in muscle v3 well despite warnings against this method, but gcc on MacOS does not support this option. Suggestions solicitied!
Hello, we had the same issue, and I know it's not an ideal solution, but installing muscle via conda worked for us
conda install -c bioconda muscle
It's a matter of using a static library, instead of /usr/local/opt/gcc/lib/gcc/11/libgomp.1.dylib to use /usr/local/opt/gcc/lib/gcc/11/libgomp.a A -static option should do the trick (perhaps -static-libstdc++). I hope.
After trying I still had trouble, but this worked:
cd src
mkdir STATIC
cd STATIC
ln -s /usr/local/opt/gcc/lib/gcc/11/*.a .
cd ..
I added -LSTATIC
to two lines in the Makefile, and changed g++ to g++-11:
ifeq ($(OS),Darwin)
CXX := g++-11
endif
CXXFLAGS := $(CXXFLAGS) -O3 -fopenmp -ffast-math -LSTATIC
LDFLAGS := $(LDFLAGS) -O3 -fopenmp -pthread -lpthread -LSTATIC
Typed make, sent the resulting Darwin/muscle to a machine without g++-11 installed and:
% ./muscle -version
muscle 5.1.osx64 []
Built May 20 2022 10:33:54
%
I hope that helps, -Gabo
@rcedgar Firstly, thanks for MUSCLE, I've been a big fan of v3, and only discovered today that you've put out v5. I've read your comments on https://github.com/rcedgar/muscle/wiki/Contributing-to-MUSCLE --- I'm happy to help with packaging for macOS via brew (the appropriate place, imo, would be the brewsci/homebrew-bio repo).
I've successfully cooked up a Homebrew recipe to build muscle from source (at least, it works on my M1 Mac with Monterey 12.6). This uses clang, and links against libomp (this works either dynamically or statically). My CPU usage appropriately peaks to >800% in a small alignment task, so the OpenMP code is working.
Tomorrow night after work, I'll be putting in a draft PR here to start discussing some (minor) changes that I'd like to push back into this repo that make this work, and a draft PR into brewsci/bio shortly afterwards.
My understanding is that the main goal of your Makefile in this repo is to create a statically-linked executable[^1] specifically for the tagged GitHub releases? i.e. so It Just Works™ when people download the build artifact?
[^1]: or as static as possible, in the case of macOS
Yes, exactly. Though with Mac this may not be a good idea, MacOS seems to be more difficult about portability and I haven't tried to systematically understand this so there may be better ways to do the build.
It's a matter of using a static library, instead of /usr/local/opt/gcc/lib/gcc/11/libgomp.1.dylib to use /usr/local/opt/gcc/lib/gcc/11/libgomp.a A -static option should do the trick (perhaps -static-libstdc++). I hope.
After trying I still had trouble, but this worked:
cd src mkdir STATIC cd STATIC ln -s /usr/local/opt/gcc/lib/gcc/11/*.a . cd ..
I added
-LSTATIC
to two lines in the Makefile, and changed g++ to g++-11:ifeq ($(OS),Darwin) CXX := g++-11 endif CXXFLAGS := $(CXXFLAGS) -O3 -fopenmp -ffast-math -LSTATIC LDFLAGS := $(LDFLAGS) -O3 -fopenmp -pthread -lpthread -LSTATIC
Typed make, sent the resulting Darwin/muscle to a machine without g++-11 installed and:
% ./muscle -version muscle 5.1.osx64 [] Built May 20 2022 10:33:54 %
I hope that helps, -Gabo
This got the installer at least started for me. Paths are different (I installed gcc@11 with brew), but created the link and modified the the Makefile. However, I then get the error:
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/lib/libSystem.tbd' for architecture x86_64
I'm on macOS 12.6.2. Seems like maybe an issue with CLT? I don't know, I'm giving up for now.
Any luck getting that brew recipe running @blake-riley?
Re-opening the issue because installing gcc-11 does not seem like a good solution. After poking around on google, it seems that there is no simple solution to creating a MacOS binary that runs on different releases of the O/S without requiring gcc installed. Under Linux, static linking has worked in muscle v3 well despite warnings against this method, but gcc on MacOS does not support this option. Suggestions solicitied!
Agreed, installing gcc11 doesn't seem like the most elegant solution. Has anyone figured out a proper way to statically link the library? Any current workarounds aside from installing gcc11?
Cheers for the ping @shbrainard . I've just put in the PR (#47) for the updated Makefile & GitHub runner.
Once that's merged, I'll put in a PR for an update to the Homebrew recipe. Homebrew will undoubtedly prefer a dynamically linked recipe, and I can simply add libomp to the package requirements (once the above PR is through).
I gave up on gcc@11 compilers for macOS:
-static
always crashes (missing librt.so
), and Apple emphatically states "this would work, but here be dragons"-static-libstdc++
gives a cryptic error [^1] and it's still linked against libstdc++.dylib (!!!) which isn't guaranteed to be on the user's machineI figure that the proper way for macOS is to use the clang compilers, and the corresponding (i.e from LLVM) openmp implementation, libomp. The GitHub Runner image provides Homebrew, so it's pretty easy to install libomp, and reference its static library for linking.
This gives a binary that is dynamically linked against only
[^1]: > ld: warning: direct access in function 'ZnamRKSt9nothrow_t.cold' from file '/usr/local/opt/gcc@11/lib/gcc/11/libstdc++.a(new_opvnt.o)' to global weak symbol 'ZnamRKSt9nothrow_t' from file '/usr/local/opt/gcc@11/lib/gcc/11/libstdc++.a(new_opvnt.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
Cheers for the ping @shbrainard . I've just put in the PR (#47) for the updated Makefile & GitHub runner.
Once that's merged, I'll put in a PR for an update to the Homebrew recipe. Homebrew will undoubtedly prefer a dynamically linked recipe, and I can simply add libomp to the package requirements (once the above PR is through).
I gave up on gcc@11 compilers for macOS:
-static
always crashes (missinglibrt.so
), and Apple emphatically states "this would work, but here be dragons"-static-libstdc++
gives a cryptic error 1 and it's still linked against libstdc++.dylib (!!!) which isn't guaranteed to be on the user's machineI figure that the proper way for macOS is to use the clang compilers, and the corresponding (i.e from LLVM) openmp implementation, libomp. The GitHub Runner image provides Homebrew, so it's pretty easy to install libomp, and reference its static library for linking.
This gives a binary that is dynamically linked against only
- /usr/lib/libSystem.B.dylib
- /usr/lib/libc++.1.dylib both of which are guaranteed (I think?) to be distributed with macOS.
Footnotes
ld: warning: direct access in function 'ZnamRKSt9nothrow_t.cold' from file '/usr/local/opt/gcc@11/lib/gcc/11/libstdc++.a(new_opvnt.o)' to global weak symbol 'ZnamRKSt9nothrow_t' from file '/usr/local/opt/gcc@11/lib/gcc/11/libstdc++.a(new_opvnt.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
Hey, awesome, thanks! I just ran "make" using the dev branch of your fork, and it got farther in the compilation than ever before. It does still throw an error though, which I pasted on the PR page.
Building on @shbrainard's method:
Because homebrew installs gc++11 in a different location to avoid conflicts with clang, the make file needs to point at the homebrew directory.
Running these commands inside the src directory worked to install muscle on Apple M2 Max Ventura 13.4.1
brew install gcc@11
ln -s /opt/homebrew/bin/gcc-11 /opt/homebrew/bin/gcc
make
Ok here is a way that I found that solves this issue on Mac silicon chip. Not ideal obviously but hey if it works right?
Install homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install gcc@11 brew install gcc@11
In finder (or in terminal if you are more computer literate or have more patience than me)
Find /opt/homebrew/opt/gcc/lib/gcc
Open a separate tab in finder.
In this separate tab, find /opt/homebrew/opt/gcc@11/lib/gcc
Duplicate the file called 11 in this separate tab and move that to /opt/homebrew/opt/gcc/lib/gcc
Run muscle5
Hope this helps someone!
I didn't need to do anything beyond brew install gcc@11
and then run make
in the src/
folder. Hopefully it was this easy for others! Perhaps the docs can be updated if this works for more than just me (from here https://github.com/rcedgar/muscle/archive/refs/tags/5.1.0.tar.gz).
@tfalkarkea i had a bunch of errors after gcc@11
Error: Failure while executing; /usr/bin/env cp -pR /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/. /usr/local/Cellar/gmp
exited with 1. Here's the output:
cp: /usr/local/Cellar/gmp/./6.3.0: Permission denied
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0: unable to copy extended attributes to /usr/local/Cellar/gmp/./6.3.0: Permission denied
cp: /usr/local/Cellar/gmp/./6.3.0/COPYING.LESSERv3: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/.brew: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/.brew: unable to copy extended attributes to /usr/local/Cellar/gmp/./6.3.0/.brew: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/.brew/gmp.rb: No such file or directory
cp: utimensat: /usr/local/Cellar/gmp/./6.3.0/.brew: No such file or directory
cp: chown: /usr/local/Cellar/gmp/./6.3.0/.brew: No such file or directory
cp: chmod: /usr/local/Cellar/gmp/./6.3.0/.brew: No such file or directory
cp: chflags: /usr/local/Cellar/gmp/./6.3.0/.brew: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/.brew: unable to copy ACL to /usr/local/Cellar/gmp/./6.3.0/.brew: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/ChangeLog: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/AUTHORS: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/include: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/include: unable to copy extended attributes to /usr/local/Cellar/gmp/./6.3.0/include: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/include/gmpxx.h: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/include/gmp.h: No such file or directory
cp: utimensat: /usr/local/Cellar/gmp/./6.3.0/include: No such file or directory
cp: chown: /usr/local/Cellar/gmp/./6.3.0/include: No such file or directory
cp: chmod: /usr/local/Cellar/gmp/./6.3.0/include: No such file or directory
cp: chflags: /usr/local/Cellar/gmp/./6.3.0/include: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/include: unable to copy ACL to /usr/local/Cellar/gmp/./6.3.0/include: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/README: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/COPYING: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/NEWS: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/lib: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/lib: unable to copy extended attributes to /usr/local/Cellar/gmp/./6.3.0/lib: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/lib/libgmpxx.4.dylib: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/lib/pkgconfig: unable to copy extended attributes to /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig/gmp.pc: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig/gmpxx.pc: No such file or directory
cp: utimensat: /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig: No such file or directory
cp: chown: /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig: No such file or directory
cp: chmod: /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig: No such file or directory
cp: chflags: /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/lib/pkgconfig: unable to copy ACL to /usr/local/Cellar/gmp/./6.3.0/lib/pkgconfig: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/lib/libgmp.a: No such file or directory
cp: symlink: libgmp.10.dylib: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/lib/libgmpxx.a: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/lib/libgmp.10.dylib: No such file or directory
cp: symlink: libgmpxx.4.dylib: No such file or directory
cp: utimensat: /usr/local/Cellar/gmp/./6.3.0/lib: No such file or directory
cp: chown: /usr/local/Cellar/gmp/./6.3.0/lib: No such file or directory
cp: chmod: /usr/local/Cellar/gmp/./6.3.0/lib: No such file or directory
cp: chflags: /usr/local/Cellar/gmp/./6.3.0/lib: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/lib: unable to copy ACL to /usr/local/Cellar/gmp/./6.3.0/lib: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/share: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/share: unable to copy extended attributes to /usr/local/Cellar/gmp/./6.3.0/share: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/share/info: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/share/info: unable to copy extended attributes to /usr/local/Cellar/gmp/./6.3.0/share/info: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/share/info/gmp.info-1: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/share/info/gmp.info: No such file or directory
cp: /usr/local/Cellar/gmp/./6.3.0/share/info/gmp.info-2: No such file or directory
cp: utimensat: /usr/local/Cellar/gmp/./6.3.0/share/info: No such file or directory
cp: chown: /usr/local/Cellar/gmp/./6.3.0/share/info: No such file or directory
cp: chmod: /usr/local/Cellar/gmp/./6.3.0/share/info: No such file or directory
cp: chflags: /usr/local/Cellar/gmp/./6.3.0/share/info: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/share/info: unable to copy ACL to /usr/local/Cellar/gmp/./6.3.0/share/info: No such file or directory
cp: utimensat: /usr/local/Cellar/gmp/./6.3.0/share: No such file or directory
cp: chown: /usr/local/Cellar/gmp/./6.3.0/share: No such file or directory
cp: chmod: /usr/local/Cellar/gmp/./6.3.0/share: No such file or directory
cp: chflags: /usr/local/Cellar/gmp/./6.3.0/share: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0/share: unable to copy ACL to /usr/local/Cellar/gmp/./6.3.0/share: No such file or directory
cp: utimensat: /usr/local/Cellar/gmp/./6.3.0: No such file or directory
cp: chown: /usr/local/Cellar/gmp/./6.3.0: No such file or directory
cp: chmod: /usr/local/Cellar/gmp/./6.3.0: No such file or directory
cp: chflags: /usr/local/Cellar/gmp/./6.3.0: No such file or directory
cp: /private/tmp/homebrew-unpack20240709-99750-h748gs/gmp/./6.3.0: unable to copy ACL to /usr/local/Cellar/gmp/./6.3.0: Permission denied
cp: utimensat: /usr/local/Cellar/gmp/.: Permission denied
I am installing it on MacOS
installing how? what are instructions for reproducing this problem? first error is permission denied, are you executing the command as root or using sudo? does the error reproduce on a "clean" OSX install, e.g. by launching an OSX instance on AWS?
Hi there,
I'm a maintainer of brewsci/bio. I've updated muscle to 5.1.0. The Homebrew's binary called "bottle" is now available.
I used clang++
instead of gcc-11
and added -L/opt/homebrew/opt/libomp/lib -lomp -std=c++11
to CXXFLAGS
(-fopenmp
was removed) to compile muscle on macOS (both Apple silicon and Intel).
One can install muscle 5.1.0 with brew install brewsci/bio/muscle
.
Can you help out ? I just tried to execute Muscle on a fresh MacOS installation (version 12.1; dev tools enabled).