From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Rust Date: Sat, 30 Jul 2016 15:44:53 +0200 Message-ID: <87ziozb5pm.fsf@gnu.org> References: <20160325184540.4e02cb2d@scratchpost.org> <87k2kq6wma.fsf@grrlz.net> <87oa8mt8lh.fsf@gmail.com> <87eg9gzgqb.fsf@libertad.pw> <87popyp3od.fsf@we.make.ritual.n0.is> <20160728203144.7df4bb8c@itchy> <87mvl0a302.fsf_-_@gnu.org> <20160730130103.3859e4ed@itchy> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTUZb-0006o4-9m for guix-devel@gnu.org; Sat, 30 Jul 2016 09:45:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTUZW-0000fY-Af for guix-devel@gnu.org; Sat, 30 Jul 2016 09:45:03 -0400 In-Reply-To: <20160730130103.3859e4ed@itchy> (Eric Le Bihan's message of "Sat, 30 Jul 2016 13:01:03 +0200") 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" To: Eric Le Bihan Cc: guix-devel@gnu.org Eric Le Bihan skribis: > Le Fri, 29 Jul 2016 17:16:29 +0200, > ludo@gnu.org (Ludovic Court=C3=A8s) a =C3=A9crit : [...] >> > Some questions, though: >> > >> > 1. I can compile a sample program in a guix environment created >> > using `guix environment gcc glibc binutils rust`, but the program >> > generated fails to run because libgcc_s.so.1 can not be found. How >> > can it be added to the environment?=20=20 >>=20 >> As Andreas notes, =E2=80=98gcc-toolchain=E2=80=99, which includes =E2=80= =98ld-wrapper=E2=80=99, should >> fix this. > > Yes. It solved my problem. >=20=20 >> Does Rust use GCC, or just ld? > > It only uses the linker, i.e. ld on GNU/Linux. Then it should be enough to add =E2=80=98ld-wrapper=E2=80=99 to the inputs = (no need for =E2=80=98gcc-toolchain=E2=80=99 or =E2=80=98gcc=E2=80=99.) Just make sure = Rust captures the absolute file name of =E2=80=98ld=E2=80=99. > IIUC, to provide a Guix package for Cargo, the following should be done: > > 1. write a crate importer. > 2. list all the crates needed by Cargo to build itself. > 3. package each crate with the importer. > 4. add a Cargo package which depends on the newly-imported crates and > uses a binary version of Cargo to bootstrap itself (though this is not > the best option in terms of auditing/reproducibility). > > Unlike Rust, Cargo still uses an "anonymous" binary version of itself > for bootstrapping. I hope this may change soon. Something along these lines, yes. We may also need a =E2=80=98rust-build-system=E2=80=99, like we did for other languages: https://www.gnu.org/software/guix/manual/html_node/Build-Systems.html If that build system works without invoking Cargo, then we probably don=E2=80=99t need a Cargo binary to build Cargo. Anyway, we=E2=80=99re not there yet. :-) >> > + (add-before 'build 'pre-build >> > + (lambda _ >> > + (let* ((bindir (string-append (getcwd) >> > "/bin")) >> > + (cc (string-append bindir "/cc"))) >> > + (mkdir bindir) >> > + (call-with-output-file cc >> > + (lambda (port) >> > + (format port >> > + "#!~a\n\nexec gcc >> > \"$@\"\n" (which "sh")))) >> > + (chmod cc #o755))))=20=20 >>=20 >> Can we avoid this trick using a configure flag >> (--with-compiler=3D/path/to/gcc) or a configure or environment variable >> (CC=3Dgcc)? If not, that=E2=80=99s fine. > > To build the Rust standard library, only the linker is needed. The > default value is "cc". I thought this could be overridden using the > "--default-linker=3D" of the ./configure script, but it looks like it is > not properly handled. Hence the need for the wrapper.=20 OK, makes sense. Please leave this explanation as a comment in the code. >> > + #:tests? #f))=20=20 >>=20 >> We normally run test suites, unless we have a good reason not to do >> so. :-) Any ideas why =E2=80=9Cmake check=E2=80=9D fails? > > Out of laziness, I skipped the tests. I'll give it a look. Let us know how it goes, even if the outcome is =E2=80=9Ctoo painful, giving up=E2=80=9D. :-) Thanks, Ludo=E2=80=99.