Closed haochenx closed 11 months ago
one thing I just realized is that the arm hardware that worked with gsl were all running 64bit linux (where uname -a
reports the CPU architecture being aarch64
) but the raspbian that failed to install gsl is a 32bit linux (where uname -a
reports armv7l
)
I assume your platform (processor) will signal alignment exceptions when trying to access doubles that are not aligned with double word boundaries. The initial author of the GSL-bindings may have made the assumption that e.g. OCaml float arrays are always properly aligned and may hence be passed directly to GSL. But this is not the case on your platform.
GSL is a fairly large library so I suspect that there are many instances in the bindings where such a problem can arise. The solution would be to copy the double array into an aligned memory region before passing it to GSL or other functions within the bindings. It might be even more future-proof to use the recently introduced OCaml floatarray
type, but this would change the API and potentially break a lot of code.
I'm afraid, I don't have the time to work on that though it will likely have to happen eventually because of upcoming runtime changes required for OCaml multicore support. This is expected to end support for implicitly unboxed float arrays in the OCaml runtime.
I see. So if I am understanding correctly it is fixable at the binding level but would require quite some work.
It seems that I could get around this by using a 64bit ubuntu installation on the raspi's for our current project. I may come back and attempt a fix if our project needs the 32bit Raspbian again.
Thanks for your time!
Sounds good, please feel free to submit PRs for any changes. I'd recommend holding off for a while though, until multicore OCaml is at least in beta testing. It will be easier to see then what changes are required.
Since OCaml 5.0.0 is out, this may be a good time to submit PRs if you have a fix for your problem!
Thanks for the ping!
We decided to stick with 64bit os for our raspi project and didn't proceed to attempt a fix. (Also I think OCaml 5.0 has dropped tier 1 support for 32bit arm architectures..)
We may have future arm projects and will definitely give another try of this if we need to get it work on 32bit platforms.
I'll close this issue, we can always open new one if necessary.
I tried to install the gsl package via opam on Raspi 4b, and was getting the following error. do you think this could be easily fixed?
I have been successfully install and use the gsl package on other arm devices (including the Xilinx ZCU104, NVidia Jetson nano, and a few Android devices)
System info:
and ocaml version is 4.09.1