-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/cgo: GNU/kFreeBSD support #3533
Milestone
Comments
Debian GNU/kFreeBSD is a somewhat hybrid system, i.e. FreeBSD kernel but glibc. Because we inherently tie libc to kernel, so if we want to support Debian GNU/kFreeBSD, we might need to add kFreeBSD to the GOOS (but this will duplicate some code). BTW, one of the patch is unnecessary if we support detecting dynamic linker automatically. |
Hi, [Debian tracking bug for this: http://bugs.debian.org/668794] I had a comment from our KFreeBSD porter which is very relevant to this issue: On Mon, Apr 16, 2012 at 00:04, Robert Millan <rmh@d.o> wrote: > Hi Ondřej, > > I notice you disabled the golang testsuite because it hangs on > GNU/kFreeBSD. However, the problem is still present, and chances are > it makes golang unusable on that platform. > > I gave the source a look, and it seems that on GNU/kFreeBSD golang is > playing with thread primitives, bypassing libc. For example it > invokes thr_new() kernel call directly, and also calls sigprocmask() > to reset the signal mask in code that is clearly multithreaded [1]. > > This means that either golang intends to completely replace > libpthread, or it intends to play along with existing libpthread. I'm > not sure which one applies here, but in both cases there is a problem > that needs to be fixed in golang. > > So please don't disable the testsuite. If golang can't be built on > GNU/kFreeBSD, unless you know it's a bug in the system libraries the > problem needs to be fixed in golang. If nobody can spend the time to > fix it here, then you should consider not providing the package for > kfreebsd-*. > > [1] On multithreaded programs, use of sigprocmask() is reserved to > system libraries. > > -- > Robert Millan |
On Mon, Apr 16, 2012 at 00:04, Robert Millan <rmh@d.o> wrote: > I gave the source a look, and it seems that on GNU/kFreeBSD golang is > playing with thread primitives, bypassing libc. For example it Yes. > invokes thr_new() kernel call directly, and also calls sigprocmask() > to reset the signal mask in code that is clearly multithreaded [1]. > > This means that either golang intends to completely replace > libpthread, or it intends to play along with existing libpthread. I'm Yes, when cgo isn't used, the go runtime intentionally bypasses libc and libpthread, as we manage threads and memory ourselves. > not sure which one applies here, but in both cases there is a problem > that needs to be fixed in golang. In a word, we tie libc/kernel combination to the OS, so AFAIK, we don't support GNU/kFreeBSD now. |
I installed a Debian GNU/kFreeBSD 6.0 amd64 (with FreeBSD kernel 8.1.1) on a VM, and tested that with just this patch: http://anonscm.debian.org/gitweb/?p=pkg-google/golang.git;a=blob;f=debian/patches/011-__FreeBSD_kernel__.patch;h=45be34f1229c2ac40875ad3241f1d367d726173f;hb=a90cb12bf263a06fbe2e08978a6010138b672260 CGO_ENABLED=0 could pass all the tests, so at least go can be packaged for GNU/kFreeBSD amd64 (albeit without support for cgo). I'm willing to help do the cgo port, but I must know the answer to this question: should kfreebsd be a new GOOS, or we treat it as variant of FreeBSD and distinguish it from FreeBSD by 'defined(__FreeBSD_kernel__)' only when necessary? (my guess is that, if we don't want to merge the port, the second option is better) |
$ env CGO_ENABLED=1 GOOS=freebsd GOARCH=amd64 go build -tags "sqlite redis memcache cert" -v -o gogs_bsd64
...
# runtime/cgo
/usr/local/Cellar/go/HEAD/libexec/src/runtime/cgo/gcc_freebsd_amd64.c:37:2:
error: implicit declaration of function 'SIGFILLSET' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
/usr/local/Cellar/go/HEAD/libexec/src/runtime/cgo/gcc_freebsd_amd64.c:37:13:
error: variable 'ign' is uninitialized when used here [-Werror,-Wuninitialized]
/usr/local/Cellar/go/HEAD/libexec/src/runtime/cgo/gcc_freebsd_amd64.c:32:14:
note: initialize the variable 'ign' to silence this warning ~ clang --version
Apple LLVM version 6.1.0 (clang-602.0.42) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
~ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.3
BuildVersion: 14D130a |
@denji, this issue is about cgo for GNU/kFreeBSD, and not about cross
compiling for
FreeBSD.
In general, if you want to cross compile with cgo enabled (CGO_ENABLED=1),
you need
to have a cross compiling toolchain. In your case, that means you need a
toolchain on
OS X that build binary for FreeBSD. You can't use OS X's clang to do that.
Please seek help on the golang-nuts mailing list if you have further
questions.
|
Development of Debian GNU/kFreeBSD has been terminated in 2023 after long stagnation, I think this issue should be closed. https://wiki.debian.org/Debian_GNU/kFreeBSD In case of cleanup, in source code this is mentioned only in one file: Line 131 in 82c1434
|
Change https://go.dev/cl/596937 mentions this issue: |
gopherbot
pushed a commit
that referenced
this issue
Jul 22, 2024
The GNU/kFreeBSD project has been canceled. https://wiki.debian.org/Debian_GNU/kFreeBSD For #3533 Change-Id: I30990fced48e1ba43e1e59806379eb97bac3ab6c Reviewed-on: https://go-review.googlesource.com/c/go/+/596937 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: