evmar / gocairo

autogenerated full golang bindings for cairo
Apache License 2.0
36 stars 9 forks source link

Issues Building on Raspberry Pi 4 (Raspbian) #5

Open azurefreecovid opened 4 years ago

azurefreecovid commented 4 years ago

Hi there,

I'd like to get this Go library building on my Raspberry Pi, but I keep getting this error

pi@raspberrypi:~/gocairo $ make                                                                                                                                                                             [60/1945]go install github.com/martine/gocairo/cairo
# github.com/martine/gocairo/cairo                                   
../go/src/github.com/martine/gocairo/cairo/path.go:43:13: type [1073741824]PathPoint larger than address space
../go/src/github.com/martine/gocairo/cairo/path.go:43:13: type [1073741824]PathPoint too large
../go/src/github.com/martine/gocairo/cairo/cairo.go:110:17: type [1073741824]_Ctype_cairo_path_data_t larger than address space                                                                                     
../go/src/github.com/martine/gocairo/cairo/cairo.go:110:17: type [1073741824]_Ctype_cairo_path_data_t too large
../go/src/github.com/martine/gocairo/cairo/cairo.go:3654:13: type [1073741824]_Ctype_cairo_svg_version_t larger than address space
../go/src/github.com/martine/gocairo/cairo/cairo.go:3654:13: type [1073741824]_Ctype_cairo_svg_version_t too large

Which I'm not exactly sure how to solve and would appreciate any pointers that people might have? I suspect it is due to the 32-bit architecture of the Raspbian distro, but am not totally sure.

Running uname on the Raspberry Pi reports the following:

Linux raspberrypi 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux
evmar commented 4 years ago

I haven't touched this code in 5 years (!) but I think the issue is code like

https://github.com/evmar/gocairo/blob/master/cairo/path.go#L43

    parts := (*[1 << 30]PathPoint)(pathData)

This is setting up the destination pointer for a copy operation, so it just wanted a "very big" array. I think you can reduce this to 1 << 20 and everything will work. (Do this in all the places the above error messages are complaining.)

azurefreecovid commented 4 years ago

Thanks for the very prompt reply and the guidance, I'll take a look