Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] Building O'Caml projects properly.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-10-01 (07:04)
From: Jeremy Fincher <tweedgeezer@h...>
Subject: Re: [Caml-list] Building O'Caml projects properly.
>If you want to do what I usually do, your project tree should look
>somewhat like this:
>   ./
>     Makefile
>     OcamlMakefile
>     lib/
>     libsrc/
>       lib1/...
>       lib2/...
>       lib3/...
>     src/
>       Makefile
>       ...

I have a similar directory structure to that one in my ~/src/ocaml/my
directory.  As far as lib/ and libsrc/ go, it's exactly the same.  Rather
than having a src/ directory, though, I'm not going to use a toplevel
Makefile and instead have my projects in their own directories at the same
level as lib/ and libsrc/.  Of course, I only have one project at the 
so it's not a huge deal, but when I get more it might matter :)

All the lib/* directories compile and install correctly using the following

OCAMLMAKEFILE = ../../OcamlMakefile

RESULT = a.out
LIBDIRS = ../../lib
INCDIRS = ../../lib
LIBINSTALL_FILES = *.mli *.cmi *.cma *.cmo *.cmx *.cmxa *.a *.o

all:	byte-code-library native-code-library


Everything works correctly *except* that after I make libinstall, it removes
the *.mli files from the directory, which I don't want it to do.

I do get hung up, however, when trying to compile my project, using this

OCAMLMAKEFILE = ../OcamlMakefile

SOURCES = calc_parser.mly calc_lexer.mll
RESULT = ircbot
LIBS = unix pcre
LIBDIRS = ../lib
INCDIRS = ../lib

all:	byte-code native-code


Everything compiles correctly, but when it gets to the linking stage, it 
me this:

gmake[1]: Entering directory `/usr/home/jfincher/src/ocaml/my/ocamlbot'
ocamlc  -I ../lib      -ccopt -L../lib  unix.cma pcre.cma   -o ircbot \
                        calc_parser.cmo calc_lexer.cmo ircmsg.cmo irclib.cmo 
ircutils.cmo logger.cmo flusher.cmo ircusers.cmo factoids.cmo help.cmo 
privmsg_callbacks.cmo callbacks.cmo irctester.cmo
Error while linking ircmsg.cmo: Reference to undefined global `Py_string'
gmake[1]: *** [ircbot] Error 2
gmake[1]: Leaving directory `/usr/home/jfincher/src/ocaml/my/ocamlbot'
gmake: *** [byte-code] Error 2

And I have no idea what to do about it.  All the proper* files 
in the lib directory as they should be.

Any comments on the above Makefiles, either related to my specific questions
or not, are appreciated.


Get your FREE download of MSN Explorer at

Bug reports:  FAQ:
To unsubscribe, mail  Archives: