pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lang/rust still looks in /usr/pkg/
Following up on my own message:
>> Why can't the package run patchelf on the bootstrap kit's binaries
>> automatically? It's already aware of the user's PREFIX.
>
> Of course, my thinking was ... a bit off.
>
> How does this diff look?
>
> Index: Makefile
> ===================================================================
> RCS file: /cvsroot/pkgsrc/lang/rust/Makefile,v
> retrieving revision 1.208
> diff -u -r1.208 Makefile
> --- Makefile 29 Nov 2020 20:15:15 -0000 1.208
> +++ Makefile 13 Dec 2020 11:56:13 -0000
> @@ -330,6 +330,12 @@
> SUBST_SED.cksum+= -e 's,${from},${to},g'
> .endfor
>
> +.if ${OPSYS} == "NetBSD"
> +TOOL_DEPENDS+= patchelf-[0-9]*:../../devel/patchelf
> +PATCHELF= ${PREFIX}/bin/patchelf
> +FORCE_RPATH= --force-rpath
> +.endif
> +
> post-extract:
> set -e; \
> if ${TEST} -e ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}/install.sh \
> @@ -351,6 +357,12 @@
> ${LN} -s gcc-wrap c++-wrap; \
> ${LN} -s gcc-wrap clang++-wrap; \
> ${LN} -s gcc-wrap clang-wrap
> + # Fixup cargo rpath to pick up libcurl.so
> + RPATH='${PREFIX}/lib:/lib:/usr/lib:$$ORIGIN/../lib'; \
> + for f in bin/cargo; do \
> + f=${RUST_BOOTSTRAP_PATH:Q}/$$f; \
> + ${PATCHELF} ${FORCE_RPATH} --set-rpath $${RPATH} $$f; \
> + done
> .endif
>
> .if ${OPSYS} == "FreeBSD"
>
> It's either that or modifying PKGSRC_MAKE_ENV by adding
> ${PREFIX}/lib tere.
This would have been nice if it worked. Sadly, it doesn't look
like it does.
Once I've run patchelf on the 'cargo' executable, it no longer
runs or is accepted by ldd:
% ./cargo
./cargo: Exec format error. Binary file not executable.
% ls -l cargo
-rwxr-xr-x 1 he wheel 21096944 Dec 16 10:05 cargo*
% file cargo
cargo: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 8.0, with debug_info, not stripped
% ldd cargo
ldd: cargo: invalid ELF class 2; expected 1
% od -c cargo | head -2
0000000 177 E L F 002 001 001 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000020 003 \0 > \0 001 \0 \0 \0 \0 340 020 \0 \0 \0 \0 \0
% uname -m
amd64
%
% file cargo.orig
cargo.orig: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld.elf_so, for NetBSD 8.0, with debug_info, not stripped
% ldd cargo.orig
ldd: bad execname `cargo.orig' in AUX vector: No such file or directory
% ./cargo.orig
Rust's package manager
USAGE:
cargo [OPTIONS] [SUBCOMMAND]
OPTIONS:
-V, --version Print version info and exit
--list List installed commands
--explain <CODE> Run `rustc --explain CODE`
-v, --verbose Use verbose output (-vv very verbose/build.rs output)
-q, --quiet No output printed to stdout
--color <WHEN> Coloring: auto, always, never
--frozen Require Cargo.lock and cache are up to date
--locked Require Cargo.lock is up to date
--offline Run without accessing the network
-Z <FLAG>... Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
-h, --help Prints help information
Some common cargo commands are (see all commands with --list):
build, b Compile the current package
check, c Analyze the current package and report errors, but don't build object files
clean Remove the target directory
doc Build this package's and its dependencies' documentation
new Create a new cargo package
init Create a new cargo package in an existing directory
run, r Run a binary or example of the local package
test, t Run the tests
bench Run the benchmarks
update Update dependencies listed in Cargo.lock
search Search registry for crates
publish Package and upload this package to the registry
install Install a Rust binary. Default location is $HOME/.cargo/bin
uninstall Uninstall a Rust binary
See 'cargo help <command>' for more information on a specific command.
%
?!?
...and doing objdump on them both reveals similar results, at
least at the top of the "objdump -x" output:
cargo: file format elf64-x86-64
cargo
architecture: i386:x86-64, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x000000000010e000
...
Dynamic Section:
NEEDED libpthread.so.1
NEEDED libgcc_s.so.1
NEEDED libc.so.12
NEEDED libm.so.0
RPATH /usr/pkg/lib:/lib:/usr/lib:$ORIGIN/../lib
INIT 0x000000000010cec0
FINI 0x0000000000ab2770
HASH 0x0000000000000280
...
etc.
and cargo.orig:
cargo.orig: file format elf64-x86-64
cargo.orig
architecture: i386:x86-64, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x000000000010e000
...
Dynamic Section:
NEEDED libpthread.so.1
NEEDED libgcc_s.so.1
NEEDED libc.so.12
NEEDED libm.so.0
RPATH $ORIGIN/../lib
INIT 0x000000000010cec0
FINI 0x0000000000ab2770
HASH 0x0000000000000280
...
I can't quite claim to understand what is going on here...
Regards,
- Håvard
Home |
Main Index |
Thread Index |
Old Index