rattler-build: rattler doesn't set rpath for binaries
The following recipe fails on linux-64
# yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json
context:
name: mssql-tools
version: '18.2.1.1'
package:
name: ${{ name }}
version: ${{ version }}
source:
- url: https://packages.microsoft.com/rhel/7/prod/${{ name }}18-${{ version }}-1.x86_64.rpm
sha256: 98758f29f1b1aad13c5ce32a5cf1e849d35a97054d030ee5dccdab6aefd2aef9
build:
number: 0
script:
- bsdtar xf mssql-tools18-${{ version }}-1.x86_64.rpm
- mkdir -p $PREFIX/bin
- cp opt/mssql-tools18/bin/* $PREFIX/bin
requirements:
build:
- libarchive
tests:
- package_contents:
bin:
- sqlcmd
- bcp
- script:
- patchelf --print-rpath $CONDA_PREFIX/bin/bcp | grep -q \$ORIGIN/../lib
- patchelf --print-rpath $CONDA_PREFIX/bin/sqlcmd | grep -q \$ORIGIN/../lib
requirements:
run:
- patchelf
The corresponding conda-build recipe succeeds with conda-build
package:
name: mssql-tools
version: '18.2.1.1'
source:
- url: https://packages.microsoft.com/rhel/7/prod/mssql-tools18-18.2.1.1-1.x86_64.rpm
sha256: 98758f29f1b1aad13c5ce32a5cf1e849d35a97054d030ee5dccdab6aefd2aef9
build:
number: 0
script:
# bsdtar not relevant because conda-build extracts it automatically
- mkdir -p $PREFIX/bin
- cp opt/mssql-tools18/bin/* $PREFIX/bin
test:
commands:
- patchelf --print-rpath $CONDA_PREFIX/bin/bcp | grep -q \$ORIGIN/../lib
- patchelf --print-rpath $CONDA_PREFIX/bin/sqlcmd | grep -q \$ORIGIN/../lib
requires:
- patchelf
Would be nice to have this example as a unit test
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 16 (5 by maintainers)
I think it is closely related to the
rpaths
option mentioned in #527:Absolutely.
It was already on my list so I will follow up with a PR.
Argh, ok, so these binaries don’t have an rpath and that’s why our patching doesn’t work… and also won’t work with our current Rust implementation (not such a big deal since we can still use
patchelf
).But looks like we need to force the
$PREFIX/lib
as an RPATH into the binary if no RPath is set to make these work.@orhun See the failing tests in https://github.com/prefix-dev/rattler-build/actions/runs/7642259861/job/20821467331?pr=532 #532
my local logs: (from osx-arm64 as build-platform)