Error Installing RedMine on shared Hosting - ruby

Today I was trying to install Redmine on my shared hosting following this guide:
http://unixserveradmin.com/archives/691
But i got stuck installing the mysql gem.
[trebolbi#air6 ~]$ gem install mysql -with-mysql-config=/user/bin/mysql_config
Fetching: mysql-2.8.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** 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
--with-mysql-config
--without-mysql-config
Gem files will remain installed in /home/trebolbi/th-mysql-config=/user/bin/mysql_config/gems/mysql-2.8.1 for inspection.
Results logged to /home/trebolbi/th-mysql-config=/user/bin/mysql_config/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
The problem is bigger yet, because there are 2 installations on my server, one in my local home folder, and one in the server's bin folder.
That makes the commands doesnt execute without error.
For example, for this step:
Log into the SSH, run “rake gems:install” from the Ruby Apps path
I get this error...
[trebolbi#air6 RedMine]$ rake gems:install
/usr/bin/rake:16:in `load': no such file to load -- rake (LoadError)
from /usr/bin/rake:16
And if i try executing the command using my local installation:
[trebolbi#air6 RedMine]$ ./../../ruby/gems/bin/rake gems:install
I get a lot of errors, all related to "Gem::SourceIndex#add_spec called from /usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91." ... as you can see, it looks for the gems in the server bin directoy (/usr/local/bin) and not in my local user installation of ruby (/home/user/ruby/gems/bin).
I just have to execute this commands to get the installation done...
gem install mysql
cd /home/trebolbi/rails_apps/RedMine
rake gems:install
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
And i want to execute them from my account and with my local ruby installation, but i get all those errors... what am I doing wrong?

Firtsly, check if your ruby version ($ ruby -v) is fully compatible with the Redmine. You can check the compatiblity RedmineInstall - this will not solve your current problems, but may help avoid others further.
According to gem installation problem, you should install mysql header files, the gem tool wrote that mysql.h was not found. You can do this if you have privileges to instaling software on your server. If you are, use your package manager (yum, apt-get, pacman - depends on your OS), just install the mysql development package (may be named like libmysql or mysql-devel, google it for your os). If you don't have privileges on installing software, write an inquiry to support asking to install mysql development libraries.
For solving rake problem, try to use bundler gem. You can find more information about it there: http://gembundler.com/ . After adding all needed records to the Gemfile, where you probably would like to include rake, mysql, and maybe some other gems, run bundle install. After all that operations you can safely run bundle exec rake to execute exactly the gem from bundler.
Let me know if you have any questions.

Related

Installing RMagick on Windows

I've done research on this and I've been at it on my one computer for hours and hours.
I've installed RMagick on my Desktop computer about 3 weeks ago, and it was fairly complicated.
I don't remember the exact steps I took, and I'm really frustrated.
I've installed ImageMagick onto my machine in the directory C:\ImageMagick
I've installed the Development kit too for Ruby.
I've also put the rmagick-rmagick-v2-2-g564f157 into the proper gems folder in my C:
It's in C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems
I'm getting the following errors:
I will type: gem install rmagick -- '--with-opt-dir="c:\ImageMagick"'
and get the following errors:
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-opt-dir="c:\ImageMagick"'
This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160326-6132-157vnes.rb extconf.rb
'--with-opt-dir="c:\ImageMagick"
checking for main() in -lCORE_RL_magick_... no
searching PATH for the ImageMagick library...
checking for main() in -lCORE_RL_magick_... no
checking for main() in -lCORE_RL_magick_... no
checking for main() in -lCORE_RL_magick_... no
Can't install RMagick 2.15.4.
Can't find the ImageMagick library.
Retry with '--with-opt-dir' option.
Usage: gem install rmagick -- '--with-opt-dir="[path to ImageMagick]"'
e.g.
gem install rmagick -- '--with-opt-dir="C:Program FilesImageMagick-6.9.1-
Q16"'
*** 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=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-CORE_RL_magick_lib
--without-CORE_RL_magick_lib
--with-CORE_RL_magick_lib
--without-CORE_RL_magick_lib
--with-CORE_RL_magick_lib
--without-CORE_RL_magick_lib
--with-CORE_RL_magick_lib
--without-CORE_RL_magick_lib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0
/gems/rmagick-2.15.4 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/rmagick-2.15.4/gem_make.out
I'm so frustrated at this point. It worked on my Desktop computer, but won't work here. Any suggestions?
This is the one link which can help you with all the issues you will ever face while installing rmagick gem.
Found it after a lot of browsing and after it you might not need any other link to visit.
link:- https://medium.com/ruby-on-rails-web-application-development/install-rmagick-gem-on-windows-7-8-10-imagemagick-6-9-4-q16-hdri-5492c3fef202
I hope it will save your time and efforts
What I do to install is the following:
Install ImageMagick with installer including (!) "development headers and libraries" See: http://www.graphity-consulting.com/files/2016/03/screenshot-installation-imagemagick-6.9.3-32bit-3.png
Open windows command prompt
Enhance path to include ImageMagick. E.g. set PATH=d:\opt\ImageMagick;%PATH%
Install gem using: gem install rmagick -- --with-opt-dir=d:\opt\ImageMagick
Note: I let gem download rmagick by itself and I pass path to ImageMagick in --with-opt-dir and also have it in my path.
UPDATE:
As #winter-young mentioned in comments: Do not mix 32 Bit ruby with 64 Bit ImageMagick or vice versa. Only use 32 Bit ruby with 32 Bit ImageMagick. Or use 64 Bit ruby with 64 Bit ImageMagick.
UPDATE 2
As #winter-young states, rmagick 2.15.4 only supports ImageMagick 6, not ImageMagick 7 (didn't test it myself)
UPDATE 3
As #tiefenauer points out, rmagic 2.16.0 works with ImageMagick 7.0.8. Furthermore, single quotes are needed now: gem install rmagick -- '--with-opt-dir=C:\Program Files\ImageMagick-7.0.8-Q16'

rbczmq error when installing iruby

Am trying to install iruby on a windows machine and this error keeps appearing. Am currently doing some deep learning and I need to use sciruby and iruby to perform the actions required
PS C:\> gem install iruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing iruby:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe -r ./siteconf20150710-76680-1u0zekx.rb extconf.rb
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
*** 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=C:/RailsInstaller/Ruby2.1.0/bin/ruby
--with-kernel32lib
--without-kernel32lib
--with-rpcrt4lib
--without-rpcrt4lib
--with-gdi32lib
--without-gdi32lib
extconf.rb:49:in `<main>': uninitialized constant GNU_CHAIN (NameError)
extconf failed, exit code 1
Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rbczmq-1.7.9 for inspection.
Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/rbczmq-1.7.9/gem_make.out
Please assist solving this problem
I am new to python and know nothing about ruby, but I find ipython notebook so amazing that I want give it a try for another kernel,
so I just installed ruby and end up with the same problem, and google failed to help me,,,
but I am really good at patching things, after one hour of ##$#%&%#%!(#!, I found a way:
edit C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\rbczmq-1.7.9\ext\rbczmq\extconf.rb
add statement GNU_CHAIN = 1 on the top
cd C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\rbczmq-1.7.9
gem spec ....\cache\rbczmq-1.7.9.gem --ruby > ....\specifications\rbczmq-1.7.9.gem.gemspec
gem build ....\specifications\rbczmq-1.7.9.gem.gemspec
now, gem list shows "rbczmq (1.7.9)"
I knew nothing about ruby, so I dont know whether rbczmq really works or not
"iruby notebook" starts succ and new kernel "ruby 2.2.2" added, but it also says "kernel error" when I choose it
the Track back says: "OSError: [WinError 193]"
That's all I can help for now, so maybe you can figure it out now and tell me how to make the new kernel do its trick

Error in uuid4r gem installation in linux

I am getting this error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/kiwitech/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-opt-include=/usr/local/opt/ossp-uuid/include --with-opt-lib=/home/kiwitech/Documents/ossp-uuid
checking for uuid_export() in -luuid... no
*** 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/kiwitech/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-uuidlib
--without-uuidlib
OSSP uuid library 'uuid' required -- not found.
extconf failed, exit code 1
Gem files will remain installed in /home/kiwitech/.rvm/gems/ruby-1.9.3-p547/gems/uuid4r-0.2.0 for inspection.
Results logged to /home/kiwitech/.rvm/gems/ruby-1.9.3-p547/extensions/x86-linux/1.9.1/uuid4r-0.2.0/gem_make.out
Please someone help me
You need to install libossp-uuid and it's dev headers.
Probably something like:
sudo apt-get install libossp-uuid-dev
And then the gem installs.
Are you sure you need to use that gem anyway? In ruby 1.9+ there's already the module SecureRandom in standard library which provides UUID and also lots of pure ruby gems like uuidtools and uuid. If you need to parse the UUID's, there's ruby-uuid.
If you're running OS X Yosemite do the following:
gem install uuid
brew install ossp-uuid
(You need to have brew already installed. If you don't you can get it from here: http://brew.sh)
If you're using rvm, check that your session state is correct. If you cd around a lot, reset your terminal, or your environment variables get corrupted, you can end up with your commands trying to work with the system Ruby. A quick way to reset rvm-related stuff is just doing cd . in a project directory.
$ cd .
$ gem install uuid

Installing Ruby / GSL in Heroku Application

Context:
I have an application that makes heavy use of the GSL library and its
Ruby bindings.
I'd like to deploy the app to Heroku. I'm very new to programming in
general, much less deployment, and Heroku is very simple to use,
especially for Rails apps.
I have GSL installed on my laptop. I am using the 'gsl' gem.
The Problem:
The gem requires that the GSL library already be installed.
GSL is not already installed in the Heroku environment.
So, unsurprisingly, I get this error from Heroku after I git push heroku master
-----> Heroku receiving push
-----> Removing .DS_Store files
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0.rc
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
...
Installing gsl (1.14.7) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking gsl version... *** 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/local/bin/ruby
extconf.rb:237:in `rescue in <main>': Check GSL>=0.9.4 is installed, and the command "gsl-config" is in search path. (RuntimeError)
from extconf.rb:138:in `<main>'
The (Probable) Solution:
It seems that working with Heroku's buildpacks is the likely route.
This (packing binary buildpack dependencies) seems promising.
I just don't understand what is going on in the tutorial, or how to use vulcan.
What I am hoping for:
An easy-to-follow explanation of how to make the GSL library available to my application on Heroku.
Thank you so much!!
Hey Tom (what's the likelihood of two people named Tom needing to use ruby-gsl on heroku?) I've yet to test it out (I really don't exactly know what I'm doing and I don't really have an app ready yet to test it with) but maybe this'll work:
heroku-buildpack-gsl-ruby
if not, well, we'll keep at it ;)
It's gsl 1.15 which is currently the latest.
Though in the future something like:
package_nodejs
instead for gsl might be nice (see hacking section of the readme). I'll probably add that soon (copy/paste, shudder, so not DRY).

Error installing rmagick: ERROR: Failed to build gem native extension

I am trying to install RmMagic using the below command:
gem install rmagick -v=2.12.2
After running this command i get some error :
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
D:/ruby/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
Invalid drive specification.
Unable to get ImageMagick version
*** 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=D:/ruby/bin/ruby
Gem files will remain installed in D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2
.12.2 for inspection.
Results logged to D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.12.2/ext/RMagick
/gem_make.out
Please help me in this regard. Thanks in advance.
I had same problem with rmagick to solve this add System Environment Variable
CLASSPATH .;C:\ImageMagick-6.5.6-Q8\include
lib C:\ImageMagick-6.5.6-Q8\lib
Then do
gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.5.6-Q8\lib --with-opt-include=C:\ImageMagick-6.5.6-Q8\include
What a pain this was... I definitely needed to do both the System Environment Variables AND the specific syntax of the command as suggested by Mukesh
To clarify the two steps:(for other novices like me)
Click properties from context menu of "Computer, click "Advanced System Settings",
click "Environment Variables", click "New" under System Variables,
use CLASSPATH for the variable name and for the value use:
.;C:\ImageMagick-6.9.0-Q16\include;lib C:\ImageMagick-6.9.0-Q16\lib
Then Run As Administrator the Command Prompt with Ruby terminal and execute:
gem install rmagick -v '2.13.4' -- --with-opt-lib=C:\ImageMagick-6.9.0-Q16\lib --with-opt-include=C:\ImageMagick-6.9.0-Q16\include
(***Make sure to update the versions number in both the Variable and gem command if necessary)

Resources