-
Notifications
You must be signed in to change notification settings - Fork 653
[bazel] Link static and shared libraries correctly #8025
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
Open
AustinSchuh
wants to merge
4
commits into
wpilibsuite:2027
Choose a base branch
from
AustinSchuh:shared_static_libraries
base: 2027
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,047
−214
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This gets us to the point where most of the static and shared libraries are built correctly, and match the gradle versions. I've verified this with a script which compares artifacts. The packaging and release parts still need to be finished, but this is big enough already. Chunks of this code are from PJ, the rest is from me. I've lost track of which pieces are from whom. cc_shared_library does most everything we want to generate the correct graph of shared libraries. I ended up needing to create my own version of it for static libraries, since we want similar complexity when splitting things up, and the upstream cc_static_library isn't flexible enough. version.bzl is currently manually updated, I'd like to update it automatically. Everything which needs a version sources from there. Ideally, --embed_label would populate it with a repository rule. Feels like a good follow-on commit. Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
Not surprisingly, looks like windows + osx are a bit wonky. I need to do some digging to learn why and what the correct answer is. |
ThadHouse
reviewed
Jun 16, 2025
"@bazel_tools//src/conditions:darwin": [ | ||
user_link_flags = select({ | ||
"@platforms//os:osx": [ | ||
"-Wl,-install_name,libcscorejnicvstatic.so", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macOS libraries are .dylib, not .so
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
2027
2027 target
component: apriltag
AprilTag library
component: command-based
WPILib Command Based Library
component: cscore
CameraServer library
component: datalogtool
DataLog Tool
component: epilogue
Annotation-based logging library
component: examples
component: glass
Glass app and backend
component: hal
Hardware Abstraction Layer
component: ntcore
NetworkTables library
component: sysid
SysId app
component: wpilibc
WPILib C++
component: wpilibj
WPILib Java
component: wpimath
Math library
component: wpinet
WPI networking library
component: wpiunits
Java units library
component: wpiutil
WPI utility library
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This gets us to the point where most of the static and shared libraries are built correctly, and match the gradle versions. I've verified this with a script which compares artifacts. The packaging and release parts still need to be finished, but this is big enough already.
Chunks of this code are from PJ, the rest is from me. I've lost track of which pieces are from whom.
cc_shared_library does most everything we want to generate the correct graph of shared libraries. I ended up needing to create my own version of it for static libraries, since we want similar complexity when splitting things up, and the upstream cc_static_library isn't flexible enough.
version.bzl is currently manually updated, I'd like to update it automatically. Everything which needs a version sources from there. Ideally, --embed_label would populate it with a repository rule. Feels like a good follow-on commit.