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

Add macro that faciliates "bazel run" of binary generated by rules_foreign_cc #971

Merged
merged 6 commits into from
Nov 3, 2022

Conversation

jheaff1
Copy link
Collaborator

@jheaff1 jheaff1 commented Oct 6, 2022

This resolves #582

The macro also facilitates the running of dynamically linked executables, which could then be used as tools in dependent targets. This is useful when using LGPL licenced third party software that must be dynamically linked.

Note that the OpenSSL example has been changed to produce shared libraries and to produce the openssl binary. This tests that runnable_binary can successfully run a dynamically linked binary

@jheaff1 jheaff1 force-pushed the runnable_bin branch 17 times, most recently from 14f33ef to 2391527 Compare October 7, 2022 12:46
@jheaff1 jheaff1 marked this pull request as ready for review October 7, 2022 13:09
@jheaff1
Copy link
Collaborator Author

jheaff1 commented Oct 7, 2022

@UebelAndre @jsharpe Would either of you be able to give me a hand with the MacOS failures in CI? I don't own a Mac so it's hard for me to debug

It seems now that OpenSSL shared libraries are built rather than static libraries, the curl test fails on MacOS only.

@jsharpe
Copy link
Collaborator

jsharpe commented Oct 7, 2022

@UebelAndre @jsharpe Would either of you be able to give me a hand with the MacOS failures in CI?

It seems now that OpenSSL shared libraries are built rather than static libraries, the curl test fails on MacOS only.

I haven't got time to spend much time on this right now but looks to be rpath related. I'm guessing the rpath in the binary isn't looking at the right path to find the shared library in the runfiles?

@jheaff1
Copy link
Collaborator Author

jheaff1 commented Oct 7, 2022

Yeah that's what I would guess also. I feel like thats an issue with bazel rather than rules_foreign_cc. I don't think there are any examples built by rules_foreign_cc that consume shared libraries

@jheaff1
Copy link
Collaborator Author

jheaff1 commented Oct 7, 2022

I think the MacOS issue is related to bazelbuild/bazel#10254

@jheaff1
Copy link
Collaborator Author

jheaff1 commented Oct 10, 2022

@jsharpe @UebelAndre As it seems that the use of shared libs on sandboxed macos is a bit broken, i have removed the failing tests from CI. I hope that's acceptable.

Previously, ff a target were to set the PATH variable in the `env`
attribute, the prepending of the path to the MSVC linker to the PATH
variable did not take effect, causing link failures as MSYS's "link.exe"
executable would instead be used.
The existing PATH is appended to user-defined PATH additions in
framework.bzl
Copy link
Collaborator

@jsharpe jsharpe left a comment

Choose a reason for hiding this comment

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

LGTM

@jsharpe jsharpe enabled auto-merge (squash) November 3, 2022 21:22
@jsharpe jsharpe merged commit dd1e285 into bazelbuild:main Nov 3, 2022
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.

Can't bazel run things generated as out_binaries
2 participants