J
Joe Van Dyk
Hi,
I'm in an environment where it's kind of a pain in the ass to install
external software on production machines. So, if I write a Ruby
application that uses Tk + Tk extensions + ActiveRecord + Sqlite +
whatever else, it's quite difficult to install all those pre-requistes
on the machines (now, a combination of Redhat 8, 9, Enterprise Redhat,
and IRIX).
What I'd really like to do is to be able to package up Ruby, Sqlite,
ActiveRecord, Tk extensions, all in one directory and say "there's my
application. Run it."
I'm having some luck with rubyscript2exe, but I'm running into
problems getting the other stuff in the directory. For instance, I'm
trying to bundle sqlite functionality.
joe@ubuntu:~/test $ ls
libsqlite3.so rubyscript2exe.rb test.db test.rb
joe@ubuntu:~/test $ cat test.rb
require 'rubygems'
require_gem 'activerecord'
RUBYSCRIPT2EXE_LIB =3D ["libsqlite3.so"]
ActiveRecord::Base.establish_connection(
:adapter =3D> 'sqlite3',
:dbfile =3D> 'test.db'
)
class Partition < ActiveRecord::Base
end
p =3D Partition.new
p.user =3D Time.now
p.save
for partition in Partition.find_all
puts "partition user is #{partition.user} and partition title is
#{partition.title}"
end
joe@ubuntu:~/test $ ruby rubyscript2exe.rb test.rb
Tracing test ...
Gathering files...
/usr/lib/ruby/1.8/dl/import.rb:33:in `initialize': libsqlite3.so:
cannot open shared object file: No such file or directory
(RuntimeError)
from /usr/lib/ruby/1.8/dl/import.rb:33:in `dlopen'
from /usr/lib/ruby/1.8/dl/import.rb:33:in `dlload'
from /usr/lib/ruby/1.8/dl/import.rb:31:in `each'
from /usr/lib/ruby/1.8/dl/import.rb:31:in `dlload'
from /usr/lib/ruby/site_ruby/1.8/sqlite3/driver/dl/api.rb:63
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_sup=
port/dependencies.rb:190:in
`require'
... 16 levels...
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.7.0/lib/active_reco=
rd/base.rb:856:in
`initialize_without_callbacks'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.7.0/lib/active_reco=
rd/callbacks.rb:224:in
`initialize'
from test.rb:15:in `new'
from test.rb:15
Copying files...
Stripping...
Creating test_linux ...
Why can't it find libsqlite3.so?
Anyways, anyone have any advice on how to properly package
applications so I can avoid having to install anything outside the
application directory?
I'm in an environment where it's kind of a pain in the ass to install
external software on production machines. So, if I write a Ruby
application that uses Tk + Tk extensions + ActiveRecord + Sqlite +
whatever else, it's quite difficult to install all those pre-requistes
on the machines (now, a combination of Redhat 8, 9, Enterprise Redhat,
and IRIX).
What I'd really like to do is to be able to package up Ruby, Sqlite,
ActiveRecord, Tk extensions, all in one directory and say "there's my
application. Run it."
I'm having some luck with rubyscript2exe, but I'm running into
problems getting the other stuff in the directory. For instance, I'm
trying to bundle sqlite functionality.
joe@ubuntu:~/test $ ls
libsqlite3.so rubyscript2exe.rb test.db test.rb
joe@ubuntu:~/test $ cat test.rb
require 'rubygems'
require_gem 'activerecord'
RUBYSCRIPT2EXE_LIB =3D ["libsqlite3.so"]
ActiveRecord::Base.establish_connection(
:adapter =3D> 'sqlite3',
:dbfile =3D> 'test.db'
)
class Partition < ActiveRecord::Base
end
p =3D Partition.new
p.user =3D Time.now
p.save
for partition in Partition.find_all
puts "partition user is #{partition.user} and partition title is
#{partition.title}"
end
joe@ubuntu:~/test $ ruby rubyscript2exe.rb test.rb
Tracing test ...
Gathering files...
/usr/lib/ruby/1.8/dl/import.rb:33:in `initialize': libsqlite3.so:
cannot open shared object file: No such file or directory
(RuntimeError)
from /usr/lib/ruby/1.8/dl/import.rb:33:in `dlopen'
from /usr/lib/ruby/1.8/dl/import.rb:33:in `dlload'
from /usr/lib/ruby/1.8/dl/import.rb:31:in `each'
from /usr/lib/ruby/1.8/dl/import.rb:31:in `dlload'
from /usr/lib/ruby/site_ruby/1.8/sqlite3/driver/dl/api.rb:63
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_sup=
port/dependencies.rb:190:in
`require'
... 16 levels...
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.7.0/lib/active_reco=
rd/base.rb:856:in
`initialize_without_callbacks'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.7.0/lib/active_reco=
rd/callbacks.rb:224:in
`initialize'
from test.rb:15:in `new'
from test.rb:15
Copying files...
Stripping...
Creating test_linux ...
Why can't it find libsqlite3.so?
Anyways, anyone have any advice on how to properly package
applications so I can avoid having to install anything outside the
application directory?