Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 
moment,
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
Makefile:

---------------------------------------------------------------------------
OCAMLMAKEFILE = ../../OcamlMakefile

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

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

-include $(OCAMLMAKEFILE)
---------------------------------------------------------------------------

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
Makefile:

----------------------------------------------------------------------------
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

-include $(OCAMLMAKEFILE)
----------------------------------------------------------------------------

Everything compiles correctly, but when it gets to the linking stage, it 
tells
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 
are
in the lib directory as they should be.

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

Jeremy


_________________________________________________________________
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