Couldn't install gem - extconf.rb failed - ruby

I upgraded the macos to Mojave and reinstalled xcode, xcode CLT, ruby, etc. Then when I tried:
gem install nokogiri
I got the following error (installing other gems gave similar error):
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20181209-20884-etfc5r.rb extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
I checked the mkmf.log, which contains the following:
"clang -o conftest -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/x86_64-darwin18 -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/backward -I/usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/usr/local/Cellar/ruby/2.5.3_1/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -lruby.2.5.3 -lpthread -ldl -lobjc "
In file included from conftest.c:1:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby.h:33:
In file included from /usr/local/Cellar/ruby/2.5.3_1/include/ruby-2.5.0/ruby/ruby.h:29:
The text went on like this for a while. I also cd to the nokogiri folder and directly run extconf.rb, and got the following error:
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.`
Provided configuration options:
--with-opt-dir
--with-opt-include
... (skipped similar content for brevity and continued below)
usr/local/Cellar/ruby/2.5.3_1/lib/ruby/2.5.0/mkmf.rb:456:in 'try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
I tried to install xcode. I also installed the header and acknowledged the license. I at first thought it has to do with GCC, but the mkmf file showed that the problem is with Clang.
Hope someone can help.

I had to run the following cryptic commands to get nokogiri installed. Basically this entails getting my C compiler working in mac osx Mojave, after having everything working fine in a previous OS (Yosemite I think it was...)
This is an (somewhat) obvious step when upgrading osx:
xcode-select --install
I also had to do this, which I never would've known how to do without google and this post
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
Finally, I had to agree to the xcode license (found I had to do this via the makefile logs when install of nokogiri failed...)
sudo xcodebuild -licence
It'll prompt you to eventually type "agree"
Finally, continuing with bundle works as expected for a new rails project that includes nokogiri. Success!

Related

Error running '__rvm_make -j8' when trying to install Ruby using RVM

I am trying to use RVM to install Ruby. I have been following the Installfest guide over at RailsBridge.
So far, I have installed RVM (curl -L get.rvm.io | bash -s stable) and configured RVM to use Homebrew (rvm autolibs homebrew). When I enter rvm install ruby into Terminal, I get the following output:
ruby-2.5.1 - #removing src/ruby-2.5.1..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.13/x86_64/ruby-2.5.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx_brew.
Certificates bundle '/usr/local/etc/openssl#1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/jules/.rvm/rubies/ruby-2.5.1, this may take a while depending on your cpu(s)...
ruby-2.5.1 - #downloading ruby-2.5.1, this may take a while depending on your connection...
ruby-2.5.1 - #extracting ruby-2.5.1 to /Users/jules/.rvm/src/ruby-2.5.1.....
ruby-2.5.1 - #configuring......................................................|
ruby-2.5.1 - #post-configuration.
ruby-2.5.1 - #compiling....
Error running '__rvm_make -j8',
please read /Users/jules/.rvm/log/1530823409_ruby-2.5.1/make.log
There has been an error while running make. Halting the installation.
I opened /Users/jules/.rvm/log/1530823409_ruby-2.5.1/make.log in an attempt to make progress, but I wasn't able to glean any meaning from the file. I have pasted the contents below:
[2018-07-05 16:44:45] __rvm_make
__rvm_make ()
{
\make "$#" || return $?
}
current path: /Users/jules/.rvm/src/ruby-2.5.1
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/jules/anaconda2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/jules/.rvm/bin
command(2): __rvm_make -j8
++ make -j8
CC = gcc
LD = ld
LDSHARED = gcc -dynamiclib
CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl#1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin17 -I./include -I. -I./enc/unicode/10.0.0
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl#1.1/lib -install_name /Users/jules/.rvm/rubies/ruby-2.5.1/lib/libruby.2.5.dylib -compatibility_version 2.5 -current_version 2.5.1 -fstack-protector -framework Foundation -fstack-protector -framework Foundation
SOLIBS = -lpthread -lgmp -ldl -lobjc
LANG = en_US.UTF-8
LC_ALL =
LC_CTYPE =
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
compiling ./main.c
compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
compiling miniprelude.c
translating probes probes.d
compiling bignum.c
compiling class.c
compiling compar.c
compiling compile.c
error: error reading '/dev/fd/7'
1 error generated.
clang: error: unable to remove file: Operation not permitted
dtrace: failed to compile script probes.d: Preprocessor failed to process input program
make: *** [probes.h] Error 1
make: *** Waiting for unfinished jobs....
++ return 2
Where should I go from here? Cheers!
Update: I Googled error: error reading '/dev/fd/7' from make.log and solved the problem by uninstalling Avira: https://github.com/rvm/rvm/issues/4313.
This worked for me:
rvm install ruby-2.5.1 --with-openssl-dir=/usr/local/opt/openssl
The openssl flag fixed my error! In case it's helpful, the last line of mymake.log was:
openssl_missing.c:39:18: error: expected ';' after top level declarator
EVP_MD_CTX_create(void)
This worked for me:
renaming /usr/local/include to /usr/local/include_old
Ref: Broken c++ std libraries on macOS High Sierra 10.13

`gem install tiny_tds` on OS X Yosemite failing with "You have to install development tools first."

Looking for a wise sage to point me in the right direction for what I can do next.
I use RVM and brew on OS X. I've confirmed that xcode is up to date and that xcode command line tools are installed.
I'm hitting this error during gem install tiny_tds
/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in
'try_do': The compiler failed to generate an executable file.
(RuntimeError)
You have to install development tools first.
from /Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:461:in 'try_link0'
from /Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:476:in 'try_link'
from /Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:619:in 'try_func'
I added some debug logging to mkmf.rb to see what was going on at that point.
The call to try_do was passing the following in the command argument:
command
/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/x86_64-darwin13.4.0 -I/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/backward -I/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1 -I. -I/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/include -I/usr/include -I/usr/local/include -I/usr/local/mysql/include -I/opt/X11/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib -L/Users/bdx/.rvm/rubies/ruby-1.9.3-p448/lib -L/usr/lib -L/usr/local/lib -L/usr/local/mysql/lib -L/opt/X11/lib -L/usr/local/git/lib -L/Users/bdx/.rvm/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lpthread -ldl -lobjc
Following that command argument, I found that /usr/local/opt/gcc46/bin/gcc-4.6 didn't exist. Doing locate gcc-4.6 found its path for me, so I ran: ln -s /usr/local/opt/gcc46/bin/gcc-4.6 /usr/local/Library/ENV/4.3/gcc-4.6 and tried again, but the same error keeps occurring.
I have encountered the same error -
You have to install development tools first
when tried to install tiny_tds gem. When inspecting the log file mkmf.rb, I found the error was:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Running xcode-select --reset fixed the problem for me.

Errors Installing the gem wdm in cygwin

I keep getting this error while installing the gem wdm from inside cygwin. Does anybody had the same issue and know now to fix it. Thanks. (I am Trying to install Guard gem)
$ gem install wdm
Building native extensions. This could take a while...
ERROR: Error installing wdm:
ERROR: Failed to build gem native extension.
/usr/bin/ruby.exe extconf.rb
checking for main() in -lkernel32... yes
checking for windows.h... yes
checking for ruby.h... yes
checking for HAVE_RUBY_ENCODING_H... yes
creating Makefile
make
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o entry.o -c entry.c
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o memory.o -c memory.c
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o monitor.o -c monitor.c
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o queue.o -c queue.c
gcc -I. -I/usr/include/ruby-1.9.1/i386-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -DHAVE_WINDOWS_H -DHAVE_RUBY_H -DHAVE_CONST_HAVE_RUBY_ENCODING_H -ggdb -O2 -pipe -fno-strict-aliasing -o rb_change.o -c rb_change.c
rb_change.c: In function ‘extract_absolute_path_from_notification’:
rb_change.c:47:16: error: ‘_MAX_FNAME’ undeclared (first use in this function)
rb_change.c:47:16: note: each undeclared identifier is reported only once for each function it appears in
rb_change.c:47:33: error: ‘_MAX_EXT’ undeclared (first use in this function)
Makefile:206: recipe for target `rb_change.o' failed
make: *** [rb_change.o] Error 1
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/wdm-0.1.0 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/wdm-0.1.0/ext/wdm/gem_make.out
A colleague of mine had an issue with wdm the other day.
We fixed it by downloading the Ruby DevKit (Not sure if you already had this installed).
I found some pretty decent step by steps online, I'll paste them here - hope they help
Development kit is here: http://rubyinstaller.org/downloads/
Download the Development Kit and install it in say c:\devkit.
Open a command window and type c:.
Change folders by typing cd devkit.
Type ruby dk.rb init to generate the config.yml file to be used later.
Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at present). This needs to be done only once.
Finally type, ruby dk.rb install for DevKit enhance your installed Rubies. This needs to be done only once.
Confirm your Ruby environment is correctly using the DevKit by running:
gem install wdm --platform=ruby
It’s crucial that you include the --platform=ruby option to force RubyGems to build the native gem rather than potentially installing an incorrect binary gem.

MySqlDB: llvm-gcc-4.2: error. Even after installing XCode 4.6.3 and storing MySQL include folder in XAMPP

I took the following steps after reading suggestions from http://andhikalegawa.wordpress.com/2012/01/05/installing-mysql-python-on-snow-leopard-using-xampp-mysql/
Downloaded MySQL-python-1.2.4b4 and unzipped
Changed the mysql_config = /Applications/XAMPP/xamppfiles/bin/mysql_config (as I am using XAMPP 1.7.3)
Downloaded mysql-5.1.70-osx10.6-x86 (I could not find 5.1.55 which is the version used in XAMPP) kept the include folder at /Applications/XAMPP/xamppfiles/
I am new to development so, downloaded XCode 4.6.3 with command line tools.
Logically it should have worked I am getting the following error
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.7-intel-2.7/MySQLdb
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.7-intel-2.7
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'beta',4) -D_version_=1.2.4b4 -I/Applications/XAMPP/xamppfiles/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -mmacosx-version-min=10.4 -arch i386 -arch ppc -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
In file included from _mysql.c:44:
/Applications/XAMPP/xamppfiles/include/my_config.h:1088:1: warning: "HAVE_WCSCOLL" redefined
In file included from /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:8,
from _mysql.c:29:
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h:891:1: warning: this is the location of the previous definition
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/6p/8bxdl12d2nq05dmwbmdzttt40000gn/T//cc0v0ehE.out
error: command 'llvm-gcc-4.2' failed with exit status 255
Looks like it's trying to compile universal for PowerPC, which you probably don't have?
error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2'
I would suggest setting the ARCHFLAGS:
shell> rm -Rf build/
shell> ARCHFLAGS="-arch i386" /usr/bin/python setup.py build
Or instead of i386, on 64-bit x86_64. But since you are downloading 32-bit MySQL, might be good to use i386.
Good luck! (Shameless advert: you can always try MySQL Connector/Python)

Angr installation failed in RPI3

I am trying to install Angr tool on Raspberry pi 3, OS Ubuntu mate 16.04. Git link Angr tool
I isolated problem while installing pyvex getting this error, git link Pyvex
running install
running bdist_egg
running build
Building libVEX
cc -Ipub -Ipriv -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wmissing-declarations -Wwrite-strings -Wformat -Wformat-security -std=gnu99 -fstrict-aliasing -fPIC -g -malign-double -o auxprogs/genoffsets auxprogs/genoffsets.c
cc: error: unrecognized command line option ‘-malign-double’
Makefile-gcc:72: recipe for target 'pub/libvex_guest_offsets.h' failed
make: *** [pub/libvex_guest_offsets.h] Error 1
error: Unable to build libVEX.
-malign-double is for X86 architecture as per GCC documentation but i have arm architecture. How do I fix this issue.
During build PyVEX downloads VEX. I think you have to download it yourself, fix Makefile and build. Then return to building PyVEX.
Report the problem to the angr team.

Resources