[Dev-luatex] Running CWEAVE.exe and CTANGLE.exe on MPlib sources (under Windows)

Graham Douglas graham.douglas at readytext.co.uk
Tue May 4 20:11:32 CEST 2010

Hi All

I guess one is for Taco... Hope OK to ask this here.

I'd like to build MPlib as a DLL using the discussion you posted
here: [reproduced below]
(reason: to probe a bit more into the btex...etex + makempx stuff)

  (For this build I want to use visual C++)

I've tried to run both ctangle.exe and cweave.exe on
the .w sources. These exes were both built during the MPlib build. No 
matter what I try to do, they both fail with the errors below.

 From a pure DOS shell or an Mysys bash shell
--- simple paths or not.

Is this caused by Default CHANGEFILE is /dev/null;
--- which confuses windows?

Any suggestions would be great :-)

Could I just use the code from the MPlib build process
as output to


=--> Are these files identical to what you would
get from running ctangle.exe or are they processed
during the build process?


Apologies for what must be quite trivial questions for
you Taco but the whole Web2c paradigm is still rather
alien to me so I would value your comments, as always.

Warm wishes


$ cweave c:/mpxout.w
This is CWEAVE, Version 3.64 (Web2C 2010/dev)
! Cannot open change file NUL. (l. 0)

(That was a fatal error, my friend.)

ctangle G:\MPlib\source\texk\web2c\mplibdir\mpxout.w

This is CTANGLE, Version 3.64 (Web2C 2010/dev)
! Cannot open change file NUL. (l. 0)

(That was a fatal error, my friend.)

 > 1) How to build MP as *.dll (win) or *.so (linux)?

Metapost consists of two components: a library and an executable driver.

The library is built from am/libmplib.am, the executable from

The library consists of avl.c, memio.w, mp.w, psout.w, and svgout.w,
    this does all the real work except the TeX connection and file
The binary has mpxout.w and mpost.w, and connects the library to

There is also lmplib.c. This file creates bindings to the library
component from lua, and could be used as an example. If this is
too obscure for you, see manual/mplibapi.tex for the official

The current build system does not support creating a dynamic library
(because it is derived from the TeXLive build system which does not
need that) but the general approach is fairly straightforward:
run 'ctangle' on memio.w, mp.w, psout.w, and svgout.w, then compile
the resulting C files + avl.c into a dynamic library using whatever
methods you need for your platform.

 > 2) I don't need an TeX-ability with MP (no texts at all). How to
 > build MP without TeX connection (kpathsea and others)?

This is automatic if you only build the library part: when the
relevant callback functions are not set, the library disables
btex .. etex processing and will only be able to use files from
the current working directory.

Best wishes,

Pasted from 

More information about the dev-luatex mailing list