matrix-media-repo icon indicating copy to clipboard operation
matrix-media-repo copied to clipboard

arm64 support: Docker Images

Open nervous-inhuman opened this issue 3 years ago • 1 comments

Hi,

I'm migrating my setup away from x86_64 into a arm64 machine, and I've noticed that media-repo images don't have an image for this architecture.

Would you consider whether adding build support for this architecture is feasible?

Thanks!

nervous-inhuman avatar Apr 01 '22 17:04 nervous-inhuman

I found an issue with the gomodule github.com/jdeng/goheif/libde265 on aarch64:

# github.com/jdeng/goheif/libde265
g++: error: unrecognized command-line option ‘-msse4.1’

Related to this issue: https://github.com/jdeng/goheif/issues/18 and they mention a drop-in replacement gomodule: https://github.com/adrium/goheif

Patch to make media-repo work on aarch64:

diff --git a/go.mod b/go.mod
index fc0d45e..568f427 100644
--- a/go.mod
+++ b/go.mod
@@ -6,6 +6,7 @@ require (
 	github.com/DavidHuie/gomigrate v0.0.0-20190826182718-4adc4b3de142
 	github.com/Jeffail/tunny v0.0.0-20210126202424-1b37d6cb867a
 	github.com/PuerkitoBio/goquery v1.6.1
+	github.com/adrium/goheif v0.0.0-20210309200126-b184a7b446fa // indirect
 	github.com/ajstarks/svgo v0.0.0-20200725142600-7a3c8b57fecb // indirect
 	github.com/alioygur/is v1.0.3
 	github.com/andybalholm/cascadia v1.2.0 // indirect
@@ -44,7 +45,6 @@ require (
 	github.com/ipfs/go-ipfs-config v0.12.0
 	github.com/ipfs/go-ipfs-files v0.0.8
 	github.com/ipfs/interface-go-ipfs-core v0.4.0
-	github.com/jdeng/goheif v0.0.0-20200323230657-a0d6a8b3e68f
 	github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
 	github.com/k3a/html2text v1.0.7
 	github.com/kettek/apng v0.0.0-20191108220231-414630eed80f
diff --git a/go.sum b/go.sum
index 1f9d94b..75fbdfe 100644
--- a/go.sum
+++ b/go.sum
@@ -53,6 +53,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx
 github.com/Stebalien/go-bitfield v0.0.1 h1:X3kbSSPUaJK60wV2hjOPZwmpljr6VGCqdq4cBLhbQBo=
 github.com/Stebalien/go-bitfield v0.0.1/go.mod h1:GNjFpasyUVkHMsfEOk8EFLJ9syQ6SI+XWrX9Wf2XH0s=
 github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
+github.com/adrium/goheif v0.0.0-20210309200126-b184a7b446fa h1:ISwtQHwIaKiwhFFmBOIib1o1jH3UvtKPnsEo45zsVj0=
+github.com/adrium/goheif v0.0.0-20210309200126-b184a7b446fa/go.mod h1:aKVJoQ0cc9K5Xb058XSnnAxXLliR97qbSqWBlm5ca1E=
 github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
 github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
@@ -675,8 +677,6 @@ github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr1
 github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
 github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
 github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
-github.com/jdeng/goheif v0.0.0-20200323230657-a0d6a8b3e68f h1:jYkcRYsnnvPF07yn4XJx3k8duM4KDw3QYB3p8bUrk80=
-github.com/jdeng/goheif v0.0.0-20200323230657-a0d6a8b3e68f/go.mod h1:G7IyA3/eR9IFmUIPdyP3c0l4ZaqEvXAk876WfaQ8plc=
 github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
 github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
 github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
diff --git a/thumbnailing/i/heif.go b/thumbnailing/i/heif.go
index 66da380..e05e498 100644
--- a/thumbnailing/i/heif.go
+++ b/thumbnailing/i/heif.go
@@ -3,7 +3,7 @@ package i
 import (
 	"bytes"
 	"errors"
-	"github.com/jdeng/goheif"
+	"github.com/adrium/goheif"
 	"github.com/turt2live/matrix-media-repo/common/rcontext"
 	"github.com/turt2live/matrix-media-repo/thumbnailing/m"
 )

SharkyRawr avatar Apr 01 '22 19:04 SharkyRawr

FYI, with the latest release, this cropped up instead: Error relocating /usr/local/bin/media_repo: _ZSt28__throw_bad_array_new_lengthv: symbol not found

nervous-inhuman avatar Feb 27 '23 20:02 nervous-inhuman

In testing the build locally on an arm64 VM, this is working again. The next release won't have pre-built arm64 images, but folks should be able to build their own.

turt2live avatar Sep 05 '23 17:09 turt2live