Bug 191161 - building www/p5-libapreq2 does not link libapreq2.so unless it is installed - STAGE dir failure
Summary: building www/p5-libapreq2 does not link libapreq2.so unless it is installed -...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Many People
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-18 16:31 UTC by Vick Khera
Modified: 2014-07-23 05:32 UTC (History)
1 user (show)

See Also:


Attachments
Patch to libapreq2 (9.88 KB, patch)
2014-06-23 18:59 UTC, Kurt Jaeger
no flags Details | Diff
patch to www/libapreq2 (5.35 KB, patch)
2014-07-19 15:18 UTC, Kurt Jaeger
no flags Details | Diff
patch to www/p5-libapreq2 (2.36 KB, patch)
2014-07-19 15:18 UTC, Kurt Jaeger
no flags Details | Diff
svn diff for www/libapreq2 (5.04 KB, patch)
2014-07-19 16:12 UTC, Kurt Jaeger
no flags Details | Diff
svn diff for www/p5-libapreq2 (10.39 KB, patch)
2014-07-19 16:13 UTC, Kurt Jaeger
no flags Details | Diff
patch to reduce run-deps for (840 bytes, patch)
2014-07-22 16:55 UTC, Kurt Jaeger
no flags Details | Diff
patch to maybe reduce deps (263 bytes, patch)
2014-07-22 16:56 UTC, Kurt Jaeger
no flags Details | Diff
revised p5-libapreq2 patch (1.00 KB, patch)
2014-07-22 18:24 UTC, Vick Khera
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vick Khera 2014-06-18 16:31:02 UTC
If you build www/p5-libapreq2 on an empty system, the resulting perl modules
are not linked against libapreq2.so. The second time you build this port, ie,
when libapreq2.so is in /usr/local/bin, it properly builds the perl module.

This is a problem when building packages using poudriere for example, as the
resulting package for p5-libapreq2 does produce a perl library that works.



Specifically:

 ... build on new system ...
# ldd $WRKSRC/glue/perl/blib/arch/auto/APR/Request/Request.so
glue/perl/blib/arch/auto/APR/Request/Request.so:
	libthr.so.3 => /lib/libthr.so.3 (0x80120c000)
	libc.so.7 => /lib/libc.so.7 (0x80081a000)
# perl -MAPR::Request::Apache2 -e 'print $APR::Request::Apache2::VERSION,"\n"'
Can't load '/usr/local/lib/perl5/site_perl/5.16/mach/auto/APR/Request/Request.so' for module APR::Request: /usr/local/lib/perl5/site_perl/5.16/mach/auto/APR/Request/Request.so: Undefined symbol "apreq_hook_disable_uploads" at /usr/local/lib/perl5/5.16/mach/DynaLoader.pm line 190.
 at /usr/local/lib/perl5/site_perl/5.16/mach/APR/Request/Apache2.pm line 26.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.16/mach/APR/Request/Apache2.pm line 26.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.16/mach/APR/Request/Apache2.pm line 26.
Compilation failed in require.
BEGIN failed--compilation aborted.

 ... build on system with a copy of libapreq2 (aka this port) already installed ...
# ldd $WRKSRC/glue/perl/blib/arch/auto/APR/Request/Request.so
glue/perl/blib/arch/auto/APR/Request/Request.so:
	libapreq2.so.11 => /usr/local/lib/libapreq2.so.11 (0x80120c000)
	libaprutil-1.so.0 => /usr/local/lib/libaprutil-1.so.0 (0x80141a000)
	libapr-1.so.0 => /usr/local/lib/libapr-1.so.0 (0x80163f000)
	libcrypt.so.5 => /lib/libcrypt.so.5 (0x801870000)
	libexpat.so.6 => /usr/local/lib/libexpat.so.6 (0x801a8f000)
	libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x801cb3000)
	libthr.so.3 => /lib/libthr.so.3 (0x801faf000)
	libc.so.7 => /lib/libc.so.7 (0x80081a000)
# perl -MAPR::Request::Apache2 -e 'print $APR::Request::Apache2::VERSION,"\n"'
2.13

How-To-Repeat:
cd /usr/ports/www/p5-libapreq2
make deinstall
make clean
make install
perl -MAPR::Request::Apache2 -e 1
 ... will give above error ...
ldd /usr/local/lib/perl5/site_perl/5.16/mach/auto/APR/Request/Request.so
 ... will show no extra libs linked ...
make clean
make
make reinstall
perl -MAPR::Request::Apache2 -e 1
 ... will work ...
ldd /usr/local/lib/perl5/site_perl/5.16/mach/auto/APR/Request/Request.so
 ... will show all the extra libs linked ...

Fix:
I think it needs to specify LD_RUN_PATH when linking.
Comment 1 Vick Khera 2014-06-18 17:56:37 UTC
I spent the last hour diving through this, and I'm 100% sure this is due to a fail in the stage directory process.

At install time, immediately after libapreq2.so is installed, it re-links the perl module against the /usr/local/bin copy of it. However, that file does not exist since it is safely tucked away into the stage directory.
Comment 2 Kurt Jaeger freebsd_committer freebsd_triage 2014-06-22 04:14:39 UTC
I have some patches in preparation for www/libapreq2, they should cover this.

TODO: finalize them, provide here for testing.
Comment 3 Kurt Jaeger freebsd_committer freebsd_triage 2014-06-23 18:59:21 UTC
Created attachment 144078 [details]
Patch to libapreq2

As promised, my prepared patch.

But: I think it does not solve the issue you describe. And I think I can reproduce it.

I build it with

poudriere bulk -f ~/pkg-libapreq2 -j 10amd64

and used ldd to check the generated Request.so.

Can you try to verify that the patch does not fix the issue ?
Comment 4 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-19 15:18:04 UTC
Created attachment 144793 [details]
patch to www/libapreq2

New patches which seperate the build of libapreq2 and p5-libapreq2.

Please test whether it still fails to link the proper libs.
Comment 5 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-19 15:18:51 UTC
Created attachment 144794 [details]
patch to www/p5-libapreq2
Comment 6 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-19 16:12:59 UTC
Created attachment 144795 [details]
svn diff for www/libapreq2

svn diff, complete this time...
Comment 7 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-19 16:13:43 UTC
Created attachment 144796 [details]
svn diff for www/p5-libapreq2

complete svn diff this time
Comment 8 Vick Khera 2014-07-22 15:04:24 UTC
This appears committed now.

I just tested it. By building libapreq2 first, it does indeed solve this chicken/egg problem and the resulting binary package does successfully run.

The only issue I have with it is that it still lists p5-ExtUtils-XSBuilder as a run-time dependency, which I do not believe it should do. My personal preference is to keep the surface area of my software installations as small as possible to reduce any possible attack vectors.

Thanks!
Comment 9 Vick Khera 2014-07-22 15:08:48 UTC
It seems to now add two more run-time dependencies, which are not necessary at all: gmake and autoconf, and does not explicitly list per5 as a dependeny anymore.
Comment 10 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-22 16:55:59 UTC
Created attachment 144881 [details]
patch to reduce run-deps for

Can you have a look at the patch attached and see if it reduces the run-deps ?

A second patch for www/libapreq2 follows soon.
Comment 11 Kurt Jaeger freebsd_committer freebsd_triage 2014-07-22 16:56:38 UTC
Created attachment 144882 [details]
patch to maybe reduce deps

See above.
Comment 12 Vick Khera 2014-07-22 18:24:38 UTC
Created attachment 144887 [details]
revised p5-libapreq2 patch

I posted a revised patch to p5-libapreq2 that adds perl as a runtime dependency, to bring it back in line to how it was before the restructuring.
Comment 13 commit-hook freebsd_committer freebsd_triage 2014-07-23 05:19:38 UTC
A commit references this bug:

Author: pi
Date: Wed Jul 23 05:19:08 UTC 2014
New revision: 362622
URL: http://svnweb.freebsd.org/changeset/ports/362622

Log:
  www/p5-libapreq2: reduce/fix dependencies

  PR:		191161
  Submitted by:	vivek@khera.org

Changes:
  head/www/p5-libapreq2/Makefile