JuliaSpace / SatelliteToolbox.jl

A toolbox for satellite analysis written in julia language.
MIT License
248 stars 33 forks source link

Precompilation error when SatelliteToolbox and get_iers_eop are used as dependencies #75

Closed disberd closed 2 years ago

disberd commented 2 years ago

Hello,

I am using SatelliteToolbox as dependency in one of my packages (thanks for developing this!) and encountered a precompilation error when trying to import my own package.

The encountered error is:

ERROR: LoadError: Evaluation into the closed module `SatelliteToolbox` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `SatelliteToolbox` with `eval` during precompilation - don't do this.

And looking at the stacktrace is triggered when calling this macro inside the specific get_iers_eop_iau_1980 subfunction: https://github.com/JuliaSpace/SatelliteToolbox.jl/blob/c4dd8cc47a0d9882f392b482f72d6f90aa869d53/src/transformations/eop.jl#L140-L144 But the same happens with the other function get_iers_eop_iau_2000A slightly below the same source file as it share the same macro call to @RemoteFile.

You can easily try to reproduce the same error by creating a temp package, add SatelliteToolbox to its environment and then have your module file simply be:

module SatToolbox_error

using SatelliteToolbox

get_iers_eop(Val(:IAU2000A))

end # module

The error above will pop up as soon as you try to precompile your temp package (called SatToolbox_error above).

It seems the problem indeed comes from the use of @eval above inside @RemoteFile. Luckily that is not needed, and I already tested a small modification to properly use @RemoteFile without needing @eval.

The proposed fix (which correctly removes the pre-compilation errors) is submitted in a separate PR (https://github.com/JuliaSpace/SatelliteToolbox.jl/pull/76)

rconnorjohnstone commented 1 year ago

This error was fixed on the main branch as of Feb 4, but the last release of this package was in January. Would it be possible to issue a new "official" version that contains this fix? It's inconvenient to not be able to use a specific version number in my Project.toml files, but instead have to specify the master branch manually.

ronisbr commented 1 year ago

Oops! Sorry! I will do this.