Gem install therubyracer -v '0.11.4'? - therubyracer

I'm nearly crazy to install therubyracer. I know there're many people have the same problem with me, and I had also viewd these issues, however it's too complicated for me cause different situations have the different solutions. And in fact, there're have been not a good way to solve the problem. My problem is similar to this, and there have a discussion about it, however there're still have not a conclusion.
In spite of these, this is a good question asked by Chris S, but come not a good result.
① Here is some notes about my problem:
1.ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin15]
2.libv8 3.11.8.17 with native extensions
② OS X El Capitan, 10.11
③ Here is the error messages:
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/hufeipeng/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20151026-41811-14t2l9a.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling accessor.cc
clang: warning: argument unused during compilation: '-rdynamic'
In file included from accessor.cc:1:
In file included from ./rr.h:4:
/usr/local/include/v8.h:353:33: error: use of undeclared identifier 'nullptr'
V8_INLINE MaybeLocal() : val_(nullptr) {}
^
/usr/local/include/v8.h:360:51: error: use of undeclared identifier 'nullptr'
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
^
/usr/local/include/v8.h:364:29: error: use of undeclared identifier 'nullptr'
out->val_ = IsEmpty() ? nullptr : this->val_;
^
/usr/local/include/v8.h:430:50: error: use of undeclared identifier 'nullptr'
bool IsFirstPass() const { return callback_ != nullptr; }
^
/usr/local/include/v8.h:790:42: error: use of undeclared identifier 'nullptr'
V8_INLINE Global() : PersistentBase<T>(nullptr) {}
^
/usr/local/include/v8.h:815:18: error: use of undeclared identifier 'nullptr'
other.val_ = nullptr;
^
/usr/local/include/v8.h:827:18: error: use of undeclared identifier 'nullptr'
rhs.val_ = nullptr;
^
/usr/local/include/v8.h:1092:52: error: use of undeclared identifier 'nullptr'
ScriptOrigin* origin = nullptr));
^
/usr/local/include/v8config.h:347:48: note: expanded from macro 'V8_DEPRECATE_SOON'
#define V8_DEPRECATE_SOON(message, declarator) declarator
^
In file included from accessor.cc:1:
In file included from ./rr.h:4:
/usr/local/include/v8.h:1095:30: error: use of undeclared identifier 'nullptr'
ScriptOrigin* origin = nullptr);
^
/usr/local/include/v8.h:2283:42: error: 'v8::NewStringType' is not a class, namespace, or scoped enumeration
kNormalString = static_cast<int>(v8::NewStringType::kNormal),
^
/usr/local/include/v8.h:2284:48: error: 'v8::NewStringType' is not a class, namespace, or scoped enumeration
kInternalizedString = static_cast<int>(v8::NewStringType::kInternalized)
^
/usr/local/include/v8.h:3205:36: error: use of undeclared identifier 'nullptr'
return NewInstance(context, 0, nullptr);
^
/usr/local/include/v8.h:3434:38: error: 'v8::ArrayBufferCreationMode' is not a class, namespace, or scoped enumeration
ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized);
^
/usr/local/include/v8.h:3797:38: error: 'v8::ArrayBufferCreationMode' is not a class, namespace, or scoped enumeration
ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized);
^
/usr/local/include/v8.h:4457:36: error: 'v8::PropertyHandlerFlags' is not a class, namespace, or scoped enumeration
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
^
/usr/local/include/v8.h:4485:36: error: 'v8::PropertyHandlerFlags' is not a class, namespace, or scoped enumeration
PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
^
/usr/local/include/v8.h:7151:27: error: use of undeclared identifier 'nullptr'
if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty();
^
/usr/local/include/v8config.h:353:54: note: expanded from macro 'V8_UNLIKELY'
# define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
^
In file included from accessor.cc:1:
In file included from ./rr.h:4:
/usr/local/include/v8.h:7596:46: error: 'v8::NewStringType' is not a class, namespace, or scoped enumeration
Set(v8::String::NewFromUtf8(isolate, name, NewStringType::kNormal)
^
In file included from accessor.cc:1:
./rr.h:358:39: error: no member named 'ScriptData' in namespace 'v8'
class ScriptData : public Pointer<v8::ScriptData> {
~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [accessor.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/Users/*/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/therubyracer-0.11.4 for inspection.
Results logged to
/Users/*/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/therubyracer-0.11.4/gem_make.out
Help!
Well, firstly I'm so sorry to reedit the problem again, too busy no time to notice the comments your guys replied for me. And, here, I'm so appreciated that #Javid Jamae afford so great a way to me to solve the problem, although there're still some little matters to deal, but it's ok that we just need the errors to help us find the final answer. The follow is the console after I had try #Javid Jamae way,
First, I have not install gcc with brew before, so I installed it with brew and the version is the latest 5.2.0 (/usr/local/Cellar/gcc/5.2.0). Here is the details:
➜ /Users/xxx >brew install gcc
==> Installing dependencies for gcc: gmp, mpfr, libmpc, isl
==> Installing gcc dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.0.0a.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gmp-6.0.0a.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/gmp/6.0.0a: 15 files, 3.2M
==> Installing gcc dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-3.1.3.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mpfr-3.1.3.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/mpfr/3.1.3: 24 files, 3.6M
==> Installing gcc dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.0.3.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libmpc-1.0.3.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/libmpc/1.0.3: 10 files, 380K
==> Installing gcc dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.14.1.el_capitan.bottle.3.tar.gz
######################################################################## 100.0%
==> Pouring isl-0.14.1.el_capitan.bottle.3.tar.gz
🍺 /usr/local/Cellar/isl/0.14.1: 68 files, 3.2M
==> Installing gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-5.2.0.el_capitan.bottle.2.tar.gz
##################### 29.8%
curl: (56) SSLRead() return error -9806
Error: Failed to download resource "gcc"
Download failed: https://homebrew.bintray.com/bottles/gcc-5.2.0.el_capitan.bottle.2.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
==> Downloading from http://mirrors.ustc.edu.cn/gnu/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
######################################################################## 100.0%
==> Patching
patching file gcc/jit/Make-lang.in
patching file gcc/jit/jit-playback.c
Hunk #1 succeeded at 2459 with fuzz 2 (offset 43 lines).
==> ../configure --build=x86_64-apple-darwin15.0.0 --prefix=/usr/local/Cellar/gcc/5.2.0 --libdir=/usr/local/Cel
==> make bootstrap
==> make install
==> Caveats
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to brew reinstall gcc --without-multilib
==> Summary
🍺 /usr/local/Cellar/gcc/5.2.0: 1353 files, 248M, built in 52.4 minutes
It's seems the installation is ok! And then, I had uninstalled the therubyracer and libv8 with gem. However when it comes to install the therubyracer (I didn't point the version when install or in Gemfile, and the bundle remind me the version 0.12.2 is need), there're comes the error:
➜ /Users/xxx/Documents/workspace/xxx git:(master) ✗ >gem install therubyracer -v '0.12.2'
Fetching: libv8-3.16.14.13.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/xxx/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20151230-50968-1yqguip.rb extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.10
Using compiler: /usr/bin/c++ (clang version 6.1.0)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file:
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o has no symbols
In file included from ../src/accessors.cc:28:
In file included from ../src/v8.h:60:
In file included from ../src/objects-inl.h:38:
In file included from ../src/elements.h:33:
In file included from ../src/heap.h:35:
In file included from ../src/incremental-marking.h:33:
In file included from ../src/mark-compact.h:32:
../src/spaces.h:896:26: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to true [-Werror,-Wtautological-undefined-compare]
bool exists() { return this != NULL && code_range_ != NULL; }
^~~~ ~~~~
../src/spaces.h:898:9: error: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Werror,-Wtautological-undefined-compare]
if (this == NULL || code_range_ == NULL) return false;
^~~~ ~~~~
2 errors generated.
make[1]: ***
[/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/v8_base/src/accessors.o]
Error 1
make: *** [x64.release] Error 2
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive '
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a'to exist, but it was not found (Libv8::Location::Vendor::ArchiveNotFound)
from
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:35:in `each'
from
/Uses/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:35:in `verify_installation!'
from
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/ext/libv8/location.rb:26:in `install!'
from extconf.rb:7:in `<main>'
GYP_GENERATORS=make \
build/gyp/gyp --generator-output="out" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=x64 \
-S.x64 -Dv8_enable_backtrace=1 -
Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2 -
Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
CXX(target)
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
CXX(target)
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
CXX(target)
/Users/xxx/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.13/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
.................. (the follow error messages are similar to above)
Well, I'm wonder it's still the problem of the libv8! At first, I think it's maybe the problem of the version of therubyracer, so I had make a try to install the version 0.12.0, unfortunately, there're the same errors. There're something strange, I mean the libv8 is installed with the therubyracer in my case (see that from the error messages), but you're different with me. As your suggestion marked you install the libv8 after you had installed the therubyracer, why they're different? Maybe it's relate to my ruby environment settings, here I posted my Gemfile configuration:
gem 'rails', '4.1.6'
gem 'mysql2', '0.3.18'
gem 'sass-rails', '~> 4.0.3'
gem 'bootstrap-sass', '~> 3.3.4'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails','3.1.2'
gem 'jquery-ui-rails', '4.0.5'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'log4r', '1.1.9'
gem 'devise','3.4.1'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '3.6.0'
gem 'thin','1.6.2'
gem 'kaminari', '0.16.1'
gem 'factory_girl_rails'
gem 'httparty'
gem "select2-rails",'3.5.9.3'
group :test, :development do
gem 'net-ssh', '2.7.0'
gem 'capistrano', '2.12.0'
gem 'capistrano-rbenv', '1.0.1'
gem 'spring'
gem 'magic_encoding', '0.0.2'
gem 'rspec-rails', '3.2.0'
end

This worked for me:
$ brew upgrade gcc
$ gem uninstall therubyracer
$ gem uninstall libv8
$ gem install therubyracer -v '0.12.0'
Fetching: therubyracer-0.12.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed therubyracer-0.12.0
1 gem installed
$ gem install libv8 -v '3.16.14.3' -- --with-system-v8
Fetching: libv8-3.16.14.3.gem (100%)
Building native extensions with: '--with-system-v8'
This could take a while...
Successfully installed libv8-3.16.14.3
1 gem installed
References:
https://github.com/cowboyd/therubyracer/issues/398
https://github.com/cowboyd/therubyracer/issues/288#issuecomment-63923606

I had the sam problem in OSX El Capitan. The steps I used to get over this were
First check if V8 is installed or not. I used brew to install it.
brew install homebrew/versions/v8-315
Try uninstalling libv8, therubyracer gems if some instance exists.
gem uninstall -a libv8
gem uninstall -a therubyracer
Then install the libv8 gem.
gem install libv8 -v '<<VERSION>>' -- --with-system-v8
Then install the therubyracer gem.
gem install therubyracer -v '<<VERSION>>' -- --with-v8-dir=$(brew --prefix v8-315)

I had the same problem, updating therubyracer to the latest version solved the issue.
Try:
bundle update therubyracer
If you also have issues with libv8 then try:
bundle update libv8

Related

Getting error while running buildout for Setting Plumi and Zope Server on Linux using command "python3 bootstrap.py -c production.cfg"

I was installing Plumi for creating a production site. after installing plumi.app i faced below error whie running buildout using command : python3 bootstrap.py -c production.cfg
Note:: Zope is installed and zope user is added..
The ERROR IS BELOW::enter image description here
root#Saif:/home/plumi.app# /bin/python3 bootstrap.py && ./bin/buildout -v
ez_setup.py is deprecated and when using it setuptools will be pinned to 33.1.1 since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools
Downloading https://pypi.io/packages/source/s/setuptools/setuptools-33.1.1.zip
Extracting in /tmp/tmpvwkpnumd
Now working in /tmp/tmpvwkpnumd/setuptools-33.1.1
Building a Setuptools egg in /tmp/tmpgfkbh3om
warning: no files found matching '*' under directory 'setuptools/_vendor'
/tmp/tmpgfkbh3om/setuptools-33.1.1-py3.8.egg
Couldn't find index page for 'zc.buildout' (maybe misspelled?)
Couldn't find index page for 'zc.buildout' (maybe misspelled?)
No local packages or working download links found for zc.buildout
error: Could not find suitable distribution for Requirement.parse('zc.buildout')
Traceback (most recent call last):
File "bootstrap.py", line 171, in <module>
raise Exception(
Exception: Failed to execute command:
'/bin/python3', '-c', 'from setuptools.command.easy_install import main; main()', '-mZqNxd', '/tmp/tmpgfkbh3om', 'zc.buildout'
root#Saif:/home/plumi.app# ^C
root#Saif:/home/plumi.app# python3 bootstrap.py -c production.cfg
ez_setup.py is deprecated and when using it setuptools will be pinned to 33.1.1 since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools
Downloading https://pypi.io/packages/source/s/setuptools/setuptools-33.1.1.zip
Extracting in /tmp/tmp6dqehae9
Now working in /tmp/tmp6dqehae9/setuptools-33.1.1
Building a Setuptools egg in /tmp/tmpdja0839z
warning: no files found matching '*' under directory 'setuptools/_vendor'
/tmp/tmpdja0839z/setuptools-33.1.1-py3.8.egg
Couldn't find index page for 'zc.buildout' (maybe misspelled?)
Couldn't find index page for 'zc.buildout' (maybe misspelled?)
No local packages or working download links found for zc.buildout
error: Could not find suitable distribution for Requirement.parse('zc.buildout')
Traceback (most recent call last):
File "bootstrap.py", line 171, in <module>
raise Exception(
Exception: Failed to execute command:
'/usr/bin/python3', '-c', 'from setuptools.command.easy_install import main; main()', '-mZqNxd', '/tmp/tmpdja0839z', 'zc.buildout'
warning: no files found matching '*' under directory 'setuptools/_vendor'
I found out that setuptools version 33.1.1 doesn't have vendor folder.
https://github.com/pypa/setuptools/tree/v33.1.1/setuptools

How to compile sqlite3 extension - CSV virtual table

I am trying to use the CSV Virtual Table extension for sqlite3. I get stuck on the first step of compiling the extension on a Mac (MacOS High Sierra 10.13.6).
I downloaded the source code for csv.c from this page. I also grabbed the sqlite source code amalgamation from here.
I used the following command to compile:
gcc -g -fPIC -dynamiclib csv.c -o csv.dylib
However, I get the following error:
csv.c:115:3: error: no member named '__builtin___vsnprintf_chk' in 'struct sqlite3_api_routines'
sqlite3_vsnprintf(CSV_MXERR, p->zErr, zFormat, ap);
^~~~~~~~~~~~~~~~~
/usr/include/sqlite3ext.h:437:53: note: expanded from macro 'sqlite3_vsnprintf'
#define sqlite3_vsnprintf sqlite3_api->vsnprintf
~~~~~~~~~~~ ^
/usr/include/secure/_stdio.h:75:3: note: expanded from macro 'vsnprintf'
__builtin___vsnprintf_chk (str, len, 0, __darwin_obsz(str), format, ap)
^
csv.c:115:21: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
sqlite3_vsnprintf(CSV_MXERR, p->zErr, zFormat, ap);
^~~~~~~~~
csv.c:67:19: note: expanded from macro 'CSV_MXERR'
#define CSV_MXERR 200
^~~
/usr/include/secure/_stdio.h:75:57: note: expanded from macro 'vsnprintf'
__builtin___vsnprintf_chk (str, len, 0, __darwin_obsz(str), format, ap)
^~~
/usr/include/secure/_common.h:39:54: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
^~~~~~
csv.c:568:5: error: use of undeclared identifier 'sqlite3_str'
sqlite3_str *pStr = sqlite3_str_new(0);
^
csv.c:568:18: error: use of undeclared identifier 'pStr'
sqlite3_str *pStr = sqlite3_str_new(0);
^
csv.c:568:25: warning: implicit declaration of function 'sqlite3_str_new' is invalid in C99 [-Wimplicit-function-declaration]
sqlite3_str *pStr = sqlite3_str_new(0);
^
csv.c:571:5: warning: implicit declaration of function 'sqlite3_str_appendf' is invalid in C99 [-Wimplicit-function-declaration]
sqlite3_str_appendf(pStr, "CREATE TABLE x(");
^
csv.c:571:25: error: use of undeclared identifier 'pStr'
sqlite3_str_appendf(pStr, "CREATE TABLE x(");
^
csv.c:581:29: error: use of undeclared identifier 'pStr'
sqlite3_str_appendf(pStr, "%sc%d TEXT", zSep, iCol);
^
csv.c:588:31: error: use of undeclared identifier 'pStr'
sqlite3_str_appendf(pStr,"%s\"%w\" TEXT", zSep, z);
^
csv.c:597:31: error: use of undeclared identifier 'pStr'
sqlite3_str_appendf(pStr,"%sc%d TEXT", zSep, ++iCol);
^
csv.c:603:25: error: use of undeclared identifier 'pStr'
sqlite3_str_appendf(pStr, ")");
^
csv.c:604:18: warning: implicit declaration of function 'sqlite3_str_finish' is invalid in C99 [-Wimplicit-function-declaration]
CSV_SCHEMA = sqlite3_str_finish(pStr);
^
csv.c:604:37: error: use of undeclared identifier 'pStr'
CSV_SCHEMA = sqlite3_str_finish(pStr);
^
csv.c:643:27: error: use of undeclared identifier 'SQLITE_VTAB_DIRECTONLY'
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
^
4 warnings and 10 errors generated.
What am I doing wrong?
Richard Hipp at sqlite.org posted a solution on how to compile an SQLite extension.
The script for compiling the CSV extension looks like this (based on https://www.sqlite.org/loadext.html and https://github.com/sqlite/sqlite/blob/master/README.md):
wget https://www.sqlite.org/src/tarball/sqlite.tar.gz
tar xzf sqlite.tar.gz
mkdir bld
cd bld
../sqlite/configure
make
gcc -g -I. -fPIC -dynamiclib ../sqlite/ext/misc/csv.c -o csv.dylib
Testing the script:
echo -e 'col_text,col_int\napples,3\noranges,5' > sample.csv
./sqlite3 '' '.load csv' 'CREATE VIRTUAL TABLE temp.t1 USING csv(filename="sample.csv");' 'SELECT * FROM t1;'
That's it.
You can also try compiling csv.c with an existing sqlite3 installation. For sqlite3 installed with Homebrew, it would be:
curl -O https://raw.githubusercontent.com/sqlite/sqlite/master/ext/misc/csv.c
gcc -g -I/usr/local/opt/sqlite/include -fPIC -dynamiclib csv.c -o csv.dylib
/usr/local/opt/sqlite/bin/sqlite3 '' '.load csv'
The last line is testing the newly compiled library in the Homebrew sqlite3. The default $ sqlite3 comes from the MacOS bundle and is outdated sometimes.
I managed to find a workaround and use an Ubuntu docker container, where I was able to successfully compile and use the extension. Here are the steps I followed:
docker run -ti --rm -v $(pwd):/host ubuntu bash
# Steps to build SQLite and CSV Virtual Table extension from source inside an Ubuntu docker container
cd /host
apt update
apt install -y vim build-essential zip wget
wget https://sqlite.org/2020/sqlite-autoconf-3310100.tar.gz
tar xvf sqlite-autoconf-3310100.tar.gz
cd sqlite-autoconf-3310100
./configure
make
./sqlite3
# Obtain csv.c and change <sqlite3ext.h> to "sqlite3ext.h" in the file
vi csv.c
gcc -g -fPIC -shared csv.c -o csv.so
./sqlite3
#sqlite> .load ./csv
#sqlite> CREATE VIRTUAL TABLE temp.t1 USING csv(filename='/host/users.csv',header);
#sqlite> .headers on
#sqlite> SELECT * FROM t1 LIMIT 1;
You can use a similar process to build for a Lambda function (CentOS). See this github repo for more details.
I still haven't figured out how to get it to compile directly on Mac, so any help would be greatly appreciated!
Leveraging off of Anton's answer for an Ubuntu-like distro, the following is mostly workable:
wget https://www.sqlite.org/src/tarball/sqlite.tar.gz
tar xzf sqlite.tar.gz
mkdir bld
cd bld
../sqlite/configure
make
A gotchas in getting this far:
You may need to do this:
sudo apt-get install tcl8.6-dev
It will complain about not having access to tcl. If that's the case, you need to install and go back to the configure step.
Now, make should work unless you have other missing dependencies.
Assuming that works, now for the gcc:
gcc -I. -fPIC -shared ../sqlite/ext/misc/csv.c -o csv.so -lm
Now it's time to run. You need to set LD_LIBRARY_PATH. Assuming you are still in the bld directory:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
or substitute the `pwd` for your full path to the csv.so file.
NOW! Now, you can run it. Enjoy.

Error installing npm grunt-libsass

I'm trying to install grunt-libsass like this:
npm install grunt-libsass --save-dev
but I get this error:
npm WARN engine grunt-libsass#0.2.1: wanted: {"node":"0.10.27"} (current: {"node":"5.1.1","npm":"3.3.12"})
npm WARN engine grunt-libsass#0.2.1: wanted: {"node":"0.10.27"} (current: {"node":"5.1.1","npm":"3.3.12"})
npm WARN deprecated grunt-libsass#0.2.1: No longer maintained
> node-sass#0.9.6 install /Applications/MAMP/htdocs/tome/wp-content/node_modules/node-sass
> node build.js
(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
CXX(target) Release/obj.target/binding/binding.o
In file included from ../binding.cpp:1:
../../nan/nan.h:189:68: error: too many arguments to function call, expected at most 2, have 4
return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~
/Users/goliathus/.node-gyp/5.1.1/include/node/v8.h:4674:3: note: 'New' declared here
static Local<Signature> New(
^
In file included from ../binding.cpp:1:
../../nan/nan.h:271:3: error: redefinition of 'NanNew'
what does the error say and how to fix it?
I recommend you to use grunt-sass instead of grunt-libsass because it is no longer maintained.
This task uses libsass which is a Sass compiler in C++.

trouble compiling chrome native client tutorial

I tried following the tutorial here for NaCl or PNaCl or native client or pinnacle whatever the name of the day is and got this:
F:/nacl_sdk/pepper_31/toolchain/win_x86_newlib/bin/i686-nacl-g++ -o hello_tutori
al_x86_32.nexe hello_tutorial_32.o -m32 -O0 -g -IF:/nacl_sdk/pepper_31/include -
lppapi_cpp -lppapi
/x86_64-nacl-ld: cannot find -lppapi_cpp
collect2: ld returned 1 exit status
Makefile:64: recipe for target 'hello_tutorial_x86_32.nexe' failed
make: * [hello_tutorial_x86_32.nexe] Error 1
Any ideas?
It looks like you are running the old "hello_tutorial" example with the new pepper_31 SDK. Please use this new documentation instead:
https://developers.google.com/native-client/dev/devguide/tutorial/tutorial-part1
This source for this tutorial can be found in the pepper_31 SDK in the directory pepper_31\getting_started\part1.
The new tutorial cited by binji is set up to build/run a pexe. To use nexe's as in the older example, update the tutorial's Makefile:
Add LDFLAGS for each target:
LDFLAGS_NEWLIB_ARM := -L$(NACL_SDK_ROOT)/lib/newlib_arm/Release -lppapi_cpp -lppapi
LDFLAGS_NEWLIB_X86_32 := -L$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release -lppapi_cpp -lppapi
LDFLAGS_NEWLIB_X86_64 := -L$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release -lppapi_cpp -lppapi
and change the $(LDFLAGS) specified for linking the respective targets.

Cannot install passenger standalone 3.0.X on Mac OS X Mavericks, nginx compile fails

Trying to develop an existing Rails 3.0 application on a Mac with a clean install of Mavericks. Passenger Standalone was working fine under Mountain Lion. I upgraded to Mavericks, installed the command line tools, ruby, bundler, etc. When I get to this step:
passenger start
And passenger tries to compile nginx, it fails out with this error:
adding module in /Users/ben/.passenger/standalone/3.0.21-x86_64-ruby1.9.3-macosx-10.9/support/ext/nginx
*** The Phusion Passenger support files are not yet compiled. Compiling them for you... ***
*** Running 'rake nginx RELEASE=yes' in /Users/ben/.passenger/standalone/3.0.21-x86_64-ruby1.9.3-macosx-10.9/support/ext/nginx... ***
(in /Users/ben/.passenger/standalone/3.0.21-x86_64-ruby1.9.3-macosx-10.9/support)
g++ -Iext -D_REENTRANT -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" -DHAS_ALLOCA_H -DHAS_SFENCE -DHAS_LFENCE -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/common/libboost_oxt/aggregate.o -c ext/common/libboost_oxt/aggregate.cpp
In file included from ext/common/libboost_oxt/aggregate.cpp:8:
In file included from ext/oxt/system_calls.cpp:26:
In file included from ext/boost/thread.hpp:24:
In file included from ext/boost/thread/future.hpp:14:
In file included from ext/boost/exception_ptr.hpp:9:
In file included from ext/boost/exception/detail/exception_ptr.hpp:19:
In file included from ext/boost/exception/info.hpp:15:
In file included from ext/boost/exception/to_string_stub.hpp:15:
In file included from ext/boost/exception/detail/object_hex_dump.hpp:14:
ext/boost/exception/detail/type_info.hpp:53:9: error: cannot define the implicit default assignment operator for 'boost::exception_detail::type_info_', because non-static reference member 'type_' can't use default assignment operator
type_info_
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tree:1246:35: note: in instantiation of member function 'std::__1::pair<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base> >::operator=' requested here
__cache->__value_ = *__first;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__tree:1187:9: note: in instantiation of function template specialization 'std::__1::__tree<std::__1::pair<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base> >, std::__1::__map_value_compare<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base>, std::__1::less<boost::exception_detail::type_info_>, true>, std::__1::allocator<std::__1::pair<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base> > > >::__assign_multi<std::__1::__tree_const_iterator<std::__1::pair<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base> >, const std::__1::__tree_node<std::__1::pair<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base> >, void *> *, long> >' requested here
__assign_multi(__t.begin(), __t.end());
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:766:21: note: in instantiation of member function 'std::__1::__tree<std::__1::pair<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base> >, std::__1::__map_value_compare<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base>, std::__1::less<boost::exception_detail::type_info_>, true>, std::__1::allocator<std::__1::pair<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base> > > >::operator=' requested here
__tree_ = __m.__tree_;
^
ext/boost/exception/info.hpp:160:26: note: in instantiation of member function 'std::__1::map<boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base>, std::__1::less<boost::exception_detail::type_info_>, std::__1::allocator<std::__1::pair<const boost::exception_detail::type_info_, boost::shared_ptr<boost::exception_detail::error_info_base> > > >::operator=' requested here
c->info_ = info_;
^
ext/boost/exception/detail/type_info.hpp:55:41: note: declared here
detail::sp_typeinfo const & type_;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/utility:255:15: note: implicit default copy assignment operator for 'boost::exception_detail::type_info_' first required here
first = __p.first;
^
1 error generated.
rake aborted!
Command failed with status (1): [g++ -Iext -D_REENTRANT -I/usr/local/inclu...]
Tasks: TOP => nginx => agents/nginx/PassengerHelperAgent => ext/common/libboost_oxt.a => ext/common/libboost_oxt/aggregate.o
(See full trace by running task with --trace)
*** ERROR: command failed: sh ./configure --prefix=/tmp --with-cc-opt='-Wno-error' --without-pcre --without-http_rewrite_module --without-http_fastcgi_module '--add-module=/Users/ben/.passenger/standalone/3.0.21-x86_64-ruby1.9.3-macosx-10.9/support/ext/nginx'
You are using Phusion Passenger 3.0.21. That version does not work on Mavericks. Upgrade to 4.0.21 instead. By the way, the recommended way to install Passenger on OS X these days is via Homebrew. Follow the guide at https://www.phusionpassenger.com/download#open_source

Resources