Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go build failed #5

Open
changchichung opened this issue Jan 21, 2021 · 4 comments
Open

go build failed #5

changchichung opened this issue Jan 21, 2021 · 4 comments

Comments

@changchichung
Copy link

I know there's a similar issue already
#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/[email protected]/x264c/x264c_cgo.go:31:0:
../../go/pkg/mod/github.com/gen2brain/[email protected]/x264c/external/x264/encoder/encoder.c: In function ‘x264_encoder_open_152’:
../../go/pkg/mod/github.com/gen2brain/[email protected]/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/[email protected]/x264c/external/x264/encoder/encoder.c:1724:37: note: directive argument in the range [-214748364, 214748364]
../../go/pkg/mod/github.com/gen2brain/[email protected]/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/[email protected]/x264c/external/x264/common/osdep.h:33,
                 from ../../go/pkg/mod/github.com/gen2brain/[email protected]/x264c/external/x264/common/common.h:117,
                 from ../../go/pkg/mod/github.com/gen2brain/[email protected]/x264c/external/x264/common/mc.c:27,
                 from ../../go/pkg/mod/github.com/gen2brain/[email protected]/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
Copy link
Author

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
Copy link

bocklucas commented Feb 4, 2021

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
Copy link

Delky commented Oct 20, 2021

I solved the problem with this following command :

go mod tidy

Go will download all requirements in go.sum.

@radove
Copy link

radove commented Dec 10, 2021

@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: gen2brain/x264-go#6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants