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

Instructions for adding a native external library dependency #105045

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

carlossanlop
Copy link
Member

Contributes to #101465

General guidance with the essential steps to add or update a native external library.

Each library might have its own specific steps, we can add them later as needed.

Copy link
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@carlossanlop carlossanlop mentioned this pull request Jul 17, 2024
18 tasks
Copy link
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

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

We should have some guidance somewhere about when to vendor in a library vs depend on a system library (ie explaining why we vendor in zlib-ng but don't vendor in openssl).

@@ -0,0 +1,72 @@
# Native external libraries

This folder contains the source code of third party native libraries that are used as dependencies for Runtime.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This folder contains the source code of third party native libraries that are used as dependencies for Runtime.
This folder contains the source code of vendored third party native libraries that are used as dependencies for dotnet/runtime.

Copy link
Member Author

@carlossanlop carlossanlop Jul 17, 2024

Choose a reason for hiding this comment

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

@jkoritzinsky Pardon my ignorance: What does vendored refer to? Why would all these libraries be considered as such?

Copy link
Member

Choose a reason for hiding this comment

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

"Vendored in" libraries are libraries we include as source in our repository. https://github.com/dotnet/arcade/blob/main/Documentation/UnifiedBuild/VMR-Strategy-For-External-Source.md has the definition.

Other dependencies (like llvm-project), we maintain as a fork. Others we depend on system packages (openssl, our compiler toolchain). In the future, we may download some (test-only) dependencies that aren't needed in source-build scenarios and would only bloat the repo. This README only applies to vendored dependencies.

src/native/external/README.md Outdated Show resolved Hide resolved
Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
@carlossanlop
Copy link
Member Author

We should have some guidance somewhere about when to vendor in a library vs depend on a system library (ie explaining why we vendor in zlib-ng but don't vendor in openssl).

Good point. Let me think about this.

- Select the "Releases" and "Security alerts" checkboxes
- Click on "Apply"

8. Consult with the .NET Security experts to make sure we meet all of Microsoft's Open Source guidance, especially regarding security updates and timeline expectations.
Copy link
Contributor

Choose a reason for hiding this comment

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

This ought to happen before a new dependency is added, not at the very end :)

Copy link
Contributor

Choose a reason for hiding this comment

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

9? (For internal users) Validate that CG detects the dependency.


- `library-folder/` is where the native source code lives.
- `library.cmake` is the main cmake file we add to build this library from anywhere in this repo.
- `library-version.txt` contains all the detailed release information for this library.
Copy link
Member

Choose a reason for hiding this comment

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

... and information about any local patches applied to the library.

- Manual modifications we need to make after copying the source code. For example, deleting unnecessary files or trimming unnecessary code.
- Important notes about the release, like security fixes.

5. Make any necessary cmake changes to properly consume the source code.
Copy link
Member

Choose a reason for hiding this comment

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

It is not unusual to make changes in the library sources as part of this step. The information about these changes should be included in ...-version.txt file. The same changes should be proposed for the library upstream so that they are not necessary during the next library update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants