FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
cmd/dist: support building on debian/kFreeBSD

The debian/kFreeBSD project uses the FreeBSD kernel and the debian
userspace. From our point of view, this is freebsd not linux as GOOS
talks about the kernel syscall interface, not the userspace (although
cgo alters that). As debian/kFreeBSD is experimental at this time, I do
not think it is worth the effort of duplicating all the freebsd specific
code so this is proposal represents a reasonable workaround.

Currently runtime/cgo does not compile, debian/kFreeBSD users should
export CGO_ENABLED=0 to disable cgo.

dfc@debian:~/go/src$ uname -a
GNU/kFreeBSD debian 8.1-1-686 #0 Sat Jul 21 17:02:04 UTC 2012 i686 i386
Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz GNU/kFreeBSD
dfc@debian:~/go/src$ ../bin/go version
go version devel +d05272f402ec Sat Dec 01 15:15:14 2012 -0800

Tested with GOOS=freebsd GOARCH=386

Please review this at https://codereview.appspot.com/6868046/

Affected files:
M src/cmd/dist/unix.c


Index: src/cmd/dist/unix.c
===================================================================
--- a/src/cmd/dist/unix.c
+++ b/src/cmd/dist/unix.c
@@ -670,6 +670,10 @@
gohostos = "linux";
#elif defined(__FreeBSD__)
gohostos = "freebsd";
+#elif defined(__FreeBSD_kernel__)
+ // detect debian/kFreeBSD.
+ //
http://wiki.debian.org/Debian_GNU/kFreeBSD_FAQ#Q._How_do_I_detect_kfreebsd_with_preprocessor_directives_in_a_C_program.3F
+ gohostos = "freebsd";
#elif defined(__OpenBSD__)
gohostos = "openbsd";
#elif defined(__NetBSD__)

Search Discussions

  • Russ Cox at Dec 3, 2012 at 4:41 pm
    LGTM

    if you say so
  • Minux at Dec 3, 2012 at 4:44 pm
    I suggest if we add support for Debian/kFreeBSD in cmd/dist, we'd better
    change all.bash to
    export CGO_ENABLED=0 for it and document that only cgo is not supported for
    Debian/kFreeBSD.

    As an alternative, document that user should export CGO_ENABLED=0 in
    doc/install-source.html,
    but i think this approach is sub-optimal.
  • Devon H. O'Dell at Dec 3, 2012 at 4:53 pm
    They changed something about uname that we can detect from sysctls /
    the command directly to work around the cgo problem. If that will be
    taken care of in a separate CL, then I agree with minux
  • Dave at Dec 3, 2012 at 7:47 pm

    On 2012/12/02 08:16:17, dfc wrote:
    Hello mailto:golang-dev@googlegroups.com,
    I'd like you to review this change to
    https://go.googlecode.com/hg/
    PTAL. Detecting debian/kFreeBSD from uname -s was straight forward so
    I've added the logic into make.bash to disable cgo there.

    https://codereview.appspot.com/6868046/
  • Devon H. O'Dell at Dec 3, 2012 at 7:52 pm
    LGTM
  • Minux at Dec 3, 2012 at 8:03 pm
    Please update description, LGTM.
  • Dave Cheney at Dec 3, 2012 at 8:03 pm
    Done.
    On Tue, Dec 4, 2012 at 6:55 AM, minux wrote:
    Please update description, LGTM.
  • Dave Cheney at Dec 3, 2012 at 9:18 pm
    There is a problem with email replies not landing in rietveld at the
    moment. Could I ask that you visit the CL and LGTM there.

    Cheers

    Dave
    On Tue, Dec 4, 2012 at 7:03 AM, Dave Cheney wrote:
    Done.
    On Tue, Dec 4, 2012 at 6:55 AM, minux wrote:
    Please update description, LGTM.
  • Russ Cox at Dec 3, 2012 at 9:19 pm
    LGTM

    As long as the LGTM is in the groups.google.com/group/golang-dev
    archive I'm happy.
  • Dave at Dec 3, 2012 at 9:27 pm
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=56b8a0a3ca74 ***

    cmd/dist: support building on debian/kFreeBSD

    The debian/kFreeBSD project uses the FreeBSD kernel and the debian
    userspace. From our point of view, this is freebsd not linux as GOOS
    talks about the kernel syscall interface, not the userspace (although
    cgo alters that). As debian/kFreeBSD is experimental at this time, I do
    not think it is worth the effort of duplicating all the freebsd specific
    code so this is proposal represents a reasonable workaround.

    Currently cgo is not supported, make.bash will detect this and disable
    cgo automatically during the build.

    dfc@debian:~/go/src$ uname -a
    GNU/kFreeBSD debian 8.1-1-686 #0 Sat Jul 21 17:02:04 UTC 2012 i686 i386
    Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz GNU/kFreeBSD
    dfc@debian:~/go/src$ ../bin/go version
    go version devel +d05272f402ec Sat Dec 01 15:15:14 2012 -0800

    Tested with GOOS=freebsd GOARCH=386

    R=golang-dev
    CC=golang-dev
    https://codereview.appspot.com/6868046


    https://codereview.appspot.com/6868046/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedDec 2, '12 at 8:16a
activeDec 3, '12 at 9:27p
posts11
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase