[racket] Symlinking Racket programs

From: Brian Mastenbrook (brian at mastenbrook.net)
Date: Tue Feb 26 19:40:23 EST 2013

Hello all,

What is the expected behavior of module resolution when symlinking a 
Racket program, particularly one executed as a script using a shebang 
line? I'm currently using "raco exe" to build a small program and 
install it into /usr/local/bin on my computer, but Danny Yoo pointed out 
to me that the tool would start just as quickly if I just ran "raco 
make" once first. However, I'd like not to include the tool path in my 
$PATH, nor do I want to register the internal utility modules of the 
tool as a collection. I could symlink the tool into /usr/local/bin, but 
then modules fail to resolve:

mbp:tmp brian$ cat foo/foo.rkt 
#!/usr/bin/env racket
#lang racket/base

(require "baz.rkt")

(baz)
mbp:tmp brian$ cat foo/baz.rkt 
#lang racket/base

(define (baz) (display (format "hello, world!~%")))

(provide baz)
mbp:tmp brian$ ./foo/foo.rkt 
hello, world!
mbp:tmp brian$ ls -al bar/foo.rkt 
lrwxr-xr-x  1 brian  wheel  14 Feb 26 18:31 bar/foo.rkt -> ../foo/foo.rkt
mbp:tmp brian$ ./bar/foo.rkt 
default-load-handler: cannot open input file
  path: /private/tmp/bar/baz.rkt
  system error: No such file or directory; errno=2
  context...:
   standard-module-name-resolver
   standard-module-name-resolver
mbp:tmp brian$ 

I would have naïvely expected this to work. :-) What am I missing?

Brian

-- 
Brian Mastenbrook
brian at mastenbrook.net
http://brian.mastenbrook.net/


Posted on the users mailing list.