Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document static linking with musl #27193

Merged
merged 5 commits into from Jul 24, 2015
Merged

Conversation

@aidanhs
Copy link
Member

aidanhs commented Jul 21, 2015

Continuation of #25685.

@rust-highfive
Copy link
Collaborator

rust-highfive commented Jul 21, 2015

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)


# Link args

There is one other way to tell rustc how to customize linking, and that is via

This comment has been minimized.

Copy link
@steveklabnik

steveklabnik Jul 21, 2015

Member

rustc should be in graves

(e.g. `libc` and `libm`) usually dynamically linked, but it is possible to
change this and statically link them as well.

Linking is a very platform dependant topic - on some platforms, static linking

This comment has been minimized.

Copy link
@steveklabnik

steveklabnik Jul 21, 2015

Member

this should be an em dash rather than a hypen


## Linux

By default, all Rust programs on Linux will link to the system libc along with

This comment has been minimized.

Copy link
@steveklabnik

steveklabnik Jul 21, 2015

Member

libc should be in graves

## Linux

By default, all Rust programs on Linux will link to the system libc along with
a number of other libraries. Let's look at an example on a 64-bit linux machine

This comment has been minimized.

Copy link
@steveklabnik

By default, all Rust programs on Linux will link to the system libc along with
a number of other libraries. Let's look at an example on a 64-bit linux machine
with GCC and glibc (by far the most common libc on Linux):

This comment has been minimized.

Copy link
@steveklabnik

steveklabnik Jul 21, 2015

Member

glibc and libc in graves

```

Dynamic linking on Linux can be undesirable if you wish to use new library
features on old systems or target systems which simply do not have the required

This comment has been minimized.

Copy link
@steveklabnik

steveklabnik Jul 21, 2015

Member

s/simply//

features on old systems or target systems which simply do not have the required
dependencies for your program to run.

Static linking supported via an alternative libc, musl - this must be enabled

This comment has been minimized.

Copy link
@steveklabnik

steveklabnik Jul 21, 2015

Member

libc and musl in graves

dependencies for your program to run.

Static linking supported via an alternative libc, musl - this must be enabled
at rust compile-time with some prerequisites available. You can compile your

This comment has been minimized.

Copy link
@steveklabnik

Static linking supported via an alternative libc, musl - this must be enabled
at rust compile-time with some prerequisites available. You can compile your
own version of rust with musl enabled and install it into a custom directory

This comment has been minimized.

Copy link
@steveklabnik

steveklabnik Jul 21, 2015

Member

Rust, musl in graves

12K musldist/bin/rustc
```

You now have a build of a musl-enabled rust! Because we've installed it to a

This comment has been minimized.

Copy link
@steveklabnik

steveklabnik Jul 21, 2015

Member

same here

@steveklabnik
Copy link
Member

steveklabnik commented Jul 21, 2015

I have a bunch of nitpicks, but thanks so much for writing this up!

@aidanhs aidanhs force-pushed the aidanhs:aphs-advanced-linking-doc branch from 4068d72 to 844d81a Jul 21, 2015
@aidanhs
Copy link
Member Author

aidanhs commented Jul 21, 2015

Think I got them all.

(e.g. `libc` and `libm`) usually dynamically linked, but it is possible to
change this and statically link them as well.

Linking is a very platform dependant topic — on some platforms, static linking

This comment has been minimized.

Copy link
@eefriedman

eefriedman Jul 21, 2015

Contributor

*dependent

@aidanhs aidanhs force-pushed the aidanhs:aphs-advanced-linking-doc branch from 844d81a to 231438a Jul 21, 2015
@alexcrichton
Copy link
Member

alexcrichton commented Jul 21, 2015

@bors: r+ 231438a rollup

Nice!

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 21, 2015
your own version of Rust with `musl` enabled and install it into a custom
directory with the instructions below:

```

This comment has been minimized.

Copy link
@apasel422

apasel422 Jul 22, 2015

Contributor

This code block needs to be annotated so that it isn't compiled as Rust code. CC #27206.

custom prefix we need to make sure our system can the binaries and appropriate
libraries when we try and run it:

```

This comment has been minimized.

Copy link
@apasel422

apasel422 Jul 22, 2015

Contributor

This one too.


Let's try it out!

```

This comment has been minimized.

Copy link
@apasel422

apasel422 Jul 22, 2015

Contributor

This one too.

@steveklabnik
Copy link
Member

steveklabnik commented Jul 22, 2015

@bors: r-

@steveklabnik
Copy link
Member

steveklabnik commented Jul 22, 2015

minusing this one until we fix the issues, we'll get it in soon!

@aidanhs aidanhs force-pushed the aidanhs:aphs-advanced-linking-doc branch from 231438a to b6a0d9e Jul 22, 2015
@aidanhs
Copy link
Member Author

aidanhs commented Jul 22, 2015

Added 'text' to code blocks.

@steveklabnik
Copy link
Member

steveklabnik commented Jul 22, 2015

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jul 22, 2015

📌 Commit b6a0d9e has been approved by steveklabnik

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 23, 2015
bors added a commit that referenced this pull request Jul 23, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Jul 24, 2015
bors added a commit that referenced this pull request Jul 24, 2015
- Successful merges: #27137, #27145, #27177, #27193, #27212, #27220, #27229, #27235, #27238, #27244, #27251
- Failed merges:
@bors bors merged commit b6a0d9e into rust-lang:master Jul 24, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@aidanhs
Copy link
Member Author

aidanhs commented Jul 25, 2015

Hooray! Thanks all for the help with this.

@aidanhs aidanhs deleted the aidanhs:aphs-advanced-linking-doc branch Jul 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.