asticode/go-astiav

armv7hf build errors

Cacsjep opened this issue Β· 8 comments

Hey

I'm trying to build my Golang app for armv7hf (GOARM=7, GO_ARCH=arm) but I got this errors.
Have you seen a way or idea to fix the problem, i thinks its releated to 32bit because armv7hf is 32Bit?

/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/codec_context_flag.go:28:51: constant 2147483648 overflows CodecContextFlag
/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/channel_layout.go:96:77: cannot use cUlong(len(b)) (value of type _Ctype_ulong) as _Ctype_uint value in variable declaration
/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/dictionary.go:65:43: cannot use size (variable of type *_Ctype_ulong) as *_Ctype_uint value in variable declaration
/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/dictionary.go:71:52: cannot use size (variable of type _Ctype_ulong) as _Ctype_uint value in variable declaration
/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/frame.go:106:54: cannot use &linesize[0] (value of type *_Ctype_long) as *_Ctype_int value in variable declaration
/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/frame.go:178:94: cannot use cUlong(size) (value of type _Ctype_ulong) as _Ctype_uint value in variable declaration
/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/frame_side_data.go:25:11: cannot use d.c.size (variable of type _Ctype_uint) as _Ctype_ulong value in assignment
/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/packet.go:91:75: cannot use size (variable of type *_Ctype_ulong) as *_Ctype_uint value in variable declaration
/go/pkg/mod/github.com/asticode/go-astiav@v0.13.1/stream.go:61:75: cannot use size (variable of type *_Ctype_ulong) as *_Ctype_uint value in variable declaration

when building for aarch64 i have no errors.

FFmpeg version n5.1.2
Golang versions tested : 1.22, 1.20.14

Thanks

For channel layout for example we could do something like this

channel_layout.go:96:77
// Directly use C.size_t for the size parameter to ensure compatibility.
C.av_channel_layout_describe(l.c, (*C.char)(unsafe.Pointer(&b[0])), C.size_t(len(b)))

For channel layout for example we could do something like this

Great idea! πŸ’ͺ

FYI I've pushed in master a commit that uses C.size_t and C.ptrdiff_t wherever it's better for compatibility purposes.

I've also pushed a dockerfile to test on armv7hf and (even though it took me the whole day yesterday to build the image 😡) I'll take a look to the last remaining error (the constant overflow) πŸ‘

You should rebase your extradata PR to get this change as you'll need to use bytesFromC πŸ‘

Thank you immensely for the prompt update and your incredible efforts! πŸ’ͺ The enhancements for increased compatibility are fantastic. It’s also exciting to hear that we have the capability to conduct tests on armv7hf.

As soon as you've addressed the overflow issue, I'd be delighted to run tests on an actual armv7hf device. πŸ˜‰

I've completed the rebase and applied the review suggestions..

FYI I've fixed all compilation errors in the armv7hf Dockerfile I've added and I've pushed all fixes on master.

However tests related to opening a file with a FormatContext are failing (it doesn't manage to find the proper codec parameters πŸ€”) and I can't figure out why.

Could you run tests on you armv7hf device and let me know whether everything works as expected?

Cool. I will Test it and let u know.. thanks

However tests related to opening a file with a FormatContext are failing (it doesn't manage to find the proper codec parameters πŸ€”) and I can't figure out why.

After further investigating it seems to be related to the way ffmpeg has been built more than issues in the code. For instance libpng is not present in the arm image I'm using (and maybe not present in arm by default) and needs to be built manually/enabled properly when building ffmpeg.

OK thanks for Info, i do custom builds with disable everthing. An enable what i need. Looks like that person build ffmpeg just remove it maybe, for size or other issues. But pain in ass to Debugging

works on armv7hf device, greate work !!