Help with updating fortran wrapper

I maintain the GLMNet.jl package, which wraps the fortran internals of the glmnet R package. This fortran dependency is shipped as glmnet_jll, and currently uses the version built here

This version of the fortran code dates from 2014, and there have been a number of updates since, so I would like to update the JLL to build the latest version of the code, however I am running into problems with the resulting binary. I am not the original developer of the package and know next to nothing about fortran so am not sure what is going wrong.

I had already updated the JLL to use a more recent source a while ago (here) which builds successfully, but when the resulting library is used from the existing GLMNet.jl, it runs into a segfault:

(GLMNet) pkg> test
...
     Testing Running tests...

signal (11): Segmentation fault: 11
in expression starting at /private/tmp/GLMNet.jl/test/runtests.jl:16
getindex at ./array.jl:924 [inlined]
#glmnet!#10 at /private/tmp/GLMNet.jl/src/GLMNet.jl:264
glmnet! at /private/tmp/GLMNet.jl/src/GLMNet.jl:271
#glmnet#40 at /private/tmp/GLMNet.jl/src/GLMNet.jl:485 [inlined]
glmnet at /private/tmp/GLMNet.jl/src/GLMNet.jl:485 [inlined]
#glmnet#41 at /private/tmp/GLMNet.jl/src/GLMNet.jl:487
glmnet at /private/tmp/GLMNet.jl/src/GLMNet.jl:487 [inlined]
glmnet at /private/tmp/GLMNet.jl/src/GLMNet.jl:487

The line it is crashing on is this one, where it tries to access alm to get results after calling the fortran code. Right above this, it accessed the value of lmu_ref which was also passed into the fortran code, so some parts seem to be working. I am wondering if there is something about the ccall that needs to be updated, but don’t know enough about fortran to know what to try next.

To help narrow the problem, I bisected the fortran code inside the glmnet R package to find which changes led to this error, and found that the last working version was 2.0-13 and was broken in 2.0-16. I added the fortran files and a cleaned diff to a gist here:

Most of the changes seem to be updating the type declarations from real to double precision, which I think is supposed to be a no-op (all the relevant variables were/are passed as Ref{Float64})

I would appreciate any guidance or help in getting this working!

Is there a branch with these changes?

-viral

I just pushed a branch to GitHub - JuliaStats/GLMNet.jl at jd/jll

The only change is altering the compat for glmnet_jll