rviscarra / webrtc-remote-screen

Stream a remote desktop screen directly to your browser
MIT License
469 stars 72 forks source link

go build failed #5

Open changchichung opened 3 years ago

changchichung commented 3 years ago

I know there's a similar issue already https://github.com/rviscarra/webrtc-remote-screen/issues/2

but in my case , I didn't get the binary .

chang@hq39:~/git/webrtc-remote-screen$ make
go build -tags "h264enc" cmd/agent.go
# github.com/gen2brain/x264-go/x264c
/usr/bin/ld: x264c_analyse_linux_amd64.syso: in function `x264_analyse_init_costs':
analyse.c:(.text+0x27115): undefined reference to `__log2f_finite'
collect2: error: ld returned 1 exit status
# github.com/gen2brain/x264-go/x264c
In file included from ../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/x264c_cgo.go:31:0:
../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/external/x264/encoder/encoder.c: In function ‘x264_encoder_open_152’:
../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/external/x264/encoder/encoder.c:1724:37: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
     snprintf( level, sizeof(level), "%d.%d", h->sps->i_level_idc/10, h->sps->i_level_idc%10 );
                                     ^~~~~~~
../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/external/x264/encoder/encoder.c:1724:37: note: directive argument in the range [-214748364, 214748364]
../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/external/x264/encoder/encoder.c:1724:37: note: directive argument in the range [-9, 9]
In file included from /usr/include/stdio.h:867:0,
                 from ../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/external/x264/common/osdep.h:33,
                 from ../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/external/x264/common/common.h:117,
                 from ../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/external/x264/common/mc.c:27,
                 from ../../go/pkg/mod/github.com/gen2brain/x264-go@v0.0.0-20180306035800-58f586137654/x264c/x264c_cgo.go:6:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 4 and 14 bytes into a destination of size 4
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:24:agent] 錯誤 2

OS: ubuntu 20.04 x64 GO version : 1.13.8

any suggestions ?

changchichung commented 3 years ago

update looks like the h.264 codec error I change decoders to vp8 then it's ok to make.

libx264 version

libx264-155/focal,now 2:0.155.2917+git0a84d98-2 amd64 [已安裝,自動]
  x264 video coding library

libx264-dev/focal,now 2:0.155.2917+git0a84d98-2 amd64 [已安裝]
  development files for libx264
bocklucas commented 3 years ago

I had a similar issue, same error as original post. Then, when running

make encoders=vp8

I got

go build -tags "vp8enc" cmd/agent.go
# pkg-config --cflags  -- vpx
Package vpx was not found in the pkg-config search path.
Perhaps you should add the directory containing `vpx.pc'
to the PKG_CONFIG_PATH environment variable
No package 'vpx' found
pkg-config: exit status 1
make: *** [Makefile:24: agent] Error 2

Resolved by running

sudo apt install libvpx-dev

Was then able to build with

make encoders=vp8

OS: Ubuntu 20.04 x64 LTS Go Version:

go version
go version go1.15.6 linux/amd64
Delky commented 3 years ago

I solved the problem with this following command :

go mod tidy

Go will download all requirements in go.sum.

radove commented 2 years ago

@changchichung There was a bug associated with an older version of the gen2brain x264-go library. The fix for this is to run the following: go get -u github.com/gen2brain/x264-go. Learn more about the issue here: https://github.com/gen2brain/x264-go/issues/6