Pkg not defined when building packages even though I did use pkg

See picture below

The error seems to be in the build code of PETSc2, not at the toplevel. You may want to look at its source code and the logfile.

(please post quoted code/output in the future)

1 Like

Hi @Alexandre_Chen Backing up what @Tamas_Papp says - pay attention to the logs.
I would say please look at the develop option in the package manager.
This means that when you install a package a local copy of the source and all the build steps is created.
You can run the build then look at the Julia code which does the build and the log outputs.
I find that you can tinker around with the build.jl and see what happens - this can give you some big clues as to what is going wrong!

https://docs.julialang.org/en/v1/stdlib/Pkg/index.html

But say you are working on a project and you encounter a bug in one of your dependencies! How would you access the source? Pkg can help you out with develop :

(v1.1) pkg> develop --local Example

The Example package is now cloned to the dev subdirectory of your project directory. You can edit Example 's source and any changes you make will be visible to your project.

Once upstream Example has been patched, you can stop tracking the local clone. Do this with a free command:

(v1.1) pkg> free Example

Now you are back to using the version of Example in the registry.

1 Like

I get the same error when
pkg> add GitHub - OptimalDesignLab/PETSc2.jl: Wrappers for PETSc

Julia 1.1.1 with Linux Fedora 30 OS
Sorry but I don’t have time to do any more debugging this morning.

As an aside, on Fedora Linux I just got an error building the MPI.jl package.
I did not have cmake installed - which is a surprise. As I remember, on Ubuntu systems you should install buildessential

Also as a complete surprise to myself, I installed openmpi and openmpi-devel on Fedora 30 and I now find that by default the HPC style ‘Modules’ environment is used.
So before your run Julia module load mpi
(you can of course put this in a .bashrc file)

1 Like

Note this in the build.jl script:
Some alarm bells are sounding here - PkgFix repo is below.
Perhaps it is no longer relevant with Julia 1.1.1 or some similar issue

Note that PkgFix.jl has three branches - master upgrade_0.5 and upgrade_0.6

I have been trying to hack on the build.jl script to cut oit PkgFix and get the script to work with Julia v1.1.1.
I would advise contacting Jared and seeing if there is a way to get PETSc2 running with v1.1.1

install PkgFix if not present

if !isdir(joinpath(Pkg.dir(), “PkgFix”))
Pkg.clone(“GitHub - OptimalDesignLab/PkgFix.jl: A wrapper over Julia's package manager”)
end
start_dir=pwd()
cd(Pkg.dir(“PkgFix”))
run(git checkout upgrade_0.6)
cd(start_dir)

using PkgFix

1 Like

The package (PETSc2) is just not up to date with Julia 1.0.

1 Like

Thank you guys all for the help!