luke-cha / ios-screen-mirror

ios-screen-mirror
MIT License
57 stars 9 forks source link

Problems with go build #5

Closed man4567890 closed 11 months ago

man4567890 commented 2 years ago

Hi, I'm getting this when I do the go build

ios-screen-mirror $ go build
# github.com/3d0c/gmf
../../go/pkg/mod/github.com/3d0c/gmf@v0.0.0-20220425074253-5646e6e80daf/frame_go112.go:308:2: could not determine kind of name for C.AV_FRAME_DATA_QP_TABLE_DATA
../../go/pkg/mod/github.com/3d0c/gmf@v0.0.0-20220425074253-5646e6e80daf/frame_go112.go:309:2: could not determine kind of name for C.AV_FRAME_DATA_QP_TABLE_PROPERTIES
ios-screen-mirror $ ls -ltr
total 112
-rw-r--r--  1 diginetiot  staff   1066 Jun 21 08:08 LICENSE
-rw-r--r--  1 diginetiot  staff   1678 Jun 21 08:08 README.md
-rw-r--r--  1 diginetiot  staff   4564 Jun 21 08:08 h264ToJpeg.go
-rw-r--r--  1 diginetiot  staff   2527 Jun 21 08:08 iOSImageReceiver.go
-rw-r--r--  1 diginetiot  staff   7522 Jun 21 08:08 main.go
-rw-r--r--  1 diginetiot  staff  10657 Jun 21 08:08 util.go
-rw-r--r--  1 diginetiot  staff    490 Jun 21 08:14 go.mod
-rw-r--r--  1 diginetiot  staff  10955 Jun 21 08:14 go.sum
ios-screen-mirror $ 

go version
go version go1.18.3 darwin/amd64
ios-screen-mirror $ brew info ffmpeg
ffmpeg: stable 5.0.1 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/5.0.1-with-options_2 (271 files, 50.7MB) *
  Built from source on 2022-06-21 at 08:35:16
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/ffmpeg.rb
License: GPL-2.0-or-later
==> Dependencies
Build: nasm ✔, pkg-config ✔
Required: aom ✔, dav1d ✔, fontconfig ✔, freetype ✔, frei0r ✔, gnutls ✔, lame ✔, libass ✔, libbluray ✔, librist ✔, libsoxr ✔, libvidstab ✔, libvmaf ✔, libvorbis ✔, libvpx ✔, opencore-amr ✔, openjpeg ✔, opus ✔, rav1e ✔, rubberband ✔, sdl2 ✔, snappy ✔, speex ✔, srt ✔, tesseract ✔, theora ✔, webp ✔, x264 ✔, x265 ✔, xvid ✔, xz ✔, zeromq ✔, zimg ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 160,983 (30 days), 412,801 (90 days), 1,514,238 (365 days)
install-on-request: 141,353 (30 days), 363,257 (90 days), 1,293,037 (365 days)
build-error: 40 (30 days)
ios-screen-mirror $ 

Please any suggestions on how to fix this?

man4567890 commented 2 years ago

PLEASE HELP!! Even with ffmpeg 4.2.7 I get errors, I really need to get this to work, please help

ffmpeg $ cd ../ios-screen-mirror/
ios-screen-mirror $ go get github.com/3d0c/gmf
go: upgraded github.com/3d0c/gmf v0.0.0-20200614092945-e58d8d5a6035 => v0.0.0-20220425074253-5646e6e80daf
ios-screen-mirror $ go get
ios-screen-mirror $ go build
# github.com/3d0c/gmf
../../go/pkg/mod/github.com/3d0c/gmf@v0.0.0-20220425074253-5646e6e80daf/frame_go112.go:302:2: could not determine kind of name for C.AV_FRAME_DATA_FILM_GRAIN_PARAMS
../../go/pkg/mod/github.com/3d0c/gmf@v0.0.0-20220425074253-5646e6e80daf/frame_go112.go:313:2: could not determine kind of name for C.AV_FRAME_DATA_SEI_UNREGISTERED
../../go/pkg/mod/github.com/3d0c/gmf@v0.0.0-20220425074253-5646e6e80daf/frame_go112.go:317:2: could not determine kind of name for C.AV_FRAME_DATA_VIDEO_ENC_PARAMS
ios-screen-mirror $ /usr/local/ffmpeg/bin/ffmpeg 
ffmpeg version n4.2.7 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.17.3.1)
  configuration: --prefix=/usr/local/ffmpeg --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
ios-screen-mirror $  
man4567890 commented 2 years ago

Got a bit further..

./ios-screen-mirror -pull
{"level":"info","msg":"no udid specified, using '51e86d44707a71cb1774eca3a73f05bf34d0265d'","time":"2022-06-23T11:56:01+02:00"}
Assertion failed: (list_empty(&darwin_cached_devices)), function darwin_init, file darwin_usb.c, line 605.
SIGABRT: abort
PC=0x7ff81937f00e m=3 sigcode=0
signal arrived during cgo execution

goroutine 1 [syscall]:
runtime.cgocall(0x425a210, 0xc00012f688)
    /usr/local/Cellar/go/1.18.3/libexec/src/runtime/cgocall.go:157 +0x5c fp=0xc00012f660 sp=0xc00012f628 pc=0x4007ebc
github.com/google/gousb._Cfunc_libusb_init(0xc000016790)
    _cgo_gotypes.go:552 +0x48 fp=0xc00012f688 sp=0xc00012f660 pc=0x423ba68
github.com/google/gousb.libusbImpl.init.func1(0x160300000000?)
    /Users/diginetiot/go/pkg/mod/github.com/google/gousb@v0.0.0-20190812193832-18f4c1d8a750/libusb.go:176 +0x45 fp=0xc00012f6c0 sp=0xc00012f688 pc=0x423c745
github.com/google/gousb.libusbImpl.init({})
    /Users/diginetiot/go/pkg/mod/github.com/google/gousb@v0.0.0-20190812193832-18f4c1d8a750/libusb.go:176 +0x2f fp=0xc00012f6e8 sp=0xc00012f6c0 pc=0x423c6af
github.com/google/gousb.(*libusbImpl).init(0xc00012f728?)
    <autogenerated>:1 +0x2a fp=0xc00012f6f8 sp=0xc00012f6e8 pc=0x4242f0a
github.com/google/gousb.newContextWithImpl({0x4357998, 0x4520c98})
    /Users/diginetiot/go/pkg/mod/github.com/google/gousb@v0.0.0-20190812193832-18f4c1d8a750/usb.go:144 +0x2e fp=0xc00012f730 sp=0xc00012f6f8 pc=0x423a3ee
github.com/google/gousb.NewContext(...)
    /Users/diginetiot/go/pkg/mod/github.com/google/gousb@v0.0.0-20190812193832-18f4c1d8a750/usb.go:159
main.EnableQTConfig({{0xc0000203c0, 0x28}, {0xc0000165a0, 0x6}, 0x5, 0xffffffffffffffff, 0x5ac, 0x12a8, {0xc00001a220, 0x1f}})
    /Users/diginetiot/go-workspace/ios-screen-mirror/util.go:208 +0x8a fp=0xc00012f8d0 sp=0xc00012f730 pc=0x425666a
main.startWithConsumer({0x43561e8, 0xc000106190}, {0x0?, 0x203000?}, 0x0?, 0xc0000732f0?)
    /Users/diginetiot/go-workspace/ios-screen-mirror/main.go:153 +0x19b fp=0xc00012fc68 sp=0xc00012f8d0 pc=0x425323b
main.gopull({0x42df027, 0x14}, {0x0, 0x0}, {0x0, 0x0})
    /Users/diginetiot/go-workspace/ios-screen-mirror/main.go:108 +0x4af fp=0xc00012fef0 sp=0xc00012fc68 pc=0x4252a4f
main.main()
    /Users/diginetiot/go-workspace/ios-screen-mirror/main.go:56 +0x2a6 fp=0xc00012ff80 sp=0xc00012fef0 pc=0x42520e6
runtime.main()
    /usr/local/Cellar/go/1.18.3/libexec/src/runtime/proc.go:250 +0x212 fp=0xc00012ffe0 sp=0xc00012ff80 pc=0x4039a92
runtime.goexit()
    /usr/local/Cellar/go/1.18.3/libexec/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc00012ffe8 sp=0xc00012ffe0 pc=0x4066741

goroutine 7 [syscall]:
os/signal.signal_recv()
    /usr/local/Cellar/go/1.18.3/libexec/src/runtime/sigqueue.go:148 +0x28
os/signal.loop()
    /usr/local/Cellar/go/1.18.3/libexec/src/os/signal/signal_unix.go:23 +0x19
created by os/signal.Notify.func1.1
    /usr/local/Cellar/go/1.18.3/libexec/src/os/signal/signal.go:151 +0x2a

goroutine 8 [chan receive]:
main.waitForSigInt.func1()
    /Users/diginetiot/go-workspace/ios-screen-mirror/main.go:178 +0x58
created by main.waitForSigInt
    /Users/diginetiot/go-workspace/ios-screen-mirror/main.go:177 +0xf8

goroutine 9 [sync.Cond.Wait]:
sync.runtime_notifyListWait(0xc00005e450, 0x1)
    /usr/local/Cellar/go/1.18.3/libexec/src/runtime/sema.go:513 +0x13d
sync.(*Cond).Wait(0x0?)
    /usr/local/Cellar/go/1.18.3/libexec/src/sync/cond.go:56 +0x8c
go.nanomsg.org/mangos/v3/protocol/xpush.(*socket).sender(0xc0001024e0)
    /Users/diginetiot/go/pkg/mod/go.nanomsg.org/mangos/v3@v3.0.1/protocol/xpush/xpush.go:110 +0xba
created by go.nanomsg.org/mangos/v3/protocol/xpush.NewProtocol
    /Users/diginetiot/go/pkg/mod/go.nanomsg.org/mangos/v3@v3.0.1/protocol/xpush/xpush.go:301 +0x116

goroutine 11 [IO wait]:
internal/poll.runtime_pollWait(0x4f967a8, 0x72)
    /usr/local/Cellar/go/1.18.3/libexec/src/runtime/netpoll.go:302 +0x89
internal/poll.(*pollDesc).wait(0xc000152180?, 0xc000200008?, 0x0)
    /usr/local/Cellar/go/1.18.3/libexec/src/internal/poll/fd_poll_runtime.go:83 +0x32
internal/poll.(*pollDesc).waitRead(...)
    /usr/local/Cellar/go/1.18.3/libexec/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0xc000152180, {0xc000200008, 0x8, 0x8})
    /usr/local/Cellar/go/1.18.3/libexec/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc000152180, {0xc000200008?, 0x1000000000400?, 0x400?})
    /usr/local/Cellar/go/1.18.3/libexec/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000010098, {0xc000200008?, 0xc000030598?, 0x404dd52?})
    /usr/local/Cellar/go/1.18.3/libexec/src/net/net.go:183 +0x45
io.ReadAtLeast({0x4f96910, 0xc000010098}, {0xc000200008, 0x8, 0x8}, 0x8)
    /usr/local/Cellar/go/1.18.3/libexec/src/io/io.go:331 +0x9a
io.ReadFull(...)
    /usr/local/Cellar/go/1.18.3/libexec/src/io/io.go:350
encoding/binary.Read({0x4f96910, 0xc000010098}, {0x4357418, 0x4520c98}, {0x4275ac0?, 0xc000200000})
    /usr/local/Cellar/go/1.18.3/libexec/src/encoding/binary/binary.go:166 +0xc8
go.nanomsg.org/mangos/v3/transport.(*conn).Recv(0xc0001025a0)
    /Users/diginetiot/go/pkg/mod/go.nanomsg.org/mangos/v3@v3.0.1/transport/conn.go:53 +0x6f
go.nanomsg.org/mangos/v3/internal/core.(*pipe).RecvMsg(0xc000102600)
    /Users/diginetiot/go/pkg/mod/go.nanomsg.org/mangos/v3@v3.0.1/internal/core/pipe.go:170 +0x2a
go.nanomsg.org/mangos/v3/protocol/xpush.(*pipe).receiver(0xc000073590)
    /Users/diginetiot/go/pkg/mod/go.nanomsg.org/mangos/v3@v3.0.1/protocol/xpush/xpush.go:126 +0x3a
created by go.nanomsg.org/mangos/v3/protocol/xpush.(*socket).AddPipe
    /Users/diginetiot/go/pkg/mod/go.nanomsg.org/mangos/v3@v3.0.1/protocol/xpush/xpush.go:258 +0x1e5

rax    0x0
rbx    0x70000a9fd000
rcx    0x70000a9fcd58
rdx    0x0
rdi    0x1603
rsi    0x6
rbp    0x70000a9fcd80
rsp    0x70000a9fcd58
r8     0x25d
r9     0xcccccccccccccccd
r10    0x0
r11    0x246
r12    0x1603
r13    0x45b1028
r14    0x6
r15    0x16
rip    0x7ff81937f00e
rflags 0x246
cs     0x7
fs     0x0
gs     0x0

If I do not do this command,
./ios_video_stream -port 7879 -stream

I get

./ios-screen-mirror -pull
{"err":"dial tcp 127.0.0.1:7879: connect: connection refused","level":"fatal","msg":"Socket connect error","spec":"tcp://127.0.0.1:7879","time":"2022-06-23T11:58:53+02:00","type":"err_socket_connect"}
jjunghyup commented 2 years ago

It seems that the version of ffmpeg viewed from m1 does not match the version of github.com/3d0c/gmf.

Get the source about ffmpeg from the following [https://github.com/FFmpeg/FFmpeg/releases/tag/n4.3.2](https://github.com/FFmpeg/FFmpeg/releases/tag/n4.3.2)

and then unzip

cd FFmpeg-n4.3.2
./configure --prefix=/usr/local/ffmpeg --enable-shared
make
make install

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ffmpeg/lib/pkgconfig/

and then go to ios-screen-mirror

cd ios-screen-mirror

go get -u [golang.org/x/sys](http://golang.org/x/sys)
go get [github.com/3d0c/gmf](http://github.com/3d0c/gmf)

go build

Try to do it.

man4567890 commented 2 years ago

I followed the steps but I do not think it worked

root@ubuntudevserver:/opt/temp/ios-screen-mirror# export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ffmpeg/lib/pkgconfig/
root@ubuntudevserver:/opt/temp/ios-screen-mirror# go get -u golang.org/x/sys
root@ubuntudevserver:/opt/temp/ios-screen-mirror# go get github.com/3d0c/gmf
root@ubuntudevserver:/opt/temp/ios-screen-mirror# go build
# github.com/3d0c/gmf
/root/go/pkg/mod/github.com/3d0c/gmf@v0.0.0-20220425074253-5646e6e80daf/frame_go112.go:302:2: could not determine kind of name for C.AV_FRAME_DATA_FILM_GRAIN_PARAMS
/root/go/pkg/mod/github.com/3d0c/gmf@v0.0.0-20220425074253-5646e6e80daf/frame_go112.go:313:2: could not determine kind of name for C.AV_FRAME_DATA_SEI_UNREGISTERED
root@ubuntudevserver:/opt/temp/ios-screen-mirror#ffmpeg -version
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr/local/ffmpeg --enable-shared
libavutil      56. 51.100 / 56. 70.100
libavcodec     58. 91.100 / 58.134.100
libavformat    58. 45.100 / 58. 76.100
libavdevice    58. 10.100 / 58. 13.100
libavfilter     7. 85.100 /  7.110.100
libswscale      5.  7.100 /  5.  9.100
libswresample   3.  7.100 /  3.  9.100
root@ubuntudevserver:/opt/temp/ios-screen-mirror# ls -ltr
total 56
-rw-r--r-- 1 root root  1678 Jun 23 08:42 README.md
-rw-r--r-- 1 root root  1066 Jun 23 08:42 LICENSE
-rw-r--r-- 1 root root 10657 Jun 23 08:42 util.go
-rw-r--r-- 1 root root  7522 Jun 23 08:42 main.go
-rw-r--r-- 1 root root  2527 Jun 23 08:42 iOSImageReceiver.go
-rw-r--r-- 1 root root  4564 Jun 23 08:42 h264ToJpeg.go
-rw-r--r-- 1 root root 10955 Jul 11 06:09 go.sum
-rw-r--r-- 1 root root   490 Jul 11 06:09 go.mod
root@ubuntudevserver:/opt/temp/ios-screen-mirror# 
wa275 commented 1 year ago

Has this been solved? Having the exact same problem.