English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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
>       src1.ml
>       src2.ml
>       ...

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

SOURCES = sformat.ml
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 ircmsg.ml irclib.ml ircutils.ml 
logger.ml flusher.ml ircusers.ml factoids.ml help.ml privmsg_callbacks.ml 
callbacks.ml irctester.ml
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 py_string.cm* 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 http://explorer.msn.com/intl.asp

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr