Re: Compiling rust things without cargo (super WIP POC)

2022-04-05 Thread Ludovic Courtès
Maxime Devos  skribis:

> Maxime Devos schreef op do 31-03-2022 om 22:06 [+0200]:
>> 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
>> ...)?
>
> Update: it can now build rust-cfg-if, libhello and rust-hello with
> Guix!

Woohoo, keep up the good work!  :-)

Ludo’.



Re: Compiling rust things without cargo (super WIP POC)

2022-04-02 Thread Hartmut Goebel

Am 31.03.22 um 22:06 schrieb Maxime Devos:

In my experiments, it looks like the rust compiler actually_does_
support static libraries, though perhaps cargo doesn't.


AFAIU this assumption is correct.



I invite you to take a look 
at.
It contains a minimal rust library (libhello) and a minimal 'hello
world'-style application that uses 'libhello'.

Impressive!

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 ...)?


Here is my challenge :-) 
: 
different dependencies per feature, os, target-arch and target-os as 
well as passing on features to dependencies.


--
Regards
Hartmut Goebel

| Hartmut Goebel  | h.goe...@crazy-compilers.com   |
| www.crazy-compilers.com | compilers which you thought are impossible |




Re: Compiling rust things without cargo (super WIP POC)

2022-04-02 Thread Hartmut Goebel

Am 01.04.22 um 12:08 schrieb Maxime Devos:

Do you know a ‘real’ Rust applications with few transitive dependencies
(say, 3 or so) with preferably few rust source files?


For my tests I used „roxmltree“, and by searching I just discovered 
https://crates.io/crates/hello_exercism.


HTH

--
Regards
Hartmut Goebel

| Hartmut Goebel  | h.goe...@crazy-compilers.com   |
| www.crazy-compilers.com | compilers which you thought are impossible |




Re: Compiling rust things without cargo (super WIP POC)

2022-04-02 Thread Maxime Devos
Maxime Devos schreef op do 31-03-2022 om 22:06 [+0200]:
> 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
> ...)?

Update: it can now build rust-cfg-if, libhello and rust-hello with
Guix!

Greetings,
Maxime.


signature.asc
Description: This is a digitally signed message part


Re: Compiling rust things without cargo (super WIP POC)

2022-04-01 Thread Maxime Devos
Ludovic Courtès schreef op vr 01-04-2022 om 11:10 [+0200]:
> I guess the whole question is whether that technique can be made to work
> for the vast majority of Rust packages.  I’d suggest working in that
> direction: writing a build system as a first step, using it in all the
> Rust packages, and analyzing the kinds of problems encountered, with the
> goal of estimating the effort it would take to make it work for every
> single package.  Easier said than done, I guess.

Do you know a ‘real’ Rust applications with few transitive dependencies
(say, 3 or so) with preferably few rust source files?  That would be a
practical target for the ad-hoc Makefile and eventually, the new
antioxidant-build-system.

Greetings,
Maxime.


signature.asc
Description: This is a digitally signed message part


Re: Compiling rust things without cargo (super WIP POC)

2022-04-01 Thread Maxime Devos
Ludovic Courtès schreef op vr 01-04-2022 om 11:10 [+0200]:
> Overall, I’m afraid Rust packaging is getting out of hands and we’re all
> looking elsewhere.  For example, that Rust packages live in their own
> separate world means there’s no tooling available, leading to poor QA, a
> proliferation of versions of the same packages that never get removed,
> and so on.  I think addressing that, for instance with something as I
> proposed in , should be high
> priority.

I think I'll look into the cycle issue, maybe cargo.toml can be
modified to not use rust-cfg-il and maybe the solution, if any, could
be used for other cycles.

Greetings,
Maxime.


signature.asc
Description: This is a digitally signed message part


Re: Compiling rust things without cargo (super WIP POC)

2022-04-01 Thread Ludovic Courtès
Hi,

Maxime Devos  skribis:

> I invite you to take a look at 
> .
> 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 ...

Interesting.

> 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 ...)?

I guess the whole question is whether that technique can be made to work
for the vast majority of Rust packages.  I’d suggest working in that
direction: writing a build system as a first step, using it in all the
Rust packages, and analyzing the kinds of problems encountered, with the
goal of estimating the effort it would take to make it work for every
single package.  Easier said than done, I guess.

Overall, I’m afraid Rust packaging is getting out of hands and we’re all
looking elsewhere.  For example, that Rust packages live in their own
separate world means there’s no tooling available, leading to poor QA, a
proliferation of versions of the same packages that never get removed,
and so on.  I think addressing that, for instance with something as I
proposed in , should be high
priority.

Thoughts?

Ludo’.



Re: Compiling rust things without cargo (super WIP POC)

2022-04-01 Thread Brendan Tildesley

Recently I did the bevy (game engine) hello world tutorial[1].
To facilitate less slow iteration time when developing, it supports 
dynamic linking,
disabling some optimizations, and using the lld linker for fast linking, 
although using lld failed for me.


When running cargo build, only your project is recompiled quickly and 
linked.


I was wondering how this dynamic linking might be facilitated in Guix?


Note: I had to update cargo to 0.60 to compile bevy with edition2021

[1] https://bevyengine.org/learn/book/getting-started/