unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: Jeff Mickey <j@codemac.net>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 0/3] WIP: Go-lang
Date: Thu, 14 Jan 2016 23:40:05 +0200	[thread overview]
Message-ID: <20160114234005.763b9b78@debian-netbook> (raw)
In-Reply-To: <87egdk9dn9.fsf@codemac.net>

[-- Attachment #1: Type: text/plain, Size: 5314 bytes --]

On Thu, 14 Jan 2016 11:14:50 -0800
Jeff Mickey <j@codemac.net> wrote:

> * Ludovic Courtès <ludo@gnu.org> [2016-01-14 07:08]:
> > Efraim Flashner <efraim@flashner.co.il> skribis:
> >  
> >> It seems there's a lot of interest around getting Go packaged in Guix, so I
> >> figured I should post my work so far to the mailinglist. Currently go-1.4
> >> does not have cgo enabled, the go binary keeps on trying to link against
> >> libgcc_s.so.1 (from gcc:lib) and can't find it in the RUNPATH.  
> >
> > In GCC, we have a hack that automatically adds gcc:lib to the RUNPATH
> > (look for “libgcc_s” in gcc.scm.)  I guess we need to do something
> > similar here.  
> 
> Aha - ok, I've had the same problem! I've tried injecting it many ways
> and it doesn't work due to the intersection of libgcc_s and glibc.
> 
> Efraim - can you successfully run programs that link against glibc? As
> in anything that uses os/user, net, etc? Running the tests as part of
> your build is a big way to pick up on this, I've added the following to
> my go-1.4.3 attempts in my build steps:
> 

I haven't ever touched go before, trying to get it packaged was my first time
looking at it so I have no way to check.

I tried looking at Nix's go-1.4 package for inspiration, and I see they have
a lot of sed-magic to remove or modify tests that don't like being sandboxed.
FreeBSD's ports system was also great for a template.
https://svnweb.freebsd.org/ports/head/lang/go14/Makefile?view=markup

https://github.com/NixOS/nixpkgs/blob/788800e437c4a0a25d95e217540bded68804b25e/pkgs/development/compilers/go/1.4.nix

    # Disabling the 'os/http/net' tests (they want files not available in
    # chroot builds)
    rm src/net/{multicast_test.go,parse_test.go,port_test.go}
    # !!! substituteInPlace does not seems to be effective.
    # The os test wants to read files in an existing path. Just don't let it be /usr/bin.
    sed -i 's,/usr/bin,'"`pwd`", src/os/os_test.go
    sed -i 's,/bin/pwd,'"`type -P pwd`", src/os/os_test.go
    # Disable the unix socket test
    sed -i '/TestShutdownUnix/areturn' src/net/net_test.go
    # Disable the hostname test
    sed -i '/TestHostname/areturn' src/os/os_test.go
    # ParseInLocation fails the test
    sed -i '/TestParseInSydney/areturn' src/time/format_test.go
    sed -i 's,/etc/protocols,${iana_etc}/etc/protocols,' src/net/lookup_unix.go
  '' + lib.optionalString stdenv.isLinux ''
    sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go
    # Find the loader dynamically
    LOADER="$(find ${libc}/lib -name ld-linux\* | head -n 1)"
    # Replace references to the loader
    find src/cmd -name asm.c -exec sed -i "s,/lib/ld-linux.*\.so\.[0-9],$LOADER," {} \;
  '' + lib.optionalString stdenv.isDarwin ''
    sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go
    sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go
    sed -i '/TestRead0/areturn' src/os/os_test.go
    sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_test.go
    sed -i '/TestDialDualStackLocalhost/areturn' src/net/dial_test.go
    # remove IP resolving tests, on darwin they can find fe80::1%lo while expecting ::1
    sed -i '/TestResolveIPAddr/areturn' src/net/ipraw_test.go
    sed -i '/TestResolveTCPAddr/areturn' src/net/tcp_test.go
    sed -i '/TestResolveUDPAddr/areturn' src/net/udp_test.go


>                
>  ;; these all have specific file locations they look for
>  ;; or in the case of exec_test resets the environment
>  ;; before executing binaries they expect.
>  (for-each delete-file '("src/net/multicast_test.go"
>                                 "src/net/parse_test.go"
>                                 "src/net/port_test.go"
>                                 "src/os/exec/exec_test.go"))
>  (substitute* "src/os/os_test.go"
>    (("/bin/pwd") (which "pwd"))
>    (("/usr/bin") (dirname (which "pwd")))
>    (("TestHostname") "areturn"))
>  
>  ;; Disable the unix socket test
>  (substitute* "src/net/net_test.go"
>    (("TestShutdownUnix") "areturn"))
>  
>  (substitute* "src/net/lookup_unix.go"
>    (("/etc/protocols") (string-append iana "protocols")))
>  
>  ;; ParseInLocation fails the test
>  (substitute* "src/time/format_test.go"
>    (("TestParseInSydney") "areturn"))
>  
>  (substitute* "src/time/zoneinfo_unix.go"
>    (("/usr/share/zoneinfo/") tz))
>  
>  ;; exec.Command on os.Args[0] from go run for whatever
>  ;; reason doesn't work right now. libgcc_s.so link
>  ;; missing crap occurs here as well, this may require
>  ;; that 6l-wrapper for go run to work.
>  (substitute* "src/syscall/syscall_unix_test.go"
>    (("TestPassFD") "areturn"))
> 
>  (substitute* "src/cmd/6l/asm.c"
>    (("char linuxdynld.*$") (string-append "char linuxdynld[] = \"" ld-linux "\";\n")))
> 
> I'll be trying this later with your packages.
> 
> I'd really hesitate on packaging this without runnning the tests, as
> there are lots of ugly corner cases in go's build system.
> 
>   //  codemac


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-01-14 21:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 16:31 [PATCH 0/3] WIP: Go-lang Efraim Flashner
2016-01-12 16:31 ` [PATCH 1/3] gnu: gccgo: Update to 4.9 Efraim Flashner
2016-01-14 15:09   ` Ludovic Courtès
2016-01-12 16:31 ` [PATCH 2/3] gnu: Add go-1.4 Efraim Flashner
2016-01-14 15:12   ` Ludovic Courtès
2016-01-14 21:12     ` Efraim Flashner
2016-01-15 16:14       ` Ludovic Courtès
2016-01-12 16:31 ` [PATCH 3/3] gnu: Add go-1.5 Efraim Flashner
2016-01-12 20:25   ` Ricardo Wurmus
2016-01-13  9:36     ` Efraim Flashner
2016-01-14 15:13   ` Ludovic Courtès
2016-01-14 15:08 ` [PATCH 0/3] WIP: Go-lang Ludovic Courtès
2016-01-14 19:14   ` Jeff Mickey
2016-01-14 21:40     ` Efraim Flashner [this message]
2016-01-14 21:37   ` Leo Famulari
2016-01-14 21:42   ` Efraim Flashner
2016-01-14 19:17 ` Jeff Mickey
2016-01-14 21:37   ` Efraim Flashner
2016-01-14 22:27     ` Jeff Mickey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160114234005.763b9b78@debian-netbook \
    --to=efraim@flashner.co.il \
    --cc=guix-devel@gnu.org \
    --cc=j@codemac.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).