51Degrees / device-detection-go

European Union Public License 1.2
0 stars 3 forks source link

Issue executing Prebid Server Go #58

Open heidi51degrees opened 2 weeks ago

heidi51degrees commented 2 weeks ago

Is it there an easy way to run or fix this? thanks.

vscode ➜ /workspaces/prebid-server (master) $ go run main.go

github.com/51Degrees/device-detection-go/v4/onpremise

/go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:24:34: undefined: dd.ResourceManager /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:25:34: undefined: dd.ConfigHash /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:242:21: undefined: dd.ConfigHash /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:307:12: undefined: dd.EvidencePrefix /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:312:53: undefined: dd.ResultsHash /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:319:16: undefined: dd.NewResultsHash /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:328:45: undefined: dd.Evidence /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:329:21: undefined: dd.NewEvidenceHash /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:358:43: undefined: dd.EvidenceKey /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:467:18: undefined: dd.NewResourceManager /go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.30/onpremise/onpremise.go:467:18: too many errors

justadreamer commented 2 weeks ago

This usually happens if either CGO_ENABLED env var is set to 0 or C compiler is missing. CGO_ENABLED is 1 by default, but maybe something overrides it on your system - f.e. here is how I can simulate the same errors on my Mac:

❯ CGO_ENABLED=0 go run main.go
# github.com/51Degrees/device-detection-go/v4/onpremise
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:31:34: undefined: dd.ResourceManager
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:32:34: undefined: dd.ConfigHash
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:106:36: undefined: dd.ConfigHash
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:343:12: undefined: dd.EvidencePrefix
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:351:56: undefined: dd.ResultsHash
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:358:16: undefined: dd.NewResultsHash
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:367:48: undefined: dd.Evidence
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:368:21: undefined: dd.NewEvidenceHash
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:417:43: undefined: dd.EvidenceKey
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:531:18: undefined: dd.NewResourceManager
../../../../go/pkg/mod/github.com/51!degrees/device-detection-go/v4@v4.4.35/onpremise/onpremise.go:531:18: too many errors

Setting CGO_ENABLED=1 resolves the above errors. Please see this doc for more details: https://github.com/prebid/prebid-server/tree/master/docs/build