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

I am facing log/slog is no in std (/usr/local/go/src/log/slog) #287

Closed
Marinero0214222 opened this issue Apr 30, 2024 · 5 comments
Closed
Assignees

Comments

@Marinero0214222
Copy link

Hi All,

I am using the following command to build shared library:
go build -buildvcs=false -buildmode=c-shared -gccgoflags="-s -w" -compiler=gccgo -o xxxx.so

but, finally, returns the final error message:
/home/sqc/go/pkg/mod/github.com/go-logr/logr@v1.4.1/context_slog.go:25:2: package log/slog is not in std (/usr/local/go/src/log/slog)

go version: go1.21.9 linux/amd64.

Please help to check if it is bug or not

Thanks,
Marinero

@pohly
Copy link
Contributor

pohly commented Apr 30, 2024

Double-check your Go installation. 1.21 should have log/slog: https://pkg.go.dev/log/slog@go1.21.0

@Marinero0214222
Copy link
Author

Marinero0214222 commented Apr 30, 2024

Hi @pohly

Yes. I checked. log/slog is present. but, still report this issue. are there other impacts?

I found if i used "compiler=gccgo" to build, returned this error. without it, using default gc, it has no issue.

Thanks,
Marinero

@pohly
Copy link
Contributor

pohly commented Apr 30, 2024

Perhaps -compiler=gccgo? Can you try without any flags?

@pohly pohly closed this as completed Apr 30, 2024
@Marinero0214222
Copy link
Author

Hi @pohly

I found the size of binary built by gc is around 15MB. So, I want to try use gccgo to build and compare the size difference.But, facing this issue.

Can you give some proposals?

Thanks,
Marinero

@thockin
Copy link
Contributor

thockin commented Apr 30, 2024

We can't attest to what gccgo does. https://go.dev/doc/install/gccgo says:

"""
The GCC 12 and 13 releases include a complete implementation of the Go 1.18 standard library. However, GCC does not yet include support for generics.
"""

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

3 participants