abema / go-mp4

Go library for reading and writing MP4 file
https://dev.to/sunfishshogi/go-mp4-golang-library-and-cli-tool-for-mp4-52o1
MIT License
466 stars 30 forks source link

mp4tool does not build on Mac #109

Closed TobbeEdgeware closed 2 years ago

TobbeEdgeware commented 2 years ago

Trying to build mp4tool on a Mac (MacOS Monterey) with Go 1.18 results in a lot of error messages like

../../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190412213103-97732733099d/unix/zsyscall_darwin_amd64.go:28:3: //go:linkname must refer to declared function or variable

This seems to be due to unix-specific way of getting the terminal width using terminal.GetSize() from the package golang.org/x/crypto/ssh/terminal.

I don't know of a OS-independent way of getting the terminal width, so I don't have a PR at the moment.

To avoid similar issues in the future, I'd suggest to add Github Actions test to test that the tool builds on not only Linux, but also Mac and Windows as is done in

https://github.com/edgeware/mp4ff/blob/master/.github/workflows/go.yml

Thanks for a nice library and tool!

sunfish-shogi commented 2 years ago

@TobbeEdgeware Thank you for your detailed information ! 🙇‍♂️

I tried to build by Go 1.18 on Mac and reached to same error. And I have no good solution yet, too.

This error does not occur on Go 1.17. So, I will start from researching Go 1.18 change.

And thank you for advice about CI ! I will consider to build by multi Go versions and multi platforms on CI.

sunfish-shogi commented 2 years ago

I created PR which replaces golang.org/x/crypto/ssh/terminal by golang.org/x/term. This version could be built by Go1.18/Mac.

https://cs.opensource.google/go/x/crypto/+/master:ssh/terminal/terminal.go;l=8;bpv=1;bpt=1 golang.org/x/crypto/ssh/terminal is already deprecated. I think this package had not maintained and is not working for Go 1.18.

I will merge this PR after checking other Go versions and platforms.

TobbeEdgeware commented 2 years ago

Thanks. I can confirm that I can build #110 on my Mac.

sunfish-shogi commented 2 years ago

Thank you.

I merged #110 and #111, and created release v0.7.1.

111 is new GH action workflow, checks build and test by Go1.16, 17, and 18 on Win, Mac, and Linux.

I decided these Go versions based on https://go.dev/doc/devel/release#policy .