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 linux error #477

Open
eeevanyip opened this issue Mar 1, 2023 · 3 comments
Open

go build linux error #477

eeevanyip opened this issue Mar 1, 2023 · 3 comments

Comments

@eeevanyip
Copy link

I tried to build the example of examples/webrtc into Linux in the Mac environment, but an error occurred.
What is the reason and how to solve it?

Compile webrtc example

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go

The following error occurs

# github.com/pion/mediadevices/pkg/driver/microphone
../../pkg/driver/microphone/microphone.go:29:16: undefined: malgo.AllocatedContext
../../pkg/driver/microphone/microphone.go:36:8: undefined: malgo.DeviceInfo
../../pkg/driver/microphone/microphone.go:48:19: undefined: malgo.InitContext
../../pkg/driver/microphone/microphone.go:48:42: undefined: malgo.ContextConfig
../../pkg/driver/microphone/microphone.go:86:31: undefined: malgo.DeviceInfo
../../pkg/driver/microphone/microphone.go:105:19: undefined: malgo.DeviceConfig
../../pkg/driver/microphone/microphone.go:106:22: undefined: malgo.DeviceCallbacks
../../pkg/driver/microphone/microphone.go:123:30: m.ID undefined (type *microphone has no field or method ID)
../../pkg/driver/microphone/microphone.go:141:23: undefined: malgo.InitDevice
../../pkg/driver/microphone/microphone.go:199:27: m.Formats undefined (type *microphone has no field or method Formats)
../../pkg/driver/microphone/microphone.go:199:27: too many errors
# github.com/pion/mediadevices/pkg/codec/x264
../../pkg/codec/x264/params.go:49:9: undefined: newEncoder
# github.com/pion/mediadevices/pkg/codec/opus
../../pkg/codec/opus/params.go:71:9: undefined: newEncoder
@at-wat
Copy link
Member

at-wat commented Mar 1, 2023

Hi @anamyip, codecs requires CGO since they use C libraries.

@eeevanyip
Copy link
Author

Hi @anamyip, codecs requires CGO since they use C libraries.

How to modify the following command?

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go

@at-wat
Copy link
Member

at-wat commented Mar 1, 2023

CGO_ENABLED=1
Cross-compiling with CGO requires a C cross-compiler.
I don't know how to setup it on Mac.

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

2 participants