From: Maxime Devos <maximedevos@telenet.be>
To: Hartmut Goebel <h.goebel@crazy-compilers.com>, guix-devel@gnu.org
Cc: Martin Becze <mjbecze@riseup.net>
Subject: Compiling rust things without cargo (super WIP POC)
Date: Thu, 31 Mar 2022 22:06:10 +0200 [thread overview]
Message-ID: <36c1a8dcb363f8780b45156058ea606d0dd50854.camel@telenet.be> (raw)
In-Reply-To: <af3b58b5-deaa-01f4-117f-3db0418393c5@crazy-compilers.com>
[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]
Hartmut Goebel schreef op do 31-03-2022 om 21:47 [+0200]:
since rust does not support anything like static or dynamic libraries,
building (intermediate) crates is useless like a hole in my head. Any
output on any intermediate crate will just be thrown away.
In my experiments, it looks like the rust compiler actually _does_
support static libraries, though perhaps cargo doesn't.
I invite you to take a look at <https://notabug.org/maximed/cargoless-rust-experiments>.
It contains a minimal rust library (libhello) and a minimal 'hello
world'-style application that uses 'libhello'.
To simulate how Guix compiles C software (but here applied to Rust),
the Makefile does the following:
* Run 'rustc --crate-type=lib libhello/hello.rs -o out/libhello/lib/libhello.rlib',
to compile the library and install it in 'out/libhello/lib/libhello.rlib'
(cf. /gnu/store/...-libhello.../lib/hello.so).
* Run 'rustc -Lout/libhello/lib hello-app/main.rs -o out/hello-oxygen/bin/hello'
to compile the application. By default, rustc will fail because it cannot find
the library. However, if -Lout/libhello/lib is passed, then it does find it!
(cf. LIBRARY_PATH=/gnu/store/.../lib & gcc -L/gnu/store/.../lib)
This is a rather basic example (no transitive dependencies, no test dependencies,
no macros ...), but it seems like there are some possibilities here ...
As a next step, maybe I could try writing a Guix package definition for libhello
and hello-oxygen, gradually making things more complicated (macros, transitive
dependencies, some non-toy Rust dependencies, a Guix build system ...)?
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next prev parent reply other threads:[~2022-03-31 20:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 11:55 Removing #:skip-build? from the crate importer? Maxime Devos
2022-03-31 19:47 ` Hartmut Goebel
2022-03-31 20:06 ` Maxime Devos [this message]
2022-04-01 6:58 ` Compiling rust things without cargo (super WIP POC) Brendan Tildesley
2022-04-01 9:10 ` Ludovic Courtès
2022-04-01 10:05 ` Maxime Devos
2022-04-01 10:08 ` Maxime Devos
2022-04-02 15:01 ` Hartmut Goebel
2022-04-02 9:29 ` Maxime Devos
2022-04-05 12:08 ` Ludovic Courtès
2022-04-02 15:18 ` Building hexyl (a rust app) without cargo, with antioxidant-build-system Maxime Devos
2022-04-05 16:10 ` Maxime Devos
2022-04-06 15:49 ` Hartmut Goebel
2022-04-06 16:06 ` Maxime Devos
2022-05-30 8:23 ` Efraim Flashner
2022-05-30 13:37 ` raingloom
2022-05-30 15:15 ` Maxime Devos
2022-04-02 15:19 ` Compiling rust things without cargo (super WIP POC) Hartmut Goebel
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36c1a8dcb363f8780b45156058ea606d0dd50854.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=guix-devel@gnu.org \
--cc=h.goebel@crazy-compilers.com \
--cc=mjbecze@riseup.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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.