rubygems not working on Synology DS209 - ruby-on-rails

I'm trying to install Ruby on Rails on my Synology DS209 using the instructions at http://wiki.joachimschuster.de/index.php/Install_Ruby_on_Rails_and_Redmine_on_DS210%2B. I have all the prerequirements checked (except for the redmine-user, which I assume isn't the problem), and the rubygems and zlib packages installs just fine through ipkg.
However, when i run gem, I get the following errors:
DiskStation> gem
/opt/bin/gem: line 8: require: not found
/opt/bin/gem: line 9: require: not found
/opt/bin/gem: line 10: require: not found
/opt/bin/gem: line 12: required_version: not found
/opt/bin/gem: line 14: unless: not found
/opt/bin/gem: line 15: abort: not found
/opt/bin/gem: line 16: end: not found
/opt/bin/gem: line 21: syntax error: unexpected "("
DiskStation>
Any suggestions?
EDIT:
Removing and reinstalling rubygems revealed the following:
DiskStation> ipkg remove -force-removal-of-dependent-packages ruby
Removing package rubygems from root...
Removing package ruby from root...
Successfully terminated.
DiskStation> ipkg install rubygems
Installing rubygems (1.1.1-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/rubygems_1.1.1-1_arm.ipk
Installing ruby (1.9.1.243-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/ruby_1.9.1.243-1_arm.ipk
Configuring apache
update-alternatives: Linking //opt/sbin/htpasswd to /opt/sbin/apache-htpasswd
update-alternatives: Linking //opt/sbin/httpd to /opt/sbin/apache-httpd
httpd: Syntax error on line 75 of /opt/etc/apache2/httpd.conf: Cannot load /opt/libexec/mod_ext_filter.so into server: /opt/libexec/mod_ext_filter.so: undefined symbol: apr_procattr_limit_set
httpd: Syntax error on line 75 of /opt/etc/apache2/httpd.conf: Cannot load /opt/libexec/mod_ext_filter.so into server: /opt/libexec/mod_ext_filter.so: undefined symbol: apr_procattr_limit_set
postinst script returned status 1
ERROR: apache.postinst returned 1
Configuring ruby
Configuring rubygems
Successfully terminated.

I have the same problem..
gem is a script file and if you see inside, it calls ruby like this "#!/opt/bin/ruby".
Let's see "/opt/bin/ruby"!! it is also a script file which calls "#!/opt/bin/ruby".
It's non-sense...
I think that there is a bug installing packages.. Up to now, I have no solution...
I found solution...
Install ruby again.
ipkg install ruby -force-reinstall
after this, you have binary ruby file.
If you trying redmine on DSM 4.0, installing rails require libcrypto.so.0.9.8 which is not in your NAS. Make a copy with /usr/lib/libcrypto.so.1.0.0 and you would make it.

Thanks for all the answers, it was enough for Ruby, but I had to do a bit more to get rails 2.3.5 installed (I also wanted to get Redmine on my DS209+; I'm glad to report that's working for me).
I tried this (from this web site: http://ash-ride.blogspot.ca/2010/09/redmine.html)
gem install rails -v 2.3.5
But all I got was:
ERROR: Error installing rails:
rake requires RubyGems version >= 1.3.2
So here's how I got around and installed rails:
gem install rack -v 1.0.1
wget http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz
tar xvzf rubygems-1.3.2.tgz
cd rubygems-1.3.2
ruby setup.rb
gem install rails -v 2.3.5
And bingo, working copy of rails with DSM 4.0-2198 on a DS209+. Not sure if I had to install rack first, but hey, it's working! Last steps for Redmine are to install the MySQL connector and download RedMine (see blogspot reference).
Thanks for the trick on libcrypto.so.0.9.8. I had to do the same thing on copying libssl.so.1.0.0 to libssl.so.0.9.8 (required for the database script).

Related

Error trying to bundle install a ruby new generated project

I just started in Ruby, so after a lookup on internet I installed it using rvm. The version of ruby is 2.6.3. This is the output for ruby -v:
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
I also installed Rails using gem install rails and get the version 6.0.2.1.
After that I created a project called blog using rails new blog, the project was created and in the directory I run bundle install and get the following error message:
There was an error while trying to write to
`/home/ramon/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions`.
It is likely that you need to grant write permissions for that path.
After that I run sudo bundle install and get this error:
Your Ruby version is 2.7.0, but your Gemfile specified 2.6.3
But my Ruby version is already 2.6.3.
After searching for answers on internet I tried these solutions:
sudo gem update bundler
sudo gem install bundler
sudo gem install rails
But all of this returned the same error:
/usr/bin/env: ‘ruby’: No such file or directory
Then I run which ruby and got this: /home/ramon/.rvm/rubies/ruby-2.7.0/bin/ruby
and added this line do .bashrc:
export PATH=$PATH:/home/ramon/.rvm/rubies/ruby-2.7.0/bin/ruby
But still got the error.
I tried changing this line in /etc/login.defs to:
ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/$
And /etc/environment to:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/$
But I dont know what to do anymore, tried every solution on internet and nothing works.
One thing I tried was running which ruby as superuser, and I got nothing.
Maybe it is a PATH problem or a permission problem. But I dont know anymore what to do.
I use lubuntu 19.04.
I think you have two versions of Ruby , so you may try this:
rvm --default use [correct version number]
Create a new file .ruby-version in the main folder of project and put ruby version inside:
2.6.3
or
2.7.0
because I don't know which Ruby version you want do use.
Save and go to the console and do this:
cd ..
cd blog (your project name)

'No such file' error after reinstalling Ruby

At first I could not create a new Ruby project and I was getting a error about the bin path. I uninstalled ruby and reinstalled it.
Now I get this error whene executing rails --version:
mackbookpro:desktop 411techhelp$ rails --version
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:7:in `require': no such file to load -- rubygems (LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:7
What is going on and how can I fix this?
It looks very much like uninstalling ruby also uninstalled rubygems, but you didn't re-install the latter (or your installation of rubygems is/was for a different ruby version).

Issue with gems in RVM, Ruby and Rails installation

I have been trying to get my dev environment setup on my computer for a number of days now, but without any luck. I've had more error messages than I could care to remember and my installation problems have been anything but consistent.
My current problem is unknown as I don't know where its stemming from.
When I try to check my gem version gem -v, the terminal locks up for a couple minutes and then gives me this output:
/Users/Riley/.rvm/bin/gem: line 6: /Users/Riley/.rvm/bin/gem: Argument list too long
/Users/Riley/.rvm/bin/gem: line 6: /Users/Riley/.rvm/bin/gem: Undefined error: 0
The entire contents of that file are as follows:
#!/usr/bin/env bash
if [[ -s "/Users/Riley/.rvm/environments/ruby-2.0.0-p0" ]]
then
source "/Users/Riley/.rvm/environments/ruby-2.0.0-p0"
exec gem "$#"
else
echo "ERROR: Missing RVM environment file: '/Users/Riley/.rvm/environments/ruby-2.0.0-p0'" >&2
exit 1
fi
And I don't have a clue what its supposed to be, if not that. Checking which ruby gives me:
/Users/Riley/.rvm/bin/ruby
And the problem really seems to come alive when I try to install rails, gem install rails:
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
** This error has ceased to occur and is now replaced with the above "line 6" error for gem -v, however I'm sure it will show up again.
I have also tried all of this:
rvm get head --autolibs=3
rvm pkg remove
rvm reinstall all --force
and all the other renditions of solutions on SO and many other sites.
I would greatly appreciate someone helping me with this setup as I don't have any solution to my problem outside of google and SO.
The problem stemmed from my installation of Ruby. Apparently, as stated in this answer, "a non-LLVM version of GCC" is no longer included in the XCode command line tools.
Installing ruby with:
rvm install ruby --with-gcc=clang
Worked and I installed RVM, Ruby and Rails within about 10 minutes, despite it taking me a week of debugging and reinstalling otherwise.
Run rvm requirements and install all the dependencies as specified (openssl being one of them). It should fix your problem.

I deleted some old versions of gems and now rails is broken

So long story short I was running out of room on my dual booted ubuntu laptop. I decided to delete some older versions of gems to make some room which worked. Great, except now I can't get rails to work on my machine anymore - rails console and rails server is failing. This is the error I see when I type in rails s;
jmtoporek#jmtoporek-laptop:~/rails/pskr2$ rails s
/home/jmtoporek/.rvm/gems/ruby-1.9.2-p180/gems/hpricot-0.8.6/lib/fast_xs.so: [BUG] Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
/usr/bin/rails: line 104: 4807 Aborted /usr/bin/ruby /usr/share/rails/railties/bin/rails ${OVERWRITE_OPTION} "${RAILS_PKG_DESTINATION}" "${INTERNAL_OPTIONS}" -d $DATABASE
ln: target `/home/jmtoporek/rails/pskr2/s/vendor/' is not a directory: No such file or directory
ln: creating symbolic link `/home/jmtoporek/rails/pskr2/s/vendor/rails': No such file or directory
ln: creating symbolic link `/home/jmtoporek/rails/pskr2/s/doc/api': No such file or directory
I suppose reinstalling rails should be enough, because it installs several gems to run properly. Simply run gem install rails and see if it works again.
Also, if you use RVM, you can use a different installation executing something like this:
rvm use ruby-1.9.3-p286#rails328 --create --default
..and then, installing rails again:
gem install rails
Just remember this last solution requires you to install all other gems as well.
I reinstalled railties - despite the fact that the gem was already installed something must have gotten messed up. I reinstalled railties, which fixed the issue. I wish I had looked closer at the error message. It appears that there is a copy of railties inside the rails gem directory.

After upgrading Ruby1.9.2 from p180 to p290, libruby dynamic library path isn't updated

I used RVM to upgrade Ruby 1.9.2 from patch level p180 to p290:
rvm upgrade 1.9.2-p180 1.9.2-p290
Then, I used these commands to update my Rails gem and other gems
gem install rails 3.0.5
gem update
Everything seems to be fine; rvm info shows all Ruby binaries and gems have been moved to the correct p290 path (~/.rvm/*/ruby-1.9.2-p290/*).
However, when I go to my Rails application directory and issue the command rails console, I get the error message saying a gem (activesupport-3.0.5) cannot load the libruby.1.9.1.dylib file.
10:30 AM ~/Development/rails_projects/my_app_0515 $ rails console
/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require': dlopen(/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle, 9): Library not loaded: /Users/whk/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (LoadError)
Referenced from: /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle
Reason: image not found - /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle
. . .
Rails can't find the dylib file in ~/.rvm/rubies/ruby-1.9.2-p180/lib, because the p180 path no longer exists, but the file is in ~/.rvm/rubies/ruby-1.9.2-p290/lib.
From a separate StackOverflow post, I found a workaround is adding this line to .bashrc
export DYLD_LIBRARY_PATH="/Users/whk/.rvm/rubies/ruby-1.9.2-p290/lib:$DYLD_LIBRARY_PATH"
However, I want to understand why the rvm ruby upgrade doesn't take care of the lib path change? Does anyone know a cleaner solution -- one that removes the p180 path from where it is configured?
Here are my environment:
Mac OS X 10.6.6 (Snow Leopard)
rvm 1.8.4
ruby 1.9.2p290
Rails 3.0.5
Thanks!
the problem was in gems native extension - their were nto rebuild during rvm upgrade 1.9.2-p180 1.9.2-p290 - next time please have closer look on the output ... it should give your information what's wrong.
as for this particular use case it shoudl be enough to reinstall the given gem:
gem install serialport -v 1.0.4
... not sure if it should be uninstalled first

Resources