Rails: precompile Segmentation fault on Debian-Collection of common programming errors

I got Rails application, it works fine on Fedora using

bundle install
rake db:create RAILS_ENV=production 
rake db:reset RAILS_ENV=production 
rake db:seed RAILS_ENV=production 
rake assets:clean rake assets:precompile

but on Debian when i do

rake:assets:precompile --trace I get the below error trace

** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/bin/ruby /usr/local/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Segmentation fault

  (in /home/debian/Progetti/elenos/beaglebone.rails/app/assets/javascripts/app.js.coffee)/usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:142:in `exec_runtime'
/usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:28:in `block in exec'
/usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
/usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:27:in `exec'
/usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:19:in `eval'
/usr/local/lib/ruby/gems/2.0.0/gems/execjs-2.0.2/lib/execjs/external_runtime.rb:33:in `call'
/usr/local/lib/ruby/gems/2.0.0/gems/coffee-script-2.2.0/lib/coffee_script.rb:57:in `compile'
/usr/local/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/coffee.rb:46:in `evaluate'
/usr/local/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:12:in `initialize'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `new'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `block in build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:270:in `circular_call_protection'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:248:in `build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:105:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:97:in `build_required_assets'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/processed_asset.rb:16:in `initialize'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `new'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:249:in `block in build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:270:in `circular_call_protection'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:248:in `build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:16:in `initialize'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/usr/local/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:19:in `block in compile'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/usr/local/lib/ruby/gems/2.0.0/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/usr/local/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/sprockets/static_compiler.rb:18:in `compile'
/usr/local/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:56:in `internal_precompile'
/usr/local/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:70:in `block (3 levels) in '
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/usr/local/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in '
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/bin/rake:33:in `'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby /usr/local/bin/rake as...]
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/file_utils.rb:54:in `block in create_shell_runner'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/file_utils.rb:45:in `call'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/file_utils.rb:45:in `sh'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/file_utils_ext.rb:37:in `sh'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/file_utils.rb:82:in `ruby'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/file_utils_ext.rb:37:in `ruby'
/usr/local/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/usr/local/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/usr/local/lib/ruby/gems/2.0.0/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in '
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/usr/local/lib/ruby/gems/2.0.0/gems/rake-10.1.1/bin/rake:33:in `'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `'
Tasks: TOP => assets:precompile

Googling the issue the problem would be resolved by inserting into the Gemfile inside assets group gem therubyracer but when i do bundle install i see

Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies.......
Using rake 10.1.1
Using i18n 0.6.1
Using multi_json 1.9.0
Using activesupport 3.2.13
Using builder 3.0.4
Using activemodel 3.2.13
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.5
Using rack-cache 1.2
Using rack-test 0.6.2
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.2.2
Using actionpack 3.2.13
Using mime-types 1.25.1
Using polyglot 0.3.4
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 3.2.13
Using arel 3.0.3
Using tzinfo 0.3.39
Using activerecord 3.2.13
Using activeresource 3.2.13
Using bcrypt 3.1.7
Using bcrypt-ruby 3.1.5
Using coderay 1.1.0
Using better_errors 1.1.0
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using bundler 1.6.1
Using callsite 0.0.11
Using cancan 1.6.10
Using coffee-script-source 1.7.0
Using execjs 2.0.2
Using coffee-script 2.2.0
Using rack-ssl 1.3.3
Using json 1.8.1
Using rdoc 3.12.2
Using thor 0.18.1
Using railties 3.2.13
Using coffee-rails 3.2.1
Using orm_adapter 0.5.0
Using warden 1.2.3
Using devise 2.2.3
Using diff-lcs 1.2.5
Using eventmachine 1.0.3
Using factory_girl 4.4.0
Using factory_girl_rails 4.4.1
Using font-awesome-rails 4.0.3.1
Using sass 3.3.2
Using foundation-rails 5.2.0.0
Using jbuilder 2.0.4
Using jquery-rails 3.1.0
Using knockoutjs-rails 3.0.0
Installing libv8 3.11.8.17
Using memcached 1.7.2
Using rack-contrib 1.1.0
Using meta_request 0.2.8
Using rails 3.2.13
Using ref 1.0.5
Using rspec-core 2.14.8
Using rspec-expectations 2.14.5
Using rspec-mocks 2.14.6
Using rspec-rails 2.14.2
Using ruby-dbus 0.11.0
Using sass-rails 3.2.3
Using serialport 1.3.0
Using sqlite3 1.3.9

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb -fPIC
checking for main() in -lpthread... yes
checking for v8.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling constraints.cc
compiling date.cc
compiling trycatch.cc
compiling backref.cc
compiling script.cc
compiling value.cc
compiling exception.cc
compiling locker.cc
compiling message.cc
compiling rr.cc
compiling array.cc
compiling function.cc
compiling v8.cc
compiling stack.cc
compiling invocation.cc
compiling primitive.cc
compiling gc.cc
compiling external.cc
compiling handles.cc
compiling string.cc
compiling template.cc
compiling heap.cc
compiling init.cc
compiling context.cc
context.cc: In static member function ‘static VALUE rr::Context::IsCodeGenerationFromStringsAllowed(VALUE)’:
context.cc:93:30: error: ‘class v8::Context’ has no member named ‘IsCodeGenerationFromStringsAllowed’
context.cc:94:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [context.o] Error 1

make failed, exit code 2

Gem files will remain installed in /tmp/bundler20140409-18783-1eqgjce/therubyracer-0.11.4/gems/therubyracer-0.11.4 for inspection.
Results logged to /tmp/bundler20140409-18783-1eqgjce/therubyracer-0.11.4/extensions/armv7l-linux/2.0.0-static/therubyracer-0.11.4/gem_make.out
An error occurred while installing therubyracer (0.11.4), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.11.4'` succeeds before bundling.

tried using

gem install therubyracer -v '0.12.1' having

Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
    ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb
checking for main() in -lpthread... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling constraints.cc
compiling date.cc
compiling trycatch.cc
compiling backref.cc
compiling script.cc
compiling value.cc
compiling exception.cc
compiling locker.cc
compiling message.cc
compiling rr.cc
compiling array.cc
compiling function.cc
compiling v8.cc
compiling stack.cc
compiling invocation.cc
compiling primitive.cc
compiling gc.cc
compiling external.cc
compiling handles.cc
compiling string.cc
compiling template.cc
compiling heap.cc
compiling init.cc
compiling context.cc
compiling constants.cc
compiling signature.cc
compiling object.cc
compiling accessor.cc
linking shared-object v8/init.so
/usr/bin/ld: /usr/local/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/vendor/v8/out/arm.release/obj.target/tools/gyp/libv8_base.a(api.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/vendor/v8/out/arm.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [init.so] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/therubyracer-0.12.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/armv7l-linux/2.0.0-static/therubyracer-0.12.1/gem_make.out

using

sudo apt-get install libv8-dev
gem install therubyracer

same output

apt-get -y install rake
gem install rake-compiler
gem install therubyracer --pre

same output

inside the Gemfile using gem 'therubyracer', :platform => :ruby and running bundle install

adding swap on my system

adding on app/config/enviroment/production.rb config.assets.compile = true

installing various versions of gem therubyracer

but nothing fix my issue.

probably the keyword

/usr/bin/ld: /usr/local/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/vendor/v8/out/arm.release/obj.target/tools/gyp/libv8_base.a(api.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC

but i dont know how to fix i finished the bullets.