Open vrkosk opened 2 months ago
Re the LIBS issue, the workaround is wrong. After replacing $Config{libsdirs}
with $Config{incpth}
, the solution is:
$ perl Makefile.PL
$ make
$ patchelf --print-rpath blib/arch/auto/Devel/NYTProf/NYTProf.so
/pkgs64/centos6-sysroot/lib64
$ patchelf --set-rpath '' blib/arch/auto/Devel/NYTProf/NYTProf.so
$ make test
Something in the toolchain (GNU ld? ExtUtils::MakeMaker?) hardcodes the rpath to the sysroot when linking against -lrt.
Can you supply the complete ./Configure
command you are using to build this relocatable perl
? (Or, output of perl -V:config_args
.)
Also, can you explain why you are using such a relocatable perl
as a place in which to do profiling with Devel-NYTProf?
Thanks.
It's an unusual setup. I have a sysroot in /pkgs64/centos6-sysroot, which is a bare CentOS 6 system. I have compiled GCC 11 using --sysroot=/pkgs64/centos6-sysroot and installed the binaries in /pkgs64/gcc/11.3.0-c6. The goal is to be able to use a new(er) toolchain while creating binaries that target glibc 2.12 (CentOS 6), without being stuck on running everything in a CentOS 6 VM.
The actual use case is, we are bundling Perl as part of a product. The product doesn't have a fixed install path; the end user can install it in any path. We build a relocatable Perl built using the above sysroot, which means we don't need to relocate anything at install time, and we don't need to worry about glibc compatibility.
We don't need Devel::NYTprof on end user systems, but it's really useful to have it for development (it's a great profiler!). Please treat the bug report as a nice to have improvement than something many people will need.
export COMPILER_PATH=/pkgs64/gcc/11.3.0-c6/bin
export PATH=$COMPILER_PATH:$PATH
export SYSROOT=/pkgs64/centos6-sysroot
./Configure -esdr \
-Dcc=gcc \
-Dsysroot=$SYSROOT \
-Duserelocatableinc \
-Duseithreads \
-Dusemulti \
-Dprefix=$XYZZY/perl_538 \
-Dprivlib=.../../lib \
-Darchlib=.../../lib \
-Dsitelib=.../../lib \
-Dsitearch=.../../lib \
-Dotherlibdirs=.../../site/lib
Here $XYZZY is some arbitrary directory on the build system.
Makefile.PL sets include directories like so:
Why is it using
$Config{libsdirs}
? I have built a (relocatable) Perl using -Dsysroot, which means libsdirs is set to:When I run
perl Makefile.PL
, it emits a compiler warning that causes gettime to be disabled:The reason is,
$Config{libsdirs}
doesn't contain any system headers from the sysroot, so it's defaulting to the host system's /usr/include. Changing Makefile.PL to$Config{incpth}
fixes it. In my Perl, it's:Unfortunately, this isn't the end of the story! With the defaults, the link command is:
This looks OK, but I think the LD_RUN_PATH is wrong (and this could be an ExtUtils::MakeMaker problem), because the tests fail immediately with:
I can work around it by clearing LIBS:
Which results in the link command:
And now all Devel::NYTProf tests pass. To summarise,
$Config{libsdirs}
definitely seems wrong, but the -lrt issue could be a fault in my sysroot or Perl compilation.