Thursday, October 06, 2016

Solve Rails Native Compile Issue

I seldom blog about issue on Windows, because I don't really have a Windows machine with me. This will be an exceptional case that I show how to solve a Rails' native compile issue.

If you see an error from Rails on Windows system, something similar like this

c:> gem install son
...
ERROR: Error installing json:
ERROR: Failed to build gem native extension

The reason is, gem try to build native library to improve performance, but it was not able to do it on your Windows system.

The easiest is to install DevKit from http://rubyinstaller.org/downloads/. The DevKit will be installed at c:\DevKit. Just take note which DevKit to be installed, 32 bits or 64 bits.

Set Windows system PATH environment:
Control Panel > System > Advanced system settings
System Properties > Environment Variables > (Select Path and Edit...), add a new Path
c:\DevKit\bin

start a new command prompt (cmd):
c:> gem install json

You should be able to install json now.

Wednesday, August 10, 2016

Qualcomm bugs exposed nearly 1 billion Android devices

Qualcomm snapdragon cpu is a very popular ARM based SoC CPU used by many Android devices.

These are some of the popular mobile phone which use snapdragon:

Samsung Note 7, Snapdragon 820

OnePlus 3, Snapdragon 820

HTC 10, Snapdragon 820

Reference:

Qualcomm bugs expose nearly 1 billion Android devices to exploits, Extreme Tech.

Wednesday, June 15, 2016

Fighting with Ruby on Rails on old Snow Leopard


Finally I give it a try for Ruby on Rails. The first thing I want to do is install Ruby on Rails. According to the tutorial, I need ruby 1.9.3, then using ruby gem to install rails 2.3.2.

This is not a tutorial, but just show what doesn't works for me. You might not able to get you solution here.

There are a few ways to install Ruby on Rails on Mac OS X:
1. Use Gem on OS X system.
2. Homebrew
3. RVMß (this works for me)

Homebrew

Since then gem version (1.8.7) is a bit too old, I use homebrew to install.
$ brew install ruby
The gem came with ruby, use gem to install rails. Before install rails, I disable ruby document.
$ edit ~/.gemrc
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
gem: --no-ri
gem: --no-rdoc

$ export GEM_HOME=$HOME/.gems
$ export PATH=$GEM_HOME/bin:$PATH

This suppose to be the way, unfortunately I can't get homebrew to compile ruby on OS X 10.6.

Compile from source

I try to compile from downloaded source, both ruby-2.3.1, ruby-2.3.0 are unable to compile successfully on my OS X 10.6.3. So I compile ruby on another machine with OS X 10.9 Mavericks, and copy the binary to OS X 10.6. The binary can't execute properly.

This really drive me crazy.

I try to use the system gem to install rails, but since the gem version is too old, it can't install the later rails.

RVM, Ruby Version Manager

Try Install ruby on rail with rvm version 1.27.0
$ curl -L https://get.rvm.io | bash -s stable --auto-dotfiles --autolibs=enable --rails
OR just install ruby
$ curl -L https://get.rvm.io | bash -s stable --auto-dotfiles --autolibs=enable --ruby
Ok
Finally the RVM works. The binaries installed in $HOME/.rvm directory

Note:

After some time later, I try to install ruby with homebrew again, and it works! I don't know what changes or configuration I have done.

$ ruby -v
ruby 2.3.1p112
$ gem -v
2.6.4
$ rails -v
4.2.6