From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: [PATCH 0/3] WIP: Go-lang Date: Thu, 14 Jan 2016 23:40:05 +0200 Message-ID: <20160114234005.763b9b78@debian-netbook> References: <1452616298-6255-1-git-send-email-efraim@flashner.co.il> <87y4bsp5a2.fsf@gnu.org> <87egdk9dn9.fsf@codemac.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/hhyt5Nls441Bu3mXk83jr0x"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJpfa-0005kn-UV for guix-devel@gnu.org; Thu, 14 Jan 2016 16:43:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJpfY-0005N3-TS for guix-devel@gnu.org; Thu, 14 Jan 2016 16:43:02 -0500 In-Reply-To: <87egdk9dn9.fsf@codemac.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Jeff Mickey Cc: guix-devel@gnu.org --Sig_/hhyt5Nls441Bu3mXk83jr0x Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 14 Jan 2016 11:14:50 -0800 Jeff Mickey wrote: > * Ludovic Court=C3=A8s [2016-01-14 07:08]: > > Efraim Flashner skribis: > > =20 > >> 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 again= st > >> libgcc_s.so.1 (from gcc:lib) and can't find it in the RUNPATH. =20 > > > > In GCC, we have a hack that automatically adds gcc:lib to the RUNPATH > > (look for =E2=80=9Clibgcc_s=E2=80=9D in gcc.scm.) I guess we need to d= o something > > similar here. =20 >=20 > 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. >=20 > 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: >=20 I haven't ever touched go before, trying to get it packaged was my first ti= me 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 sandboxe= d. FreeBSD's ports system was also great for a template. https://svnweb.freebsd.org/ports/head/lang/go14/Makefile?view=3Dmarkup https://github.com/NixOS/nixpkgs/blob/788800e437c4a0a25d95e217540bded68804b= 25e/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 i= t 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_uni= x.go '' + lib.optionalString stdenv.isLinux '' sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zon= einfo_unix.go # Find the loader dynamically LOADER=3D"$(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],$LO= ADER," {} \; '' + 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 e= xpecting ::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 > =20 > ;; 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")) > =20 > ;; Disable the unix socket test > (substitute* "src/net/net_test.go" > (("TestShutdownUnix") "areturn")) > =20 > (substitute* "src/net/lookup_unix.go" > (("/etc/protocols") (string-append iana "protocols"))) > =20 > ;; ParseInLocation fails the test > (substitute* "src/time/format_test.go" > (("TestParseInSydney") "areturn")) > =20 > (substitute* "src/time/zoneinfo_unix.go" > (("/usr/share/zoneinfo/") tz)) > =20 > ;; 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")) >=20 > (substitute* "src/cmd/6l/asm.c" > (("char linuxdynld.*$") (string-append "char linuxdynld[] =3D \"" ld-l= inux "\";\n"))) >=20 > I'll be trying this later with your packages. >=20 > I'd really hesitate on packaging this without runnning the tests, as > there are lots of ugly corner cases in go's build system. >=20 > // codemac --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --Sig_/hhyt5Nls441Bu3mXk83jr0x Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJWmBW1AAoJEPTB05F+rO6T/VsP+wTtCuB52iWJceqDORpc+KxK Rs2LEtLnt03rOWaZY5X/ZerWoRZubQ/OcNaGoXBuNf4tDghcZdoY/lkRV563r+h0 TIUVm75ps+bgxJlMIhPm1Zlsybxo2hzAyqZ2iEFE7Wetqord7jKl7D+HCxEsx4YG +s/XkJ5+JzhTC9Pfg0V6536673U9Htc2ZEXSPggAbv5Qye79F+BEzOAXWkKfVWmD qJeHo7mhHmStqPMdEBw9aDh/exKwrUtpdSgvhW8COeXatRZHq+OS5dnaZJJZtk80 67225fI405jo/PmLxXpNRl8FYcG8lT/A4FrBjhdu/sbE+EHnHg3q8XAUSFEZjd36 Cspteel3UreQFyyxPZgJ6uv94WJgFd2JaM1bK2rwx8wkBkaUitG563HzgGv/imK+ +q/sMT9l3pF5NE8q0JXE96zaRKqUdhgiM/56IaMQj18/5MNJTue2OHDIi0qkPoyC 2n9w6A99zEHhHo+OwF4O8t5B09r5nR2ckflIG2uV3uPXISlqRORVrUEYVlPHnF4K CaPCRnCiA3ViJoe+C2EqDX3TF0TAZ+swEzuZFgFHCEqkw+qp/HqOcBoA08XrCBRb l0M5zJ5DWOroMuWIbXlcaMOHlDwL2QnpyUx5x6DGdiTwE9LDqHWEEm2zHknAZvYu dwKCtw5HRQCoD1hlDQGm =f5Fp -----END PGP SIGNATURE----- --Sig_/hhyt5Nls441Bu3mXk83jr0x--