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

undefined: locale.GetLanguage in darwin #30

Open
Tom5521 opened this issue Jan 10, 2025 · 7 comments
Open

undefined: locale.GetLanguage in darwin #30

Tom5521 opened this issue Jan 10, 2025 · 7 comments

Comments

@Tom5521
Copy link

Tom5521 commented Jan 10, 2025

No description provided.

@Tom5521
Copy link
Author

Tom5521 commented Jan 10, 2025

When I try to compile the example for darwin this error appears

$ GOOS=darwin go build ./examples/getlocale/
# github.com/jeandeaual/go-locale/examples/getlocale
examples/getlocale/main.go:11:25: undefined: locale.GetLocales
examples/getlocale/main.go:18:28: undefined: locale.GetLocale
examples/getlocale/main.go:25:26: undefined: locale.GetLanguage
examples/getlocale/main.go:32:24: undefined: locale.GetRegion

@gedw99
Copy link

gedw99 commented Feb 2, 2025

works for me on darwin arm64

apple@192 examples % cd getlocale 
apple@192 getlocale % go run .
Locales: [en]
Locale: en
Language: en
Region: 
GOOS=darwin go run .
Locales: [en]
Locale: en
Language: en
Region: 
apple@192 getlocale % 

@Tom5521
Copy link
Author

Tom5521 commented Feb 4, 2025

How strange, from my Linux it doesn't even compile

@gedw99
Copy link

gedw99 commented Feb 4, 2025

https://github.com/jeandeaual/go-locale/blob/master/locale_unix.go

You can easily work it out from there

@Tom5521
Copy link
Author

Tom5521 commented Feb 4, 2025

The problem is that this error appears when I try to cross compile

In previous versions I can easily compile the binary from Linux to Darwin, but in this one it is not possible

@gedw99
Copy link

gedw99 commented Feb 4, 2025

That’s because the Darwin version is cgo.

You need to compile on each OS.

Easy to do with GitHub actions

@gedw99
Copy link

gedw99 commented Feb 4, 2025

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