Just updated to macOS Mojave, reinstalled mysql via brew & downloaded latest xcode 9.2 . While triying to setup a development enviroment for an old rails project, bundle crashes on installation of mysql2 gem. In the beggining i thought it was because latest mysql2 version, is not compatible with ruby 1.9 so i tried:
gem install mysql2 -v '0.3.17'
and i received:
/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for ruby/thread.h... * 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
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
/Users/me/.rvm/rubies/ruby-1.9.3-p125/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/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:intry_cpp'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:931:in block in have_header'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:inblock in checking_for'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in block (2 levels) in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:inopen'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in block in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:inopen'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:in postpone'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:inchecking_for'
from /Users/me/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:930:in have_header'
from extconf.rb:9:in'
copy from /Users/me/.rvm/gems/ruby-1.9.3-p125#mailcatcher/gems/mysql2-0.2.18/ext/mysql2/mkmf.log:
"/usr/bin/gcc-4.2 -o conftest -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I/Users/me/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1 -I. -I/Users/me/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/me/.rvm/rubies/ruby-1.9.3-p125/lib -L/Users/me/.rvm/usr/lib -L. -L/usr/local/lib -lruby.1.9.1 -lpthread -ldl -lobjc "
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: int main() {return 0;}
/ end */
It sounds like you're either missing the XCode command line tools:
xcode-select --install
Or mySQL packages:
If you don't already have homebrew:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then to install mysql:
brew install mysql
I can't remember which solved this issue for me in the past but I'm sure it was one of them.
Cross linking my answer to almost this exact same question. I think it might just be not finding the correct config path
sudo gem install mysql2 -- --with-mysql-config=/usr/local/bin/mysql_config
See the answer here
edit: formatting
Related
I am attempting to install the Nokogiri gem for use with Ruby on Rails, but I cannot get it to build no matter which packages I install. I am running Ubuntu 20.04.
I have installed all the packages from this guide on the Nokogiri website (https://nokogiri.org/tutorials/installing_nokogiri.html):
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri
I am using RVM, so I have also installed the libgmp-dev package, which the above tutorial also recommends.
While searching for other solutions, I have also installed the following packages:
sudo apt-get install gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev
Ruby Version: 2.7.1
RVM Version: 1.29.10
Gem Version: 3.1.2
gem_make.out
current directory: /home/dan/.rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
/usr/share/rvm/rubies/ruby-2.7.1/bin/ruby -I /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20200924-8532-1t7wwwh.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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/share/rvm/rubies/ruby-2.7.1/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:597:in `block in try_compile'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:544:in `with_werror'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:597:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/mkmf.rb:655:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/dan/.rvm/gems/ruby-2.7.1/extensions/x86_64-linux/2.7.0/nokogiri-1.10.10/mkmf.log
extconf failed, exit code 1
mkmf.log
"gcc -o conftest -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/x86_64-linux -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/backward -I/usr/share/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0 -I. -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -fPIC conftest.c -L. -L/usr/share/rvm/rubies/ruby-2.7.1/lib -Wl,-rpath,/usr/share/rvm/rubies/ruby-2.7.1/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-rpath,'/../lib' -Wl,-rpath,'/../lib' -lruby -lm -lc "
gcc: error: unrecognized command line option '-Wduplicated-cond'
gcc: error: unrecognized command line option '-Wmisleading-indentation'
gcc: error: unrecognized command line option '-Wimplicit-fallthrough=0'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
Any help would be much appreciated.
You have to do a full compile of Ruby 2.7.x in order to get nokogiri 1.10.10 to install on Ubuntu 20.04.
For a clean install run:
rvm install 2.7 --disable-binary
To reinstall your existing ruby version use:
rvm reinstall 2.7 --disable-binary
Ubuntu 20.04. Ruby 2.7.1.
Changing rvm to rbenv was fixed this error.
I reinstalled Ubuntu 20.04 fresh along with Ruby etc, and it worked. I don't know what went wrong, and I don't know if any of the solutions below will work.
I add the same problem. On this environment :
ubuntu 20.04 LTS
ruby 2.7.0
gem 3.1.2
bundler 2.1.4,
the steps described here https://mrtan.me/post/34.html/ worked for me :
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
gem install nokogiri
bundle
Can confirm. Going to rbenv worked for me as well.
I'm following the "Jekyll on Debian" directions step-by-step for installing Jekyll on my Debian 10.1:
sudo apt-get install ruby-full build-essential zlib1g-dev
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
gem install jekyll bundler
but it doesn't work. Here is the output:
$ gem install jekyll bundler
Building native extensions. This could take a while...
/usr/lib/ruby/2.5.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /srv/dev-disk-by-label-data/home/mark/gems/bin in PATH, mode 040777
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /srv/dev-disk-by-label-data/home/mark/gems/gems/eventmachine-1.2.7/ext
/usr/bin/ruby2.5 -r ./siteconf20200102-7165-18dxplz.rb extconf.rb
*** 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
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.5
--with-ssl-dir
--without-ssl-dir
--with-ssl-include
--without-ssl-include=${ssl-dir}/include
--with-ssl-lib
--without-ssl-lib=${ssl-dir}/lib
--with-openssl-config
--without-openssl-config
--with-pkg-config
--without-pkg-config
/usr/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.
from /usr/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0'
from /usr/lib/ruby/2.5.0/mkmf.rb:559:in `try_link'
from /usr/lib/ruby/2.5.0/mkmf.rb:661:in `try_ldflags'
from /usr/lib/ruby/2.5.0/mkmf.rb:1821:in `pkg_config'
from extconf.rb:65:in `pkg_config_wrapper'
from extconf.rb:92:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/srv/dev-disk-by-label-data/home/mark/gems/extensions/x86-linux/2.5.0/eventmachine-1.2.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /srv/dev-disk-by-label-data/home/mark/gems/gems/eventmachine-1.2.7 for inspection.
Results logged to /srv/dev-disk-by-label-data/home/mark/gems/extensions/x86-linux/2.5.0/eventmachine-1.2.7/gem_make.out
Successfully installed bundler-2.1.3
Parsing documentation for bundler-2.1.3
Done installing documentation for bundler after 19 seconds
1 gem installed
and here is the log file:
"gcc -o conftest -I/usr/include/i386-linux-gnu/ruby-2.5.0 -I/usr/include/ruby-2.5.0/ruby/backward -I/usr/include/ruby-2.5.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -g -O2 -fdebug-prefix-map=/build/ruby2.5-qqUyFd/ruby2.5-2.5.5=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/i386-linux-gnu -L. -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.5 -lpthread -lgmp -ldl -lcrypt -lm -lc"
/usr/lib/ruby/2.5.0/mkmf.rb:395: warning: Insecure world writable dir /srv/dev-disk-by-label-data/home/marcotrapanese/gems/bin in PATH, mode 040777
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"pkg-config --exists openssl"
| pkg-config --libs openssl
=> "-lssl -lcrypto\n"
The warning about the permissions on the gems/bin folder is weird, because it was created by the installer, not by me.
It says "You have to install development tools first", but I've already installed them. Furthermore the error message doesn't tell what it thinks is missing.
Why does following such a simple procedure fail?
I'm trying to install jekyll on macOS with following versions and xcode command line tools installed with ruby 2.4.0p0 and gem 2.6.10
installing jekyll and bundler
gem install jekyll bundler
the result of the command is
Fetching: public_suffix-2.0.5.gem (100%)
Successfully installed public_suffix-2.0.5
Fetching: addressable-2.5.0.gem (100%)
Successfully installed addressable-2.5.0
Fetching: colorator-1.1.0.gem (100%)
Successfully installed colorator-1.1.0
Fetching: sass-3.4.23.gem (100%)
Successfully installed sass-3.4.23
Fetching: jekyll-sass-converter-1.5.0.gem (100%)
Successfully installed jekyll-sass-converter-1.5.0
Fetching: rb-fsevent-0.9.8.gem (100%)
Successfully installed rb-fsevent-0.9.8
Fetching: ffi-1.9.17.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.17/ext/ffi_c
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170303-1307-1slrb61.rb extconf.rb
checking for ffi.h... *** 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
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/Cellar/ruby/2.4.0/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:588:in `try_cpp'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:1095:in `block in have_header'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:945:in `block in checking_for'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block in postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:347:in `postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:944:in `checking_for'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:1094:in `have_header'
from extconf.rb:16:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/ffi-1.9.17/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.17 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/ffi-1.9.17/gem_make.out
Fetching: bundler-1.14.5.gem (100%)
Successfully installed bundler-1.14.5
Parsing documentation for bundler-1.14.5
Installing ri documentation for bundler-1.14.5
Done installing documentation for bundler after 4 seconds
1 gem installed
contents of log file mkmf.log
package configuration for libffi is not found
"clang -o conftest -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.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 -fno-fast-math -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.4.0/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.4.0 -lpthread -ldl -lobjc "
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamStart: ERROR: FSEvents_connect() => (ipc/send) invalid destination port (268435459)
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamInvalidate(): failed assertion 'streamRef != NULL'
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamRelease(): failed assertion 'streamRef != NULL'
2017-03-03 09:09:01.029 xcodebuild[1311:92957] DVTFilePathFSEvents: Failed to start fs event stream.
sh: line 1: 1313 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find clang 2> /dev/null
clang: error: unable to find utility "clang", not a developer tool or in PATH
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
i looked for solutions to fix clang: error: unable to find utility "clang", not a developer tool or in PATH
and found out that Xcode couldn't find its own Command Line Tools.
This link fixed it for me.
I've install Ruby 2, Rails 4 and MySQL (with homebrew).
I tried to install the gem "mysql2" but i got this message :
gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
Can you help me ?
For some reason, install mysql via homebrew was broken. You have to manually edit the mysql_config.
The mysql_config file of homebrew stay in /usr/local/Cellar/mysql/5.6.12/bin,
Open it with sudo, around line 120, find these lines:
cflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
And remote -Wno-null-conversion -Wno-unused-private-filed in both line like this:
cflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!
Save the file and execute brew install mysql again and it should work.
Check this blog post.
Check the compatibility of Rails and mysql version you are installing.
With me I was starting Rails 4.1.15 with Mysql 8.0 which didn't work and I came across similar errors.
Then i installed
brew install mysql56
Before this uninstall mysql if you have already installed one using -
brew uninstall mysql
brew cleanup
Now create a new rails project by specifying database to be used as mysql
rails new <PROJECT_NAME> -d mysql
This will create a new rails 4 project with compatible mysql
After this you can always configure the database.yml file for further details
I used homebrew (linux port) to install freeTDS and am trying to deploy /bundle install my app with gem tinytds. I get this error output when doing bundle install
Installing tiny_tds (0.5.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/deployer/.rbenv/versions/1.9.2-p290/bin/ruby extconf.rb
/usr/bin/ld: /opt/homebrew/lib/libsybdb.a(dblib.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/opt/homebrew/lib/libsybdb.a: could not read symbols: Bad value
Pretty similar to this fix, but I don't have the files referred to in my folder: https://stackoverflow.com/a/7119224/1130736
Contents of homebrew lib folder:
/opt/homebrew/lib$ ls
libct.a libsybdb.a
Full error dump:
full error dump:
Installing tiny_tds (0.5.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/deployer/.rbenv/versions/1.9.2-p290/bin/ruby extconf.rb
checking for iconv_open() in iconv.h... yes
checking for sybfront.h... yes
checking for sybdb.h... yes
checking for tdsdbopen() in -lsybdb... yes
checking for ct_bind() in -lct... yes
creating Makefile
make
/usr/bin/gcc -I. -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-linux -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/opt/homebrew/include -I/usr/local/include -I/usr/include -I'/home/deployer/.rbenv/versions/1.9.2-p290/include' -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o client.o -c client.c
client.c: In function ‘tinytds_err_handler’:
client.c:52: warning: initialization discards qualifiers from pointer target type
client.c: In function ‘tinytds_msg_handler’:
client.c:100: warning: initialization discards qualifiers from pointer target type
/usr/bin/gcc -I. -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-linux -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/opt/homebrew/include -I/usr/local/include -I/usr/include -I'/home/deployer/.rbenv/versions/1.9.2-p290/include' -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o result.o -c result.c
/usr/bin/gcc -I. -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/x86_64-linux -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/home/deployer/.rbenv/versions/1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_ICONV_OPEN -DHAVE_SYBFRONT_H -DHAVE_SYBDB_H -I/opt/homebrew/include -I/usr/local/include -I/usr/include -I'/home/deployer/.rbenv/versions/1.9.2-p290/include' -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o tiny_tds_ext.o -c tiny_tds_ext.c
/usr/bin/gcc -shared -o tiny_tds.so client.o result.o tiny_tds_ext.o -L. -L/home/deployer/.rbenv/versions/1.9.2-p290/lib -Wl,-R/home/deployer/.rbenv/versions/1.9.2-p290/lib -L/home/deployer/.rbenv/versions/1.9.2-p290/lib -Wl,-R/home/deployer/.rbenv/versions/1.9.2-p290/lib -L/opt/homebrew/lib -Wl,-R/opt/homebrew/lib -L/usr/lib -Wl,-R/usr/lib -L. -L'/home/deployer/.rbenv/versions/1.9.2-p290/lib' -rdynamic -Wl,-export-dynamic -lct -lsybdb -lpthread -lrt -ldl -lcrypt -lm -lc
/usr/bin/ld: /opt/homebrew/lib/libsybdb.a(dblib.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/opt/homebrew/lib/libsybdb.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [tiny_tds.so] Error 1
Gem files will remain installed in /home/deployer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/tiny_tds-0.5.1 for inspection.
Results logged to /home/deployer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/tiny_tds-0.5.1/ext/tiny_tds/gem_make.out
An error occured while installing tiny_tds (0.5.1), and Bundler cannot continue.
Make sure that `gem install tiny_tds -v '0.5.1'` succeeds before bundling.'
Install FreeTDS with homebrew: brew install freetds.
Then, this installation should work: gem install tiny_tds
I run fedora, but the fix for me is
sudo yum install freetds-devel
I am pretty sure that you just need to have the development package of freetds for this to work. After I had the devel package, my
gem install tiny_tds
worked perfectly.
Installing tiny_tds on the Mac:
Installing the tiny_tds gem with bundler requires that FreeTDS be installed first, and also that bundler be told where FreeTDS is located.
First, install FreeTDS:
brew install freetds
By default, tiny_tds will look in certain locations, but freetds, as installed by homebrew, will not be found in any of them:
looking for freetds headers in the following directories:
- /opt/local/include
- /opt/local/include/freetds
- /usr/local/include
- /usr/local/include/freetds
looking for freetds library in the following directories:
- /opt/local/lib
- /opt/local/lib/freetds
- /usr/local/lib
- /usr/local/lib/freetds
So, first you need to find exactly where the freetds lib and include directories are:
ls -l /opt/homebrew/Cellar/freetds
At the time this is posted, the version of freetds installed by brew is 1.3.3, so that is the directory shown by that ls -l:
drwxr-xr-x 15 [username] admin 480 Dec 7 15:36 1.3.3
Then, cd into that folder to see its contents:
cd /opt/homebrew/Cellar/freetds/1.3.3
ls -l
You will find the include and lib directories for freetds in that folder.
Then, tell bundler to tell tiny_tds where to find them:
bundle config set --global build.tiny_tds --with-freetds-dir=/opt/homebrew/Cellar/freetds/1.3.3
Now, you can bundle and the tiny_tds gem will be built.
I got same problem, I solved it with these two commands:
brew install freetds
And you need to install gem with x64 flag:
ARCHFLAGS="-arch x86_64" gem install tiny_tds