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

Determine how to package native shims #14821

Closed
nguerrera opened this issue Jul 10, 2015 · 14 comments
Closed

Determine how to package native shims #14821

nguerrera opened this issue Jul 10, 2015 · 14 comments
Assignees
Labels
enhancement Product code improvement that does NOT require public API changes/additions packaging Related to packaging
Milestone

Comments

@nguerrera
Copy link
Contributor

For issue #14752, we'll be creating native libraries that need to be compiled for each unix flavor we support. We need to figure out how these are distributed (e.g. alongside corefx nuget packages? with the runtime? etc.)

@ghost
Copy link

ghost commented Aug 28, 2015

Looking at this project: https://www.nuget.org/profiles/MonoGame, IMO it will be better to package System.IO.Native packaged for each platform separately as:

  • System.IO.Native.FreeBSD
  • System.IO.Native.Linux
  • System.IO.Native.OSX
  • System.IO.Native.Windows

This will keep the package size minimal with no extra/unrelated platform binaries bundled together (like some NuGet packages are bundling Mono targets when installing on Windows).

If the conditional (platform-based) dependency is not possible in NuGet/MyGet infrastructure, then bundling them as one System.IO.Native is the only option I imagine.

In either case, CI build artifacts can be leveraged to build all the combinations of binary without hassling the release team to arrange VMs for all the (growing) OS set. On this note, it would be really cool to use GitHub tags with semver and set the CI to trigger the release assets build binaries with current master, only when new tags are pushed right after the "last commit which should go in the vNext release".

@weshaggard
Copy link
Member

Temporarily I've added these shim assemblies to our runtime package (Microsoft.NETCore.Runtime.CoreCLR) until we figure out the exact packaging strategy.

@joshfree joshfree assigned ericstj and unassigned nguerrera Nov 6, 2015
@ericstj
Copy link
Member

ericstj commented Nov 12, 2015

We were actually planning to package as follows,

  • Each native shim will have its own "identity" package.
  • Each native shim implementation will be a runtime specific implementation of the identity package.
System.Native
runtime.centos.7.1-x64.System.Native
runtime.osx.10.10-x64.System.Native
runtime.ubuntu.14.04-x64.System.Native
  • Each package that depends on the shim will reference the identity package from its implementation package which depends on it. Alone this will hit the nuget bug where runtime.jsons are ignored if not in the compile graph. To avoid that we must make sure that all shim runtime.jsons are merged into the lineup.
  • Note placing this information in the lineup is required universally since we can never garuntee that the package which requires platform-specific implementation is in the compile graph. Eventually this should get better with: Nuget needs to support dependencies specific to target runtime NuGet/Home#1660

@ericstj ericstj assigned chcosta and unassigned ericstj Nov 12, 2015
@davidfowl
Copy link
Member

We have to move away from individual packages and towards the lineup file for these types of packages.

@ericstj
Copy link
Member

ericstj commented Nov 12, 2015

Thank you for agreeing with the proposal @davidfowl

@davidfowl
Copy link
Member

@ericstj Yep. I don't want rely on this NuGet/Home#1660 for these specific packages even when it becomes available 😄

@ericstj
Copy link
Member

ericstj commented Nov 12, 2015

Yeah, we won't rely on it that feature. Just wanted to point out why it's required. For the .NET framework we have the nice benefit of always being able to put that lineup in the compile graph. For regular 3rd party devs they cannot so they need NuGet/Home#1660.

@mellinoe
Copy link
Contributor

What is "the lineup"? I don't think a lot of people are familiar with some of this new jargon, so it's a bit hard to understand the discussion 😄 .

And just to clarify/discuss: since a lot of different assemblies are dependent on System.Native, does this mean that once we release a stable version, we have to maintain that ABI forever? Otherwise you will be required to choose various versions of libraries that are all compatible with the version of the shim you use (or rather, all libraries must depend on the same version of the shim). Lots of libraries depend on System.Native, and I'm pretty sure we've made at least a few binary breaking changes so far. Just trying to figure out our thoughts on this, I didn't see it written down anywhere yet.

@nguerrera
Copy link
Contributor Author

I do think we'll have to keep the ABI stable post-RTM, but I think this is less burdensome than with public managed API. We don't care about the aesthetics of the API as they are implementation details and we can always define Foo2(), etc. If absolutely necessary, we can also rename the .so and package and allow different, incompatible versions to live SxS.

@ericstj
Copy link
Member

ericstj commented Nov 12, 2015

Lineup is a central representation of all the RID-specific associations of our packages. Each package represents its RID-specific implementation locally in our build system, but that all gets merged into a central runtime.json: the lineup.

@ghost
Copy link

ghost commented Nov 12, 2015

Why would we want to have CentOS, Ubuntu, Fedora, segregation? I mean if you build something on CentOS5 (5.11 is currently officially supported in 5x branch for example), it will definitely run on 95+% of linux running on servers and probably 99% of clients (only if someone is still running very old linux with libc version older than the one packed with CentOS, then it wont work).

What is the deal with CentOS "5"?

Large amount of web hosting server till date are running CentOS 5, but that is not the real answer. I have experienced it and it is a proven fact from many C library folks including node.js guys, that binary built on CentOS5 is qualified as "ultimate cross linux distribution compatible".

To simplify your build system and save time, I would highly recommend a Docker recipe setup (which i can provide if you are interested as I have done it more than once). Only <package-manager> install docker once and then docker run <machine-name> whenever you want and that will magically produce both x86 and x64 compatible binaries in a zip file without any further hassle. With some extra work in future, we can incorporate ARM (and maybe good old MIPS) cross-compilation too. :)

In case of BSD though, we will have to target each kind of BSD separately: Free, Net, DragonFly yada yada (but BSD community can always wait and they are very cool about it 😄).

@eerhardt
Copy link
Member

Why would we want to have CentOS, Ubuntu, Fedora, segregation?

Because this issue isn't about just 'libc', it is about the set of native libraries that we are using: libc, libcurl, openSSL, zlib.

For example, the version of libcurl used on our CentOS CI servers is v7.29, but on Ubuntu is v7.35, and we can have differing code based on which version we are compiling against.

@ghost
Copy link

ghost commented Nov 12, 2015

One approach could be to bundle the dependent bins or compile them statically, so ldd native.so will only report libc and libc++ at the cost of gain in output binary size.
The other approach could be to branch and adapt to the change at runtime. I believe there are not many varied code paths which violate reasonable divergence bar.

To recap, it boils down to three choices (maybe there are more?):

  1. runtime branching.
  2. fat binary due to static compilation.
  3. compile on every linux distribution (and possibly every version of those distros where the OOTB libs are different).

The third one is most cumbersome, <number of supported distros> x <number of their respective supported versions>-times the effort of building + nuget packaging and limits the ability to cover large scale with less effort.

One strong point about the third one is that for distributions which are very different (like Apline Linux, which doesn't even uses libc but microlibC OR other kinds of libc's which target RISC and their consumer distros), the drastic code variation will not impact the general, more commonly used, distributions.

chcosta referenced this issue in dotnet-bot/corefx Dec 12, 2015
@chcosta
Copy link
Member

chcosta commented Jan 4, 2016

This feature was checked in. We now have native packages for these native libraries which are referenced by the "identity" package.

@chcosta chcosta closed this as completed Jan 4, 2016
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 1.0.0-rc2 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Product code improvement that does NOT require public API changes/additions packaging Related to packaging
Projects
None yet
Development

No branches or pull requests

8 participants