[fyi] Pkg.precompile error

I’ll repeat here for search/posterity the error message and resolution of an less-than-clear precompile error in v1.9.2:

(Convenient) pkg> up
    Updating registry at `.julia\registries\General.toml`
  No Changes to `Convenient\Project.toml`
  No Changes to `Convenient\Manifest.toml`
Precompiling project...
  Progress [>                                        ]  0/1
  ◓ Convenient

  1 dependency had warnings during precompilation:
┌ Convenient [9e087903-aaf1-404a-a3ad-e6d834fa081e]
│  WARNING: --output requested, but no modules defined during run
└  ┌ Error: Pkg.precompile error
│   exception =
│    failed process: Process(setenv 
│    Stacktrace:
│      [1] pipeline_error
│        @ .\process.jl:565 [inlined]
│      [2] run(::Cmd, ::Base.DevNull, ::Vararg{Any}; wait::Bool)
│        @ Base .\process.jl:480
│      [3] run
│        @ .\process.jl:477 [inlined]
│      [4] link_image (repeats 2 times)
│        @ .\linking.jl:166 [inlined]

The auto precompilation performed during any add, update, or precompile operation was erroring as above, even after removing all dependencies and deleting the compiled caches. Thinking that something had broken inside Julia, I reinstalled but met the same result. Surprisingly I was able to precompile other projects, and this led me to notice the warning --output requested, but no modules defined during run.

Turns out, in reorganizing and renaming this project, I had left the project’s main file src/Convenient.jl empty and projects are very much required to define an identically-named module. Inserting module Convenient ... end allowed precompile to succeed.

1 Like