New rails project error

Hi all,

I install Ruby1.9.2po0 and Rails3.2.3 on RedHat5 x86_64
When I create a project “rails nwe chapter”

It show below error message:


Installing sqlite3 (1.3.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.

    /usr/local/ruby/bin/ruby extconf.rb

checking for sqlite3.h… yes
checking for sqlite3_libversion_number() in -lsqlite3… yes
checking for rb_proc_arity()… yes
checking for sqlite3_initialize()… no
checking for sqlite3_backup_init()… no
checking for sqlite3_column_database_name()… no
checking for sqlite3_enable_load_extension()… no
checking for sqlite3_load_extension()… no
creating Makefile

make
gcc -I. -I/usr/local/ruby/include/ruby-1.9.1/x86_64-linux
-I/usr/local/ruby/include/ruby-1.9.1/ruby/backward
-I/usr/local/ruby/include/ruby-1.9.1 -I. -DHAVE_RB_PROC_ARITY -fPIC
-O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith
-Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o
database.o -c database.c
database.c: In function ‘initialize’:
database.c:47: error: ‘SQLITE_OPEN_READWRITE’ undeclared (first use in
this function)
database.c:47: error: (Each undeclared identifier is reported only once
database.c:47: error: for each function it appears in.)
database.c:47: error: ‘SQLITE_OPEN_CREATE’ undeclared (first use in this
function)
database.c:79: error: ‘SQLITE_OPEN_READONLY’ undeclared (first use in
this function)
database.c: In function ‘set_sqlite3_func_result’:
database.c:285: error: ‘sqlite3_int64’ undeclared (first use in this
function)
make: *** [database.o] Error 1

Gem files will remain installed in
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.5 for inspection.
Results logged to
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.5), and Bundler cannot
continue.
Make sure that gem install sqlite3 -v '1.3.5' succeeds before bundling


I also try to “gem install sqlite3” but it show:


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

    /usr/local/ruby/bin/ruby extconf.rb

checking for sqlite3.h… yes
checking for sqlite3_libversion_number() in -lsqlite3… yes
checking for rb_proc_arity()… yes
checking for sqlite3_initialize()… no
checking for sqlite3_backup_init()… no
checking for sqlite3_column_database_name()… no
checking for sqlite3_enable_load_extension()… no
checking for sqlite3_load_extension()… no
creating Makefile

make
gcc -I. -I/usr/local/ruby/include/ruby-1.9.1/x86_64-linux
-I/usr/local/ruby/include/ruby-1.9.1/ruby/backward
-I/usr/local/ruby/include/ruby-1.9.1 -I. -DHAVE_RB_PROC_ARITY -fPIC
-O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith
-Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o
database.o -c database.c
database.c: In function ‘initialize’:
database.c:47: error: ‘SQLITE_OPEN_READWRITE’ undeclared (first use in
this function)
database.c:47: error: (Each undeclared identifier is reported only once
database.c:47: error: for each function it appears in.)
database.c:47: error: ‘SQLITE_OPEN_CREATE’ undeclared (first use in this
function)
database.c:79: error: ‘SQLITE_OPEN_READONLY’ undeclared (first use in
this function)
database.c: In function ‘set_sqlite3_func_result’:
database.c:285: error: ‘sqlite3_int64’ undeclared (first use in this
function)
make: *** [database.o] Error 1

Gem files will remain installed in
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.5 for inspection.
Results logged to
/usr/local/ruby/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out


How to fixed this problem?

Or do I change database to mysql from sqlite3?

Thanks,

El mircoles 4 de abril de 2012 15:30:15 UTC+2, Ruby-Forum.com User
escribi:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
checking for sqlite3_load_extension()… no
database.c:47: error: ‘SQLITE_OPEN_READWRITE’ undeclared (first use in
make: *** [database.o] Error 1

checking for sqlite3_initialize()… no
-O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith
this function)

Posted via http://www.ruby-forum.com/.

I never faced this problem myself and I can’t assure this will solve it
but
having seen other similar problems, I’d start by checking that your
system
has the ‘libsqlite3-dev’ package installed.

Anyway its probably better to install mysql or other db system, as you
will
do it eventually anyway. Just make sure you install the ‘-dev’ packages
as
well.

Regards.

Juan P. Avello wrote in post #1055004:

El mircoles 4 de abril de 2012 15:30:15 UTC+2, Ruby-Forum.com User
escribi:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
checking for sqlite3_load_extension()… no
database.c:47: error: ‘SQLITE_OPEN_READWRITE’ undeclared (first use in
make: *** [database.o] Error 1

checking for sqlite3_initialize()… no
-O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith
this function)

Posted via http://www.ruby-forum.com/.

I never faced this problem myself and I can’t assure this will solve it
but
having seen other similar problems, I’d start by checking that your
system
has the ‘libsqlite3-dev’ package installed.

Anyway its probably better to install mysql or other db system, as you
will
do it eventually anyway. Just make sure you install the ‘-dev’ packages
as
well.

Regards.

Is the 32bit or 64bit problems?

How to check ‘libsqlite3-dev’/’-dev’ installed or not?

Thanks & Best Regards

Juan P. Avello wrote in post #1055007:

If you are using ubuntu or other apt- system, you can check: aptitude
search sqlite3, which will list packages containing that word; installed
packages will look like “i libsqlite3-dev…”. Not installed packages
will appear with ‘p’ instead of ‘i’.

El mircoles 4 de abril de 2012 16:26:40 UTC+2, Ruby-Forum.com User
escribi:

I can install mysql by ‘gem install mysql’

My system redhat5 can’t use apt- to update or download, so can’t use
aptitude to search sqlite3

Could I change the sqlite3 to mysql when ‘rails new project’ created and
how to do?

Thanks,

On 4 April 2012 16:23, CC Chen [email protected] wrote:

I can install mysql by ‘gem install mysql’

My system redhat5 can’t use apt- to update or download, so can’t use
aptitude to search sqlite3

Could I change the sqlite3 to mysql when ‘rails new project’ created and
how to do?

All you have to do is change database.yml and Gemfile, but you will
run into similar problems I expect installing mysql gems and others.
You will need to install various development libraries. You need to
find out how to install stuff on your system, you will have no hope of
getting very far otherwise. Alternatively change to ubuntu where you
will find more help here.

Colin

If you are using ubuntu or other apt- system, you can check: aptitude
search sqlite3, which will list packages containing that word; installed
packages will look like “i libsqlite3-dev…”. Not installed packages
will appear with ‘p’ instead of ‘i’.

El mircoles 4 de abril de 2012 16:26:40 UTC+2, Ruby-Forum.com User
escribi:

http://sachachua.com/blog/p/22184/

2012/4/4 CC Chen [email protected]

Installing sqlite3 (1.3.5) with native extensions
checking for sqlite3_enable_load_extension()… no
database.c: In function ‘initialize’:
function)


database.c:47: error: (Each undeclared identifier is reported only once
Gem files will remain installed in


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


att,

Rogerio

A complicao se descomplica na mesma proporo que fazemos os ns se
desatarem ao tecer o conhecimento do saber.

Try to use RVM on Debian too
http://beginrescueend.com/os/debian/
http://blog.beyondthecorner.co.uk/2010/04/06/installing-rvm-on-debian-lenny/
it’s gonna solve all your Gem dependency issues.