[racket] raco distribute has a problem with runtime paths on win32

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Apr 28 13:09:56 EDT 2014

There shouldn't be a limit, but the way that `raco exe` tries to make
enough space apparently isn't right.

The current strategy is to record the original full path (because a
synthesized relative path could imitate it), the executable name
(because that's part of the destination relative path), and about 17
extra bytes (to accommodate the path of runtime files relative to the
executable, not counting the executable name). In a distribution, the
path to the file relative to the executable is supposed to fit within
the same space.

I think 17 bytes turns out to be slightly too little for the base
relative path, even in Unix syntax. That base relative path becomes 5
bytes longer on Windows, because "/"s turn into "\\"s.

You can make things work by changing "collects/compiler/embed.rkt" to


with more than 17 dots.

Assuming so, could you look for "rUnTiMe-paths" in the initial ".exe"
and the distribution ".exe" to try to tell whether the strategy of
using a fixed number of additional "."s is really enough? You might
notice a dependency on some path length that isn't covered by the
current strategy, for example.

Meanwhile, you might see a workaround that doesn't involve changing
"embed.rkt", such as moving your source files to a more deeply nested
directory (which is not a nice workaround, but I think it can likely

Note that a synthesized relative path (for the distribution executable)
may keep part of original paths (at the source locations) so that files
stay relative to each other in the same way as in the source.
Sometimes, that strategy ends up saving more information about the
source directories than you'd like to appear in an executable, such as
a user's directory name. We need some strategy to avoid that extra
information while preserving relative file locations when needed.

At Mon, 28 Apr 2014 20:25:03 +0400, Dmitry Pavlov wrote:
> accidentally hit the send button...
> > I use raco exe and raco distribute on a regular basis.
> > Today I added another (define-runtime-path) into my program
> > and got the following error from raco distribute:
> >
> > copy-and-patch-binaries: not enough room in executable for revised
> > #rx#"rUnTiMe-paths[)]" table
> >    context...:
> >     C:\Program Files\Racket\collects\compiler\distribute.rkt:367:4: loop
> >     C:\Program Files\Racket\collects\compiler\distribute.rkt:15:2:
> > assemble-distribution7
> >     C:\Program
> > Files\Racket\share\pkgs\compiler-lib\compiler\commands\exe-dir.rkt:
> > [running body]
> >     C:\Program Files\Racket\collects\raco\raco.rkt: [running body]
> >     C:\Program Files\Racket\collects\raco\main.rkt: [running body]
> >
> > On Linux everything works fine.
> I have more than 50 (define-runtime-path)s in different modules.
> Is that too many for raco distribute on Windows? Are there workarounds
> for this problem?
> Best regards,
> Dmitry
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.