Hello. As some discussion had gone off-list, here's some relevant background: The OCaml binding works when the OCaml library is compiled to native code, and it segfaults when the OCaml library is compiled to bytecode. Martin Kersten a écrit :
What is the gdb stack trace of the processes involved? segfaults are only analysed that way.
Quite new to gdb, so I do not know if this is what you've asked for:
gdb --args ocamlrun test/monetdb_sql.byte GNU gdb (GDB) 7.0-debian Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /usr/bin/ocamlrun...(no debugging symbols found)...done. (gdb) run Starting program: /usr/bin/ocamlrun test/monetdb_sql.byte [Thread debugging using libthread_db enabled] [New Thread 0x2aaaaf66d910 (LWP 4061)]
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x2aaaaf66d910 (LWP 4061)] 0x00002aaaac676de3 in findBox () from /usr/lib/libmonetdb5.so.5 (gdb) backtrace #0 0x00002aaaac676de3 in findBox () from /usr/lib/libmonetdb5.so.5 #1 0x00002aaaac677086 in openBox () from /usr/lib/libmonetdb5.so.5 #2 0x00002aaab7a51cbb in MTIMEprelude () from /usr/lib/MonetDB5/lib/lib_mtime.so #3 0x00002aaaac6826cf in ?? () from /usr/lib/libmonetdb5.so.5 #4 0x00002aaaac68b2a0 in runMAL () from /usr/lib/libmonetdb5.so.5 #5 0x00002aaaac67cac7 in MALengine () from /usr/lib/libmonetdb5.so.5 #6 0x00002aaaac67d5f6 in malBootstrap () from /usr/lib/libmonetdb5.so.5 #7 0x00002aaaac669f75 in mal_init () from /usr/lib/libmonetdb5.so.5 #8 0x00002aaaab91ef60 in ?? () from /usr/lib/libembeddedsql5.so #9 0x00002aaaab39b73a in start_thread () from /lib/libpthread.so.0 #10 0x00002aaaab67c69d in clone () from /lib/libc.so.6 #11 0x0000000000000000 in ?? () (gdb)
Please tell me what else could be useful.
I am not an CAML expert, but i guess there may be potential issues in location and dynamic loading of the necessary libraries. Where does CAML get the libraries from?
As a rather general statement, dynamic loading is supported within OCaml world. I'm not so sure how this works when it is C code that triggers dynamic loading, with OCaml in bytecode mode... I would like to pinpoint the segfault more precisely in order to go back to the OCaml mailing list about potential dynamic loading issues.
We can help (on Xmas days) only with proper output. The level of programming calls for expertise in dealing with C debuggers, dynamic loaders, and thread management. Guessing does not bring us further. You have to use the right tools.
OK. This is always a good opportunity to learn more about C world... Thanks for pointing out the right tools. All the best, -- Guillaume Yziquel http://yziquel.homelinux.org/