heliosdrm / GRUtils.jl

Tools for using the GR framework in Julia
Other
31 stars 6 forks source link

please tag a new release #92

Closed jheinen closed 3 years ago

jheinen commented 3 years ago

Hi Helios,

could you please tag a new release? I published GR 0.55.0 yesterday - there should be now changes affecting GRUtils. As we added support for the Apple M1 architecture, I'd like to make some extensive tests with GR, Plots and GRUtils.

At this point I would like to thank you for your work on GRUtils.

Thanks in advance.

Best, Josef

heliosdrm commented 3 years ago

Thanks Josef. I was intrigued by a failure in the CI nightly tests. I think it's related to https://github.com/jheinen/GR.jl/commit/205e1e2ad55fbad16478f68a0be54db4e68f309a ("Use 'Int32' return type for callback function", which affect GR.axeslbl). I use it to create custom labels in the X/Y axes (for instance in bar plots), through the function ticklabels_fun, which right now makes a closure that returns nothing, according to the older definition of GR.axeslbl.

It's easy to fix: I only have to modify those closures such that they return some Int32 value - dropping compatibility with older versions of GR, but I have two doubts:

  1. What integer value is it meant to return?
  2. Why is GR.axeslbl now using functions that return Int32, if the corresponding function in the C library takes void functions?

(Also, if this change is correct, https://github.com/jheinen/GR.jl/blob/d72542614a4b1ba835690ab11a87e5434e11426b/src/jlgr.jl#L417-L427 should be modified too.)

jheinen commented 3 years ago

I had to change this because with the older definition (nothing) Julia 1.7-DEV (aarch64) complained about an invalid return type and suggested Int32. I changed it end everything worked fine. I didn't think about it further and wasn't aware that it could cause problems in GRUtils.

I will test it again - may be it was an intermediate "problem". If the problem persists, we will have to live with this modification.

jheinen commented 3 years ago

Yes, on Apple M1 I get WARNING: cfunction: return type of #1 does not match, but I can use the axes function (without function arguments).

Unfortunately, there seems to be a problem when I try to provide tick labels:

   fx = ["a", "b", "c", "d", "e"] |> ticklabel_fun
   fy = identity |> ticklabel_fun
   setwindow(1, 5, 1, 5)
   axeslbl(1, 1, 1, 1, 1, 1, -0.005, fx, fy)
   updatews()

... results in an error:

ERROR: LoadError: cfunction: closures are not supported on this platform
in expression starting at /Users/softadm/bug-cfunction.jl:105
heliosdrm commented 3 years ago

So, is it safe if I just make the closures return Int32(0), to comply with the new return type?

jheinen commented 3 years ago

Yes. I think we have no other choice until the problem is fixed on the Julia side.