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

Initial development of working code #1

Merged
merged 2 commits into from
Sep 7, 2016
Merged

Conversation

nastevens
Copy link
Member

This is working well on Dizzy + armv7. I'm planning to run some builds against other versions, but for now I wanted to get this out for review.

@posborne @tmanley

@nastevens
Copy link
Member Author

Oops, sorry @tmanley! This was supposed to go to @tpmanley.

* x86 (32 and 64-bit), ARM (32 and 64-bit) build systems.
* All Linux architectures that Rust itself supports (Multiple flavors of:
x86, ARM, PPC, and MIPS)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, what shared libraries if any get installed? Do we use a shared libstd?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No shared libraries are installed by default, including libstd, since all Rust dependencies are statically linked by default in Cargo. There's an option, -C prefer-dynamic, that could be added to the Cargo config file and would allow a dynamically linked executable. That could definitely be useful, so I'm adding dynamic linking as a future enhancement. I also clarified the README to make it explicit what the current linking state is: 2d5e033

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other question that this raised for me was making sure that all system libraries needed by libstd were getting installed.

Here's a dump of objdump -x gpio | grep NEEDED:

  NEEDED               libdl.so.2
  NEEDED               librt.so.1
  NEEDED               libpthread.so.0
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  NEEDED               ld-linux-armhf.so.3
  NEEDED               libm.so.6

This matches well with what I would expect from the Rust book linking section.

Yocto adds a C compiler and libc to the DEPENDS of a package by default through an undocumented variable BASEDEPENDS (so long as INHIBIT_DEFAULT_DEPS isn't specified). On my system BASEDEPENDS is

BASEDEPENDS="virtual/arm-poky-linux-gnueabi-gcc virtual/arm-poky-linux-gnueabi-compilerlibs virtual/libc"

so it looks like we should get everything we need so long as we don't specify INHIBIT_DEFAULT_DEPS.

I'd say this isn't completely air-tight, since the BASEDEPENDS could be something else in other systems. But for now I'm happy running with what we've got and fixing bugs if they crop up.

@posborne
Copy link
Member

posborne commented Sep 6, 2016

Great Stuff! Once we merge this, I think we'll want to bring this up with meta-rust to discuss further. There are useful recipes there that capture dependencies on system items that should live somewhere and which I believe can be shared.

Meta-rust is the right approach at some levels (building from source) but I trust this approach much more, at least at present.

@posborne
Copy link
Member

posborne commented Sep 6, 2016

👍 (not sure if homu makes sense on this project as we are unlikely to be able to use CI in the same way as other projects because Yocto). If we do, r=me.

def rust_target(d, spec_type):
'''
Convert BitBake system specs into Rust target.
`spec_type` is on of BUILD, TARGET, or HOST
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/on/one/

@nastevens
Copy link
Member Author

Once we merge this, I think we'll want to bring this up with meta-rust to discuss further.

My thoughts exactly. I would even be willing to transfer this repo under the meta-rust org if they would like. I see this repo as complimentary to meta-rust - they are doing the heavy lifting of getting the Rust build system amenable to Yocto builds, and that is obviously a big task. I see meta-rust-bin as an option for people who need to run the latest stable Rust today. Eventually, hopefully, meta-rust-bin becomes moot because meta-rust "just works". Until then, there's the meta-rust-bin stopgap.

@nastevens
Copy link
Member Author

nastevens commented Sep 7, 2016

(not sure if homu makes sense on this project as we are unlikely to be able to use CI in the same way as other projects because Yocto)

I know Travis supports Docker builds, so there's potential there, but that seems better as a future enhancement.

Edit: opened #3

As of now, meta-rust-bin only supports a statically-linked libstd and
dynamically-linked {libc, libm, etc}. Update the README to make this
clear and also add future enhancements to support a dynamically-linked
libstd or full static linking with MUSL.

Signed-off-by: Nick Stevens <[email protected]>
@nastevens nastevens merged commit 7ff5dba into master Sep 7, 2016
@nastevens nastevens deleted the initial-development branch September 7, 2016 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants