installing MegaM on Mac OS X

1,306 views
Skip to first unread message

Wooster

unread,
Dec 2, 2011, 7:37:19 AM12/2/11
to nltk-users
Hi - similar to this previous post:
http://groups.google.com/group/nltk-users/browse_thread/thread/5f80ca09a20445ad

I've followed instructions (I think) to compile MegaM, having also
installed ocaml and edited the Makefile WITHCLIBS line to point to the
ocaml/caml directory for the .h files

But I encounter many warning messages:
1) at first relating to data.ml, Warning 26: unused variable xden.
2) and then re data.ml and other files, Warning 8: this pattern-
matching is not exhaustive.

Finally, the exit error is:
ocamlc -g -custom -o megam str.cma -cclib -lstr bigarray.cma -cclib -
lbigarray unix.cma -cclib -lunix -I /usr/local/lib/ocaml/caml
fastdot_c.c fastdot.cmo intHashtbl.cmo arry.cmo util.cmo data.cmo
bitvec.cmo cg.cmo wsemlm.cmo bfgs.cmo pa.cmo perceptron.cmo radapt.cmo
kernelmap.cmo abffs.cmo main.cmo
ld: library not found for -lstr
collect2: ld returned 1 exit status
File "fastdot_c.c", line 1, characters 0-1:
Error: Error while building custom runtime system
make: *** [megam] Error 2

Has anyone else encountered this and know what to do to solve it?
many thanks, Andrew

Wooster

unread,
Jan 27, 2012, 11:59:00 AM1/27/12
to nltk-users
An update: Hal Daume III (creator of MegaM) wrote me 10 Jan, advising
me to change the WITHSTR line in Makefile so that it points to str.cma

Similar to what we are instructed to do for WCLIBS and caml.

Then you do the same for WITHUNIX and unix.cma, and WITHBIGARRAY and
bigarray.cma

Now it flies. Thanks to Hal for the tip-off!

On Dec 2 2011, 12:37 pm, Wooster <andrewcain...@gmail.com> wrote:
> Hi - similar to this previous post:http://groups.google.com/group/nltk-users/browse_thread/thread/5f80ca...

Steven Bird

unread,
Jan 27, 2012, 3:51:12 PM1/27/12
to nltk-...@googlegroups.com
Thanks for reporting back with the solution -- its helpful to have
this in our list archives. I hope others will do likewise. -Steven
Bird

> --
> You received this message because you are subscribed to the Google Groups "nltk-users" group.
> To post to this group, send email to nltk-...@googlegroups.com.
> To unsubscribe from this group, send email to nltk-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nltk-users?hl=en.
>

Chris Desch

unread,
Nov 12, 2012, 3:01:00 PM11/12/12
to nltk-...@googlegroups.com
Can you post your configuration? I struggled with compiling at first. Now that I have a binary, I'm having trouble checking if it works properly as it has thrown some odd errors when running. Right now I'm trying to determine if it is my build of MegaM or if it is that I'm running it incorrectly. How did you verify your binary is working correctly?

Thanks

Wooster

unread,
Aug 2, 2013, 12:28:24 PM8/2/13
to nltk-...@googlegroups.com
Hi - in trying to install MegaM again (new Mac), I've done the following: 

1) downloaded and unpacked v0.92 from: http://www.umiacs.umd.edu/~hal/megam/
2) installed ocaml (sudo port install ocaml)
3) edited WITH lines to point to ocaml headers (in my case: /opt/local/lib/ocaml/)
4) replaced WITHSTR line #62 -lstr flag with -lcamlstr per: http://blog.vene.ro/2012/06/08/compiling-megam-on-macos-x/
5) attempted to run: $ make

But I see the following error message: fastdot_c.c:4:10: fatal error: 'alloc.h' file not found

I've googled around for a solution but without success (nb - removing that line from the fastdot file does not help)

Can anyone help please? thanks in advance!

Jack Hong

unread,
Dec 3, 2013, 1:19:06 AM12/3/13
to nltk-...@googlegroups.com
I had the same error and solved it by editing WITHCLIBS with the path /usr/local/lib/ocaml/caml.

Wooster

unread,
Dec 3, 2013, 11:20:39 AM12/3/13
to nltk-...@googlegroups.com
Thanks Jack -- this prompted me to look at this problem again with fresh eyes.
And what you said made me realise that there's a mistake in my (3) above, it should be "/opt/local/lib/ocaml/caml" of course. So thank you for getting in touch.
Note that step (4) still seems to be required.

Daniel Wu

unread,
Aug 6, 2014, 1:24:39 PM8/6/14
to nltk-...@googlegroups.com
For the less computer trained, can someone explain more precisely how to do the following steps:

3) edited WITH lines to point to ocaml headers (in my case: /opt/local/lib/ocaml/)
4) replaced WITHSTR line #62 -lstr flag with -lcamlstr per: http://blog.vene.ro/2012/06/08/compiling-megam-on-macos-x/
5) attempted to run: $ make

Wooster

unread,
Aug 7, 2014, 3:46:02 AM8/7/14
to nltk-...@googlegroups.com
Hi Daniel,
Here goes. If anything's still unclear please say.

3) edited WITH lines to point to ocaml headers (in my case: /opt/local/lib/ocaml/)
Once you've unpacked MegaM, there'll be a Makefile in the megam directory. Use a text editor to change the lines that start 'WITH' (WITHUNIX, WITHSTR, etc). You need to make sure the filepaths here are correct for your installation of ocaml, though note my update on 3rd Dec that for WITHCLIBS you need to drop down to the /opt/local/lib/ocaml/caml dir.

4) replaced WITHSTR line #62 -lstr flag with -lcamlstr per: http://blog.vene.ro/2012/06/08/compiling-megam-on-macos-x/
additionally (still in the Makefile) change the WITHSTR flag as stated.

5) attempted to run: $ make
Make sure your current working directory is the megam one and run 'make'. Installation should proceed, hopefully successfully!

Daniel Wu

unread,
Aug 7, 2014, 9:25:53 AM8/7/14
to nltk-...@googlegroups.com
Thanks so much! I'll give this a shot.

Thank you!
Dan

JD/PhD in Social Policy and Sociology


--
You received this message because you are subscribed to a topic in the Google Groups "nltk-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nltk-users/loKBj0eCgZs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nltk-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Bird

unread,
Aug 7, 2014, 9:31:35 AM8/7/14
to nltk-users
Note that the installation page now links to our wiki page that documents the third-party libraries and how to install them. Feedback on the wiki instructions, and contributions of more detailed instructions, would be welcome.


To unsubscribe from this group and stop receiving emails from it, send an email to nltk-users+...@googlegroups.com.

Wooster

unread,
Aug 7, 2014, 11:24:16 AM8/7/14
to nltk-...@googlegroups.com
The Megam section looks good to me Steven; Daniel, from your perspective, would you like to see more detail?

Daniel Wu

unread,
Aug 11, 2014, 9:41:07 AM8/11/14
to nltk-...@googlegroups.com
Thanks so much! I'll look at this and get back to you. 

Thank you!
Dan

JD/PhD in Social Policy and Sociology


Reply all
Reply to author
Forward
0 new messages