Package Mangement Problems

I am developing a “package” similar to Mathworks Simulink but base on Julia. Entry is via xschem schematic capture into a verilog net list, which is parsed into an abstract syntax tree, and then into a “Universal Net List” saved in a YAML file. The julia simulation engine reads the yaml file. The engine is bit level and cycle level accurate. It is not really intended to compete with verilog, but closer to a system-C where the user can easily (this is the goal - needs work) add high-level custom blocks. I have just gotten my quadrature output, 12-bit direct digital frequency synthesizer working (it includes two ROM look up tables, adders, registers, etc., etc.). My intent was to then put the Julia code into a package so I can think about sharing it with others. I am having major problems in putting my current code into a package. I have spent at least two days trying to read documentation, wich at times I mostly can not comprehend. I’ll start with a few issues and add others later.

  1. I have many modules with each module in a separate file. Because Julia does not allow forward function references, I have had real problems getting this set up; it is now working with issues fo Revise vs @printf to be resolved. So from Gitbook it was suggested to make a new repository on Github (done). Problem, can’t clone repository first as ]pkg> generate wants to make a new sub directory. Then one needs to link the new subdirectory to the gith, b repository; this is very convoluted and not well explained. Anyways, I think I got through this but now have the problem:
(SysSim) pkg> precompile
Precompiling project...
  ✗ SysSim
  0 dependencies successfully precompiled in 2 seconds (26 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

SysSim [0f8dfbf7-a8b6-4432-9d9e-474bb026f832]

Failed to precompile SysSim [0f8dfbf7-a8b6-4432-9d9e-474bb026f832] to ./compiled/v1.7/SysSim/jl_J9gm3f.
ERROR: LoadError: ArgumentError: Package SysSim does not have Main in its dependencies:

I have no idea how one goes about putting Main in the dependencies. I also can’t find documentation on recommended flow for packages with multiple file modules and packages vs environments? Many many more issues trying to get package manager to work and dev vs not using dev etc. Googling I see discussions about REQUIRE? but I haven’t seen REQUIRE mentioned anywhere (I think it’s old?)

A complete tutorial on setting up a package management environment with multiple file would be nice.
Help appreciated,

What is the structure of your files? Show the listing of your package folder please.
I believe there is a simple solution.

As already mentioned, some more information would be helpful before an answer can be given. However, feedback from new users is extremely valuable, and everyone would be grateful if after the problem is solved you could spend some time filing issues describing what is missing from the current documentation (or if nothing is missing, pointing out why the current documentation was misleading or not well structured).

Current docs 1. Introduction · Pkg.jl (also linked from Pkg · The Julia Language )


Apologies, but it is a bit difficult to identify your problem given the hints you have provided. I will do my best to highlight a potential issues/misconceptions.

FYI/Also: I have ported much of Richard Schreier’s Toolbox if that’s of interest to you:

GitHub - ma-laforge/RSDeltaSigmaPort.jl: Port of Richard Schreier's Delta Sigma Toolbox

Not necessary, but quite ok. Modules & files can be organized independently (completely orthogonal concepts in Julia).

Not sure what you mean here - but if you mean you can’t make empty function declarations like you can in C/C++ this is true (in a way).

  • Function declarations are unnecessary in Julia.
  • Functions can be defined after they are first used in Julia (no issues)


f(x) = g(x) #Not yet defined - but Julia accepts happily.
g(x) = 3x #Ah! Julia now knows how to run f(x) now!

f(5) #This call works -- no problem

The only issue with @printf + packages I recall is that you should “add it to your package” (Project.toml file):

Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

Yes. I looked at the Gitbook you linked. I find it a bit difficult to follow, to be honest. (Though I’m still happy the author is trying to improve our understanding).

I find it is best to do:

  • Go to an empty work folder.
  • Generating package pkg>generate - as you mentioned.
  • (This just gives you the skeleton for your package (including its unique identifier UUID).)
  • Copy that whole folder into the repo you cloned from Github (Let’s call it PKGROOT).
  • Move your code inside this new package as well (PKGROOT).
  • cd PKGROOT; julia (Launch julia from PKGROOT)
  • pkg>activate . (Activate your package so you can modify it.)
  • pkg>add (Add all packages your own package depend on.)

It shouldn’t be.

  • The Main module is just the scope where your interactive session lives.
  • You don’t need to add it.
  • and your module code probably shouldn’t reference it.

Correct: It is no longer used. Please ignore all information pertaining to REQUIRE.

To use your package

  • Start a new Julia session
  • pkg>dev PKGROOT (Make your package available to whatever environment you are currently in)
  • Note the use of “dev” - not “add”. Ask me why if you don’t know.
  • Note2: PKGROOT should be an absolute path here (not relative path).

From now on, this julia environment is ready to use your package!

1 Like