News for hackers. Stuff that matters.
Re:Rust 1.24 by MrBuddyCasino on Thursday February 15, 2018 @04:03PM (#16387604)
> Compiles to a relatively standalone binary (not as good as Go though)

Whats the difference?

Re:Rust 1.24 by steveklabnik on Thursday February 15, 2018 @04:05PM (#16387620)
We use glibc by default, so while Rust statically links all Rust code by default, that's still dynamically linked. You can use MUSL to remove that, where appropriate, but it's not the deafult.
Re:Rust 1.24 by burntsushi on Thursday February 15, 2018 @05:02PM (#16388159)
To add an additional clarification here for others (I know Steve knows this :P), by default, at least on Linux, whether Go produces a dynamic executable or not depends on which things you import. For example, a simple hello world program will produce a static executable:

    $ cat main.go
    package main
    
    import "fmt"
    
    func main() {
            fmt.Println("Hello, world!")
    }
    $ go build
    $ ldd scratch
            not a dynamic executable
But anything using the network, like a simple HTTP server, will cause the Go tool to build a dynamic executable:

    $ cat main.go
    package main
    
    import (
            "log"
            "net/http"
    )
    
    func main() {
            // Simple static webserver:
            log.Fatal(http.ListenAndServe(":8080", http.FileServer(http.Dir("/usr/share/doc"))))
    }
    $ go build
    $ ldd scratch
            linux-vdso.so.1 (0x00007fff161f0000)
            libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f796b0e8000)
            libc.so.6 => /usr/lib/libc.so.6 (0x00007f796ad31000)
            /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f796b306000)

Now of course, you can set flags to force Go to always produce a static executable, but the difference here isn't too much different with Rust. With Rust, you do need to install MUSL, add the target and then rebuild with an extra flag, but it's all very simple.

(To be clear, I am not criticizing Go here! There are good reasons why they link to libc by default when network stuff comes into the picture.)

Re:Rust 1.24 by jhasse on Thursday February 15, 2018 @05:07PM (#16388196)
What's the problem with that? Do you use any of glibc's private API?
Re:Rust 1.24 by steveklabnik on Thursday February 15, 2018 @05:13PM (#16388248)
The problem is that you have to think about it at all. If you compile on a machine with a new libc, and then try to run it on a machine with an old libc, it won't work. So you end up doing what most people do, even outside of Rust, which is take the oldest CentOS box you can stand and do builds on that.
Re:Rust 1.24 by jhasse on Friday February 16, 2018 @03:20AM (#16390768)
The Autopackage project had a solution for this problem years ago called apbuild. It would search for the versions of glibc symbols and use the oldest possible ones, which resulted in portable binaries. With some quick googling I found the code here: https://github.com/DeaDBeeF-Player/deadbeef-plugin-builder/t... Probably doesn't work anymore though :/

It's a bit sad that this is still unsolved, probably due to the GNU people's hatred for closed-source distribution.

Re:Rust 1.24 by IshKebab on Friday February 16, 2018 @12:20PM (#16393891)
It's the GNU way:

1. Refuse to do something properly because it will make it too easy... or something.

2. Wait until someone else gets fed up enough and makes a better version.

3. Fade into irrelevance.

See: GCC/Clang, glibc/musl, Bash/??? (someone please make something sane)

Re:Rust 1.24 by jhasse on Friday February 16, 2018 @12:26PM (#16393945)