[racket] Some newbie trouble on running Web Server on EC 2

From: J G Cho (gcho at fundingmatters.com)
Date: Fri Apr 22 20:38:29 EDT 2011

A great tip!

I was able to compile Racket on ami-2a1fec43 (aka "official" Amazon
Linux (~= CentOS 32 bit)).

Still ran into the same issue as before:

[ec2-user at ip-10-88-214-159 ~]$ /usr/local/plt/bin/racket -t test-model-3.rkt

ffi-lib: couldn't open "libsqlite3.so" (libsqlite3.so: cannot open
shared object file: No such file or directory)

 === context ===
/home/ec2-user/.racket/planet/300/5.1/cache/jaymccarthy/sqlite.plt/4/6/sqlite-ffi.ss:
[running body]
/home/ec2-user/.racket/planet/300/5.1/cache/jaymccarthy/sqlite.plt/4/6/sqlite.rkt:
[traversing imports]
/home/ec2-user/.racket/planet/300/5.1/cache/jaymccarthy/sqlite.plt/4/6/main.rkt:
[traversing imports]
/home/ec2-user/model-3.rkt: [traversing imports]
/home/ec2-user/test-model-3.rkt: [traversing imports]

So I tried the following:

$ sudo find / -name 'libsqlite3*'

/usr/lib/libsqlite3.so.0
/usr/lib/libsqlite3.so.0.8.6

$ sudo ln -s /usr/lib/libsqlite3.so.0 /usr/lib/libsqlite3.so

$/usr/local/plt/bin/racket -t test-model-3.rktTitle:First Post

Body:This is my first post
Title:Second Post
Body:This is another post

YES, it works!

Thank you.

On Wed, Apr 20, 2011 at 8:23 PM, Noel Welsh <noelwelsh at gmail.com> wrote:
> On Wed, Apr 20, 2011 at 6:03 PM, J G Cho <gcho at fundingmatters.com> wrote:
>> 1. Following along the system (aka '/more') tutorial: When evaluating
>> (require readline), REPL sometimes hangs but not all the time.
>
> Dunno.
>
>> 2. Following along the blog webapp: When running model-3.rkt (sqlite3)
>> fails due to missing something.  (libsqlite.so ?)  [I realize there is
>> v5 now but this was done with sqlite v4 from PLanet per tutorial.
>> Lots of warnings and complaints during require phase, it seems.]
>
> Those warning would hopefully tell us what is going on. Reading the
> source, the SQLite .so is loaded here:
>
> http://planet.plt-scheme.org/package-source/jaymccarthy/sqlite.plt/4/6/sqlite-ffi.ss
>
> Try the equivalent code and see if it works:
>
> (require scheme/foreign)
> (unsafe!)
> (define sqlite (ffi-lib "libsqlite3"))
>
>> Question is: Has anybody done this on EC2 or other 'cloud' platform?
>> If so, I would love to hear/read about pitfalls.
>
> Yeah. Works fine IME.
>
> HTH,
> N.
>
> PS: Here is the important part of a Chef (http://www.opscode.com/)
> recipe for installing Racket. I haven't used it for a little while,
> but it worked last time I did. It also isn't as abstracted as I'd like
> -- it hardcodes 5.0.2 at the moment.
>
>
> require 'net/http'
>
> package "g++"
>
> # The version number to download
> # String
> racket_version =
>  if node[:racket][:version] == :latest then
>    "recent"
>  else
>    node[:racket][:version]
>  end
>
> # String
> racket_type =
>  if node[:racket][:type] == :textual then
>    "-textual"
>  else
>    ""
>  end
>
> racket_base_path = "/installers/#{version}/racket#{racket_type}/"
> racket_file =
>  begin
>    h = Net::HTTP.new("download.racket-lang.org", 80)
>    resp, data = h.get(racket_base_path, nil)
>  end
>
>
> # Fetch Racket tarball
> remote_file "/usr/local/racket-textual-5.0.2-src-unix.tgz" do
>  source "http://download.racket-lang.org/installers/recent/racket-textual/racket-textual-5.0.2-src-unix.tgz"
>  mode "0644"
> end
>
> directory "/usr/local/racket-textual-5.0.2" do
>  mode "0755"
>  action :create
> end
>
> script "install_racket-textual-5.0.2" do
>  interpreter "bash"
>  cwd "/usr/local"
> #  user "kahu"
>  code <<-EOH
>  pwd
>  ls
>  tar zxf racket-textual-5.0.2-src-unix.tgz
>  cd racket-textual-5.0.2/src
>  mkdir build
>  cd build
>  pwd
>  ../configure
>  make
>  make plain-install
>  cd ../../bin
>  ./racket -N raco -l- raco setup -D
>  EOH
> end
>
> file "/usr/local/racket-textual-5.0.2-src-unix.tgz" do
>  action :delete
> end
>
> directory "/usr/local/racket-textual-5.0.2" do
> #  owner "kahu"
> #  group "kahu"
>  mode "0755"
> end
>
> link "/usr/local/plt" do
>  to "/usr/local/racket-textual-5.0.2"
> end
>



Posted on the users mailing list.