Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
Hello, CIL world:
I recently intend to store the parsing results by CIL into a database for the convenience that another c program can use these parsing results by visiting this database.
So i compiled a open-source ocaml-sqlite library and installed the corresponding library file into the default ocaml library directory : /usr/lib/ocaml (ubuntu)
I configured the Makefile.in (add sqlite3 library)
CILLY_LIBS = unix str nums sqlite3
I wrote a module referencing this Sqlite3 module and add its feature into Makefile.in and src/main.ml.
I compiled CIL (the following is log )
--Compiling src/main.ml to bytecode
--Linking bytecode obj/x86_LINUX/cilly.byte.exe
+ gcc -o 'obj/x86_LINUX/cilly.byte.exe' '-L/usr/lib/ocaml' -g '/tmp/camlobj59f6be.c' '-lsqlite3' '-lnums' '-lcamlstr' '-lunix' '-lcamlrun' -I'/usr/lib/ocaml' -lm -ldl -lcurses -lpthread
--make cilly NATIVECAML=
The byte code of CIL is OK, and i get the cilly.byte.exe.
But, when compiling its native code, it ran into the following error:
Compiling src/main.ml to native code
Linking native code obj/x86_LINUX/cilly.asm.exe
+ as -o '/tmp/camlstartupcf4ec7.o' '/tmp/camlstartupf60dcc.s'
+ gcc -o 'obj/x86_LINUX/cilly.asm.exe' '-L/usr/lib/ocaml'
'/usr/lib/ocaml/sqlite3.a' '/usr/lib/ocaml/nums.a' '/usr/lib/ocaml/str.a' '/usr/lib/ocaml/unix.a' '/usr/lib/ocaml/stdlib.a' '-lsqlite3' '-lnums' '-lcamlstr' '-lunix' '/usr/lib/ocaml/libasmrun.a' -lm -ldl
/usr/lib/ocaml/libsqlite3.a(sqlite3.o): In function `pthreadMutexAlloc':
sqlite3.c:(.text+0x3df4): undefined reference to `pthread_mutexattr_init'
sqlite3.c:(.text+0x3e07): undefined reference to `pthread_mutexattr_settype'
sqlite3.c:(.text+0x3e24): undefined reference to `pthread_mutexattr_destroy'
/usr/lib/ocaml/libsqlite3.a(sqlite3.o): In function `pthreadMutexTry':
sqlite3.c:(.text+0x3ef8): undefined reference to `pthread_mutex_trylock'
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
make: *** [obj/x86_LINUX/cilly.asm.exe] Error 2
From the log, it seems that when compiling its asm code, it failed to link "pthread" library.
So how to configure CIL by adding this link (by modifying "Makefile.in" ? I am not familiar with this Makefile :( )
Or, how can i prevent CIL from compiling its native code ?
Any help is appreciated.
Ting SU,software institute,East China Normal University
From: Gabriel Kerneis <gabriel@ke...> - 2013-03-08 08:44:10
On Fri, Mar 08, 2013 at 10:07:59AM +0800, tsuletgo wrote:
> But, when compiling its native code, it ran into the following error:
> From the log, it seems that when compiling its asm code, it failed to link
> "pthread" library.
> So how to configure CIL by adding this link (by modifying "Makefile.in" ?
You can try to add "threads" to CILLY_LIBS. I'm not sure it will be enough; you
might also need COMPILEFLAGS=-thread and/or LINKFLAGS=-thread. (Note: "threads"
> Or, how can i prevent CIL from compiling its native code ?