# Advice on contributing to std libs

**URL:** <https://discourse.julialang.org/t/advice-on-contributing-to-std-libs/107980>\
**Category:** Internals & Design\
**Tags:** question, linearalgebra\
**Created:** [December 23, 2023, 5:22pm UTC](https://discourse.julialang.org/t/advice-on-contributing-to-std-libs/107980 "2023-12-23T17:22:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nomadbl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nomadbl/32/205644_2.png) [@nomadbl](https://discourse.julialang.org/u/nomadbl)\
**Post date:** [December 23, 2023, 5:22pm UTC](https://discourse.julialang.org/t/advice-on-contributing-to-std-libs/107980/1 "2023-12-23T17:22:54Z")

</div>

Hello everyone. I would like to contribute a small improvement to LinearAlgebra.  
However I’m encountering some difficulty and came to ask for further instructions.

I started by cloning and ran `make` at the root of the `/julia` repository to compile everything. Once that was done (with no errors) I could run julia, so far so good.  
Next, I changed the uuid in /julia/stdlib/LinearAlgebra/LinearAlgebra.jl as I’ve read [here](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md#submitting-contributions).

However it appears that precompilation is broken and when running `]test` (as outlined in the above docs) I am showered with error messages like:

```julia
WARNING: Method definition transpose(Union{Base.BitArray{1}, Base.BitArray{2}}) in module LinearAlgebra at /home/ubuntu/julia/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/bitarray.jl:238 overwritten in module LinearAlgebra at /home/ubuntu/julia/stdlib/LinearAlgebra/src/bitarray.jl:238.

```

and testing errors out due to a method ambiguity on `*`.

This seem to me to indicate some conflict between the stdlib and another version (compiled?) under `.../julia/usr/share/julia/stdlib/v1.11/LinearAlgebra`

Did I do something wrong when building julia?  
p.s. The package otherwise seems to run, with or without my additions (using `develop`)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [December 23, 2023, 7:18pm UTC](https://discourse.julialang.org/t/advice-on-contributing-to-std-libs/107980/2 "2023-12-23T19:18:59Z")

</div>

For minor changes, I usually do not follow those instructions and use Revise.jl instead.

> **[Home · Revise.jl](https://timholy.github.io/Revise.jl/stable/#What-Revise-can-track)**
>
> Documentation for Revise.jl.

The warning you found appears to be a form of type piracy. The LinearAlgebra package is declaring a new method on a function it does not own for types it also does not own. This a bug in `LinearAlgebra` and the definition should be moved to the `Base` module.

---

<div class="post-metadata">

**Author:** ![nomadbl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nomadbl/32/205644_2.png) [@nomadbl](https://discourse.julialang.org/u/nomadbl)\
**Post date:** [December 23, 2023, 8:59pm UTC](https://discourse.julialang.org/t/advice-on-contributing-to-std-libs/107980/3 "2023-12-23T20:59:19Z")

</div>

In addition to possibly type piracy here is the error message I got (shortened a bit for brevity):

```julia
Error During Test at /home/ubuntu/julia/stdlib/LinearAlgebra/test/triangular.jl:225
  Test threw exception
  Expression: exp(Matrix(log(A1))) ≈ A1
  MethodError: *(::Matrix{Float32}, ::Matrix{Float32}) is ambiguous.
  
  Candidates:
    *(A::Union{LinearAlgebra.Adjoint{...}, LinearAlgebra.Transpose{...}, StridedMatrix{...}} where ..., B::Union{LinearAlgebra.Adjoint{...}, LinearAlgebra.Transpose{...}, StridedMatrix{...}} where ...)
      @ LinearAlgebra ~/julia/stdlib/LinearAlgebra/src/matmul.jl:114
    ........ (same signature as above)
      @ LinearAlgebra ~/julia/usr/share/julia/stdlib/v1.11/LinearAlgebra/src/matmul.jl:114
  To resolve the ambiguity, try making one of the methods more specific, or adding a new method more specific than any of the existing applicable methods.

```

So this looks to be some conflict between the source code and the build I got under `.../v.1.11/...`?

It’s important to me to be able to run the package tests before making a PR.  
Thanks!

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [December 23, 2023, 9:55pm UTC](https://discourse.julialang.org/t/advice-on-contributing-to-std-libs/107980/4 "2023-12-23T21:55:01Z")

</div>

I actually would prefer if you did not abbreviate the errors. I’m having to interpolate here more than I would like.

Yes, I believe you are correct. There is a conflict between the standard LinearAlgebra and the one you are editing. I suggest changing the UUID back and and running `make -j8` again, and then running the tests to see if they persist.

After thinking about it, I think the Revise workflow may have distinct advantages here. The workflow you pointed to does not really work well for something as embedded in Julia as LinearAlgebra. You may need to alternate between doing some targeted or manual testing and running the comprehensive tests after recompiling.

---

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [December 24, 2023, 3:08am UTC](https://discourse.julialang.org/t/advice-on-contributing-to-std-libs/107980/5 "2023-12-24T03:08:49Z")

</div>

Yes, please use `using Revise, LinearAlgebra; Revise.track(LinearAlgebra)` instead of changing the UUID. You can test the code by running `include("stdlib/LinearAlgebra/test/runtests.jl")`, or by including one of the specific test files.

Changing the UUID is possibly more relevant to excised stdlib packages, where there would be two modules by the same name.
