racket / racket/racket

compiler/demod + raco exe fails with included and excluded submodules of the same name

Open
#5,465 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
5.2k
Forks
698
Avg merge
18h 34m
Merged PRs (30d)
5

Description

Consider the following collection of four modules:

#lang compiler/demod ; demod.rkt
"main.rkt"
#:dynamic
#:exclude (#:module "structs.rkt")
#lang racket/base ; main.rkt
(require "mystructs.rkt"
         "structs.rkt")
(displayln (thing 1 2))
(displayln (widget "a" 3))
#lang racket/base ; mystructs.rkt
(require racket/serialize)
(provide (struct-out thing))
(serializable-struct thing (x y))
#lang racket/base ; structs.rkt
(require racket/serialize)
(provide (struct-out widget))
(serializable-struct widget (name value))

Then run:

$ raco make demod.rkt && raco exe -o test demod.rkt

That produces the error:

get-module-code: cannot find submodule: '(deserialize-info)
  context...:
   /home/samth/sw/plt/racket/collects/syntax/private/modcode-noctc.rkt:163:2: extract-submodule
   /home/samth/sw/plt/racket/collects/compiler/embed.rkt:446:0: get-code
   [repeats 1 more time]
   /home/samth/sw/plt/racket/collects/racket/private/map.rkt:267:2: gen-for-each
   /home/samth/sw/plt/racket/collects/compiler/embed.rkt:1191:0: do-write-module-bundle
   /home/samth/sw/plt/racket/collects/compiler/embed.rkt:1676:15: write-module
   /home/samth/sw/plt/racket/collects/compiler/embed.rkt:1811:29
   /home/samth/sw/plt/racket/collects/compiler/private/elf.rkt:289:0: expand-elf
   /home/samth/sw/plt/racket/collects/compiler/embed.rkt:1580:6
   /home/samth/sw/plt/pkgs/compiler-lib/compiler/commands/exe.rkt:100:0
   body of "/home/samth/sw/plt/pkgs/compiler-lib/compiler/commands/exe.rkt"
   /home/samth/sw/plt/racket/collects/raco/raco.rkt:41:0
   body of "/home/samth/sw/plt/racket/collects/raco/raco.rkt"
   body of "/home/samth/sw/plt/racket/collects/raco/main.rkt"

Probably relevantly, both mystructs.rkt and structs.rkt have deserialize-info submodules.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with demod.rkt, main.rkt, mystructs.rkt, and structs.rkt using raco make followed by raco exe. Start by reading compiler/embed.rkt and syntax/private/modcode-noctc.rkt around the stack-trace locations, focusing on how included and excluded same-named submodules are handled. Done means the example builds an executable without the deserialize-info error.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.