From: Jos Backus <jos@catnook.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] undefined symbol `caml_tuplify2' in dynamic rocaml extension
Date: Wed, 1 Aug 2007 10:59:07 -0700 [thread overview]
Message-ID: <20070801175907.GA29353@lizzy.catnook.local> (raw)
In-Reply-To: <20070801161702.GA28680@lizzy.catnook.local>
On Wed, Aug 01, 2007 at 09:17:02AM -0700, Jos Backus wrote:
> On Wed, Aug 01, 2007 at 11:16:47AM +0200, Mauricio Fernandez wrote:
[snip]
> > If you could pinpoint the conversion that's triggering the problem (and it's
> > indeed a problem caused by a Ruby <-> OCaml conversion) we'd be one step
> > away from fixing it. Have you tried to disassemble the extension and see
> > where caml_tuplify2 is being called?
>
> I'll have a look. I do see references to caml_tuplify2 in other .a's as well.
It turns out my extension doesn't call it but one of the required libraries
does.
Here's what I am doing:
Exerpt from extconf.rb:
# extension name, XXX in require 'XXX'
EXT_NAME = "kpp"
Interface.generate("kpp") do
def_class("KPP") do |c|
t = c.abstract_type
fun "make", STRING => t
method "eval", [t, STRING] => LIST(STRING)
end
end
$ ruby extconf.rb
$ make
[lots of errors because of unfound header files]
$ vi Makefile
[Add `-I/usr/lib/ocaml' to INCFLAGS]
$ make
kpp_rocaml_wrapper.c:39: error: missing terminating " character
$ vi kpp_rocaml_wrapper.c
[Change line 39:
static VALUE String_list_caml_to_ruby(value v);"
to
static VALUE String_list_caml_to_ruby(value v);
]
$ make
gcc -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I. -I/usr/lib/ocaml -fPIC -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -fPIC -c kpp_rocaml_wrapper.c
kpp_rocaml_wrapper.c: In function `string_ruby_to_caml_safe':
kpp_rocaml_wrapper.c:133: warning: implicit declaration of function `caml_alloc_string'
kpp_rocaml_wrapper.c: At top level:
kpp_rocaml_wrapper.c:45: warning: 'do_raise_exception' defined but not used
kpp_rocaml_wrapper.c:59: warning: 'do_raise_exception_tag' defined but not used
ocamlopt.opt -c rubyOCamlUtil.ml
ocamlopt.opt -output-obj -o kpp_rocaml_runtime.o nums.cmxa rubyOCamlUtil.cmx rubyOCamlUtil.o
gcc -shared -L"/usr/lib" -o kpp.so kpp_rocaml_wrapper.o kpp_rocaml_runtime.o /usr/lib/ocaml/libasmrun.a /usr/lib/ocaml/libunix.a /usr/lib/ocaml/libnums.a -lruby -lpthread -ldl -lcrypt -lm -lc
$ cat test_kpp.rb
require 'kpp'
kpp = KPP.make ""
p kpp.eval("")
$ ruby test_kpp.rb
test_kpp.rb:3:in `make': Couldn't find OCaml value 'KPP.make'. (StandardError)
from test_kpp.rb:3
$ vi Makefile
[Add `-Wl,--whole-archive ../kpp/kpp.a -Wl,--no-whole-archive' to LOCAL_LIBS]
$ make clean all
$ ruby test_kpp.rb
./kpp.so: ./kpp.so: undefined symbol: camlStr__parse_368 - ./kpp.so (LoadError)
from test_kpp.rb:1
$ vi Makefile
[Add `/usr/lib/ocaml/str.a' to LOCAL_LIBS]
$ make clean all
$ ruby test_kpp.rb
./kpp.so: ./kpp.so: undefined symbol: camlCamlinternalOO__create_object_opt_357 - ./kpp.so (LoadError)
from test_kpp.rb:1
$ vi Makefile
[Add `/usr/lib/ocaml/stdlib.a' to LOCAL_LIBS]
$ make clean all
$ ruby test_kpp.rb
./kpp.so: ./kpp.so: undefined symbol: caml_hash_univ_param - ./kpp.so (LoadError)
from test_kpp.rb:1
$ vi Makefile
[Add `/usr/lib/ocaml/libasmrun.a' (again) to LOCAL_LIBS]
$ make clean all
$ ruby test_kpp.rb
./kpp.so: ./kpp.so: undefined symbol: caml_tuplify2 - ./kpp.so (LoadError)
from test_kpp.rb:1
$
At this point, LOCAL_LIBS looks like this:
LOCAL_LIBS = kpp_rocaml_runtime.o /usr/lib/ocaml/libasmrun.a \
/usr/lib/ocaml/libunix.a /usr/lib/ocaml/libnums.a -Wl,--whole-archive \
../kpp/kpp.a -Wl,--no-whole-archive /usr/lib/ocaml/str.a \
/usr/lib/ocaml/stdlib.a /usr/lib/ocaml/libasmrun.a
This is where I'm stuck.
--
Jos Backus
jos at catnook.com
next prev parent reply other threads:[~2007-08-01 18:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-01 4:01 Jos Backus
2007-08-01 7:44 ` [Caml-list] " Julien Moutinho
2007-08-01 9:43 ` Mauricio Fernandez
2007-08-01 13:59 ` Gordon Henriksen
2007-08-01 9:16 ` Mauricio Fernandez
2007-08-01 16:17 ` Jos Backus
2007-08-01 17:59 ` Jos Backus [this message]
2007-08-01 23:24 ` [Caml-list] undefined symbol `caml_tuplify2' in dynamic rocaml extension (UPDATE) Jos Backus
2007-08-02 9:20 ` Mauricio Fernandez
2007-08-02 9:58 ` Mauricio Fernandez
2007-08-02 18:54 ` Jos Backus
2007-08-02 18:58 ` Jos Backus
2007-08-01 23:34 ` rocaml bug + fix Jos Backus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070801175907.GA29353@lizzy.catnook.local \
--to=jos@catnook.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox