brew install fails on M1 Mac with Monterey and Xcode installed for arm64 arch
tried various options to get it work, but didn't work those.
Other details:
cmake: 3.22.2
clang:
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
autoconf: 2.71
make: 3.81
arch: arm64
lingamoorthi.ankam#LingamorthysMBP ~ % brew install crfsuite
...
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../include -I. -I./include -mfpmath=sse -msse2 -DUSE_SSE -O3 -fomit-frame-pointer -ffast-math -Winline -std=c99 -c src/lookup3.c -fno-common -DPIC -o .libs/libcqdb_la-lookup3.o
error: unknown FP unit 'sse'
error: unknown FP unit 'sse'
make[1]: *** [libcqdb_la-cqdb.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [libcqdb_la-lookup3.lo] Error 1
make: *** [install-recursive] Error 1
lingamoorthi.ankam#LingamorthysMBP ~ %
also in the similar way liblbfgs(crfsuite dependency) also failed, but manually installing it succeeded.
All tools installed are uptodate.
lingamoorthi.ankam#LingamorthysMBP ~ % cmake --version
cmake version 3.22.2
...
lingamoorthi.ankam#LingamorthysMBP ~ % automake --version
automake (GNU automake) 1.16.5
...
lingamoorthi.ankam#LingamorthysMBP ~ % clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
lingamoorthi.ankam#LingamorthysMBP ~ % autoconf --version
autoconf (GNU Autoconf) 2.71
...
lingamoorthi.ankam#LingamorthysMBP ~ % make --version
...
This program built for i386-apple-darwin11.3.0
You might want to try to disable sse2
Here is a suggestion
brew install crfsuite
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 3 taps (homebrew/core, homebrew/cask and brewsci/science).
You have 6 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Downloading https://github.com/downloads/chokkan/crfsuite/crfsuite-0.12.tar.
Already downloaded: /Users/foo/Library/Caches/Homebrew/downloads/3b692f540345f335f203e8aa30a52e7279cba5d08e285130f811a02b565d8c46--crfsuite-0.12.tar.gz
==> Installing crfsuite from brewsci/science
==> ./configure --prefix=/opt/homebrew/Cellar/crfsuite/0.12
==> make install
...
error: unknown FP unit 'sse'
error: unknown FP unit 'sse'
make[1]: *** [libcqdb_la-cqdb.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [libcqdb_la-lookup3.lo] Error 1
make: *** [install-recursive] Error 1
Untar the downloaded crfsuite package
tar xvfz /Users/foo/Library/Caches/Homebrew/downloads/3b692f540345f335f203e8aa30a52e7279cba5d08e285130f811a02b565d8c46--crfsuite-0.12.tar.gz
Configure with disabled sse2 and other flags then make and install
cd crfsuite-0.12
./configure --prefix=$HOME/local --disable-shared --with-pic --disable-sse2
make
make install
Run ./configure --help to get details of parameters
Related
When running ruby-install, it fails to build. This also reported in rbenv issues (https://github.com/rbenv/ruby-build/issues/1725).
for example when installing ruby 2.6.8
# installing via ruby-install ( https://github.com/postmodern/ruby-install )
ruby-install ruby 2.6.8
it results in the following error
ossl_x509store.c:452:30: note: ')' token is here
result = rb_funcall(ctx, rb_intern("verify"), 0);
^~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:1826:56: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
../.././include/ruby/ruby.h:2602:20: note: expanded from macro 'rb_funcall'
rb_funcallv(recv, mid, \
^~~
6 warnings generated.
linking shared-object openssl.bundle
installing default openssl libraries
make[2]: Leaving directory '/Users/xxxxx/src/ruby-2.6.8/ext/openssl'
make[2]: Entering directory '/Users/xxxxx/src/ruby-2.6.8/ext/ripper'
extracting ripper.y from ../.././parse.y
compiling compiler ripper.y
ripper.y:762.9-16: syntax error, unexpected identifier, expecting string
make[2]: *** [Makefile:332: ripper.c] Error 1
make[2]: Leaving directory '/Users/xxxxx/src/ruby-2.6.8/ext/ripper'
make[1]: *** [exts.mk:257: ext/ripper/all] Error 2
make[1]: Leaving directory '/Users/xxxxx/src/ruby-2.6.8'
make: *** [uncommon.mk:286: build-ext] Error 2
!!! Compiling ruby 2.6.8 failed!
seems to be complier issue. first ensure that xcode is installed appropriately. In my case, I had it installed prior but you can opt to reinstall to be sure. hope this helps people save time trying to figure out the issue as compiling it takes several minutes.
# check xcode, should yield : /Library/Developer/CommandLineTools
xcode-select -p
# check xcode, should yield : xcode-select version 2384
xcode-select -v
# install xcode-select
xcode-select --install
# reinstall openssl and version 3
brew reinstall openssl#1.1
# install build dependancies
brew install openssl readline libyaml zlib bison bison#2.7
# ensure build is using bison
export PATH="$(brew --prefix bison#2.7)/bin:$PATH"
# set ruby compilation flags
export CFLAGS="-Wno-error=implicit-function-declaration"
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.1) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml) --with-zlib-dir=$(brew --prefix zlib)"
# install ruby via ruby-install
ruby-install ruby 2.6.8
I had the same issue when I ran the following command: ruby-install ruby 2.6.8 -- --with-openssl-dir=$(brew --prefix openssl#1.1).
I updated bison with brew install bison#2.7 and ran export PATH="$(brew --prefix bison#2.7)/bin:$PATH" to fix ripper. Then, re-running the initial ruby command worked!
My colleague helped me solving this problem with script below:
#!/usr/bin/env bash
set -e
# ruby-install --latest
OPENSSL_VERSION=1.1
OPENSSL_DIR=/usr/local/opt/openssl#${OPENSSL_VERSION}
function install-ruby-on-mac() {
PKG_CONFIG_PATH=${OPENSSL_DIR}/lib/pkgconfig \
ruby-install $(ruby-install-options $1) \
ruby $1 \
-- \
--with-openssl-dir=${OPENSSL_DIR} \
--with-opt-dir=$(brew --prefix readline) \
--without-tcl --without-tk
}
install-ruby-on-mac 2.5.8
install-ruby-on-mac 2.6.8
install-ruby-on-mac 2.7.4
Hope it could help someone.
I can not install any rubies by compiling on Big Sur. I get this:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32,
from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:42,
from random.c:342:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:14: error: variably modified 'bytes' at file scope
193 | char bytes[kAuthorizationExternalFormLength];
| ^~~~~
make: *** [random.o] Error 1
!!! Compiling ruby 2.7.4 failed!
Here is my set up on the ruby-install:
xcode-select version 2384
BASERUBY = /usr/local/opt/ruby#2.7/bin/ruby --disable=gems
CC = gcc
LD = ld
LDSHARED = gcc -dynamiclib
CFLAGS = -O2 -fno-tree-dce -fno-optimize-sibling-calls -Wno-error=implicit-function-declaration -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/x86_64-darwin20 -I./include -I. -I./enc/unicode/12.1.0
CPPFLAGS = -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/readline/include -I/usr/local/opt/libyaml/include -I/usr/local/opt/gdbm/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT
DLDFLAGS = -L/usr/local/opt/bison/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/openssl#1.1/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/gdbm/lib -fstack-protector-strong -pie -framework Security -framework Foundation
SOLIBS = -lpthread -ldl -lobjc
LANG = en_US.UTF-8
LC_ALL =
LC_CTYPE =
MFLAGS =
gcc (Homebrew GCC 11.2.0) 11.2.0
export warnflags=-Wno-error=implicit-function-declaration
export optflags="-w"
rvm install "ruby-2.6.3" --with-out-ext=fiddle
Perform normal installation
I am trying to install Jekyll on macOs and the bundle install command fails while install the ffi gem. Below is the error.
/bin/sh ./libtool --tag=CC --mode=link xcrun clang -arch i386 -Wall -fexceptions -no-undefined
-version-info `grep -v '^#'
/private/var/folders/l7/th5yr79s4q91ln9ycpx4ht5h0000gn/T/bundler20190605-84487-xz6vrpffi-1.11.1/gems/ffi-1.11.1/ext/ffi_c/libffi/libtool-version`
'-arch' 'i386' -arch i386 -o libffi.la -rpath /usr/local/lib src/prep_cif.lo src/types.lo src/raw_api.lo
src/java_raw_api.lo src/closures.lo src/x86/ffi.lo src/x86/sysv.lo
libtool: link: xcrun clang -dynamiclib -o .libs/libffi.7.dylib src/.libs/prep_cif.o src/.libs/types.o
src/.libs/raw_api.o src/.libs/java_raw_api.o src/.libs/closures.o src/x86/.libs/ffi.o src/x86/.libs/sysv.o
-arch i386 -arch i386 -arch i386 -install_name /usr/local/lib/libffi.7.dylib -compatibility_version 9
-current_version 9.0 -Wl,-single_module
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
Undefined symbols for architecture i386:
"___x86.get_pc_thunk.bx", referenced from:
_ffi_call_i386 in sysv.o
_ffi_closure_raw_SYSV in sysv.o
_ffi_closure_raw_THISCALL in sysv.o
"___x86.get_pc_thunk.dx", referenced from:
_ffi_closure_i386 in sysv.o
_ffi_closure_STDCALL in sysv.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libffi.la] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: ***
["/private/var/folders/l7/th5yr79s4q91ln9ycpx4ht5h0000gn/T/bundler20190605-84487-xz6vrpffi-1.11.1/gems/ffi-1.11.1/ext/ffi_c"/libffi-i386/.libs/libffi_convenience.a]
Error 2
make failed, exit code 2
Gem files will remain installed in
/var/folders/l7/th5yr79s4q91ln9ycpx4ht5h0000gn/T/bundler20190605-84487-xz6vrpffi-1.11.1/gems/ffi-1.11.1 for
inspection.
Results logged to
/var/folders/l7/th5yr79s4q91ln9ycpx4ht5h0000gn/T/bundler20190605-84487-xz6vrpffi-1.11.1/extensions/universal-darwin-17/2.3.0/ffi-1.11.1/gem_make.out
An error occurred while installing ffi (1.11.1), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.11.1' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
github-pages was resolved to 198, which depends on
github-pages-health-check was resolved to 1.16.1, which depends on
typhoeus was resolved to 1.3.1, which depends on
ethon was resolved to 0.12.0, which depends on
ffi
try this
$ open /Library/Developer/CommandLineTools/Packages/
then run package
macOS_SDK_headers_for_macOS_10.14.pkg
the answer is reference hereenter link description here,
if this work please give me a vote thanks
I'm running Ruby 2.0.0p645 on a Linux AWS.
I tried running gem install mechanize, but got this error:
Building native extensions. This could take a while...
ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.0 extconf.rb
checking for main() in -lstdc++... no
creating Makefile
make "DESTDIR="
g++ -I. -I/usr/include/ruby/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I. -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -m64 -o unf.o -c unf.cc
make: g++: Command not found
make: *** [unf.o] Error 127
Gem files will remain installed in /path/to/.gem/ruby/2.0/gems/unf_ext-0.0.7.1 for inspection.
Results logged to /path/to/.gem/ruby/2.0/gems/unf_ext-0.0.7.1/ext/unf_ext/gem_make.out
How do I fix this so I can install mechanize on my virtual box?
Looks like you might need to install libstdc++. For Debian or Ubuntu try:
sudo apt-get install build-essential libstdc++6
and then retry installing the gem.
I'm trying to install Ruby 1.9.3 and Rails on MAC OS X Lion. (My Xcode is version 4.3)
(I've installed Rails 3.2.2)
No matter if I use:
rvm install 1.9.3 --with-gcc=clang
or:
rvm install 1.9.3
My terminal shows:
Error running 'make ', please read /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
There has been an error while running make. Halting the installation.
Has anyone encountered the same situation?
AlexHo#Nien-Yi-Hos-MacBook:~$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/AlexHo/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/AlexHo/.rvm/src
Configuring yaml in /Users/AlexHo/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/AlexHo/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/AlexHo/.rvm/usr
Installing Ruby from source to: /Users/AlexHo/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracted to /Users/AlexHo/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring
ruby-1.9.3-p125 - #compiling
Error running 'make ', please read /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
There has been an error while running make. Halting the installation.
AlexHo#Nien-Yi-Hos-MacBook:~$ cat /Users/AlexHo/.rvm/log/ruby-1.9.3-p125/make.log
[2012-03-03 04:15:53] make
CC = clang
LD = ld
LDSHARED = clang -dynamiclib
CFLAGS = -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -fno-common -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I. -I.ext/include/x86_64-darwin11.3.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name /Users/AlexHo/.rvm/rubies/ruby-1.9.3-p125/lib/libruby.1.9.1.dylib -current_version 1.9.1 -compatibility_version 1.9.1 -Wl,-unexported_symbol,_Init_* -Wl,-unexported_symbol,*_threadptr_* -Wl,-u,_objc_msgSend
SOLIBS =
linking miniruby
rbconfig.rb unchanged
generating enc.mk
generating prelude.c
compiling prelude.c
linking static-library libruby.1.9.1-static.a
linking shared-library libruby.1.9.1.dylib
generating encdb.h
encdb.h unchanged
making enc
make[1]: Nothing to be done for `enc'.
making srcs under enc
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h unchanged
making trans
make[1]: Nothing to be done for `./enc/trans'.
making encs
installing default bug libraries
installing default resize libraries
installing default bug libraries
installing default bug libraries
installing default funcall libraries
installing default dot.dot libraries
installing default old_thread_select libraries
installing default numhash libraries
installing default string libraries
installing default wait_for_single_fd libraries
installing default bigdecimal libraries
installing default continuation libraries
installing default coverage libraries
installing default curses libraries
installing default date_core libraries
make[2]: Nothing to be done for `all'.
installing digest libraries
installing default digest libraries
installing default bubblebabble libraries
installing default md5 libraries
installing default rmd160 libraries
installing default sha1 libraries
installing default sha2 libraries
installing dl libraries
installing default dl libraries
installing default callback libraries
make[2]: Nothing to be done for `all'.
installing default etc libraries
installing default fcntl libraries
installing default fiber libraries
installing default fiddle libraries
make[2]: Nothing to be done for `all'.
installing default iconv libraries
installing default console libraries
installing default nonblock libraries
installing default wait libraries
installing default libraries
installing default generator libraries
installing default parser libraries
installing default complex libraries
installing default rational libraries
installing default nkf libraries
installing default objspace libraries
installing default openssl libraries
installing default pathname libraries
installing default psych libraries
installing default pty libraries
installing default cparse libraries
compiling readline.c
readline.c:1499:9: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
rl_username_completion_function);
^
readline.c:69:42: note: instantiated from:
# define rl_username_completion_function username_completion_function
^
/usr/local/include/readline/readline.h:449:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function PARAMS((const char *, int));
^
1 error generated.
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2
make: *** [build-ext] Error 2
I had this problem myself, and after a great deal of struggle and searching (not one site had the complete solution), here's what I finally came up with:
curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
tar xzvf readline-6.2.tar.gz
cd readline-6.2
./configure --prefix=/usr/local
cd shlib
sed -e 's/-dynamic/-dynamiclib/' Makefile > Makefile.good
mv Makefile.good Makefile
cd ..
make
sudo make install
cd ..
rvm install 1.9.3 -C --with-readline-dir=/usr/local/
Try looking at this, it seems that your problem is with readline, and rvm has a whole section about working with readline errors.
http://rvm.io/packages/readline/
I tried installing ruby 1.9.3 on Snow Leopard using:
rvm install 1.9.3 --with-gcc=clang
After installing the gcc compiler (I am running xcode 4.2). But I am getting the following make error:
/usr/bin/gcc-4.2 -dynamic -bundle -o ../../.ext/x86_64-darwin10.8.0/tcltklib.bundle stubs.o tcltklib.o -L. -L../.. -L/$
ld: in /usr/local/lib/libgcc_s.1.dylib, missing required architecture x86_64 in file for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [../../.ext/x86_64-darwin10.8.0/tcltklib.bundle] Error 1
make: *** [mkmain.sh] Error 1
/usr/bin/gcc-4.2 is not provided in Xcode 4.2 this file might be left by older installation, try:
rvm install 1.9.3 --with-gcc=clang
Also it could be solved by uninstalling Xcode with:
/Library/Developer/Shared/uninstall-devtools
rm -rf /Library/Developer/
And installing Xcode again (clean).