bazel-contrib / bazel-contrib/rules_foreign_cc
Cannot use $ORIGIN in rpath with configure_make_variant
- Dominant language
- Starlark
- Stars
- 737
- Forks
- 270
- PR merge metrics
- No merged PRs in 30d
Description
because rules_foreign_cc relies on a build_script.sh to wrap all the linker commands to building binaries, any path that is added as a linker argument with $ORIGIN in the rpath will fail at build time.
build_script.sh will see $ORIGIN and attempt to resolve the variable within the context of the bash script rather than piping the $ORIGIN string through to the linker.
As a workaround, I am setting the environment variable
env = {
"ORIGIN": "\\$$\\$$ORIGIN",
},
in order to have rules_foreign_cc build_script.sh resolve $ORIGIN to \$\$ORIGIN so that the makefile will see $$ORIGIN which will be treated as a literal.
It would be much much much preferred if rules_foreign_cc could support an rpath with $ORIGIN embedded natively, without end user need for work arounds.
Contributor guide
Research direction
Start by inspecting build_script.sh and the configure_make_variant entry point, then reproduce a build with an rpath containing $ORIGIN. Trace how the shell wrapper handles the linker argument; done means the literal $ORIGIN reaches the linker without requiring the reported environment-variable workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100