The libraries at one point in the gimp-print-4.2.7 build script aren't specified in the correct order for using --as-needed, and as such -lm is removed even though it's needed by a library later on. This patch will fix the problem (a similar patch is already in place for gimp-print-5.0.0_rc2, but gimp itself still requires this version of gimp-print). Patch to follow.
Created attachment 83698 [details, diff] gimp-print-4.2.7-as-needed.patch
Use latest ~arch, that's already fixed, for now it's not the case to use --as-needed on arch. Also, we have already enough trouble with the need of re-autotooling gimp-print 5 that I don't think it's worth trying to get 4 working, too.
I am using the latest ~x86. That includes gimp-2.2.10, which has a dependency on =gimp-print-4.2*. I've also supplied the patch, which whilst I can't vouch for others, seems to allow compilation for me. However, since I've already got this in my local overlay, I'm quite happy for it not to go any further, I'll leave the decision up to you...
The problem is that the patch is for a Makefile.in file when iirc gimp-print uses Makefile.am, and that might lead to problems. Anyway that's up to the printing herd, not to me, I was just suggesting.
As far as I can tell, gimp-print-4.2.7 has already had autotools run over it, and the ebuild does not rerun them, so correctly Makefile.am won't fix the problems without another autotooling. Since I just wanted something to get it to compile correctly, I manually hacked up the Makefile.in to fix it. Very dirty I agree, but I don't know how to do it any cleaner? I'm going through my other packages (apr-util with gdbm support, epiphany, gdm, etc) trying to fix them up too, so if there's a nicer way of doing it, do please let me know... Thanks! 5:)
Take a look at http://www.gentoo.org/proj/en/qa/autofailure.xml . Usually when you have automake-based projects you should patch Makefile.am rather than Makefile.in. This because if then something else comes that requires to change Makefile.am or configure.{in,ac} and then re-runs autotools, the changes to .in are lost. Also there are cases in which the autotools gets fooled up when you modify the .in but not the .am.
Ok, that's great. Thanks very much for the pointer. I'll give it a look and hopefully post let dirty hacks to fix up the --as-needed problems I've been encountering! 5:)
Created attachment 83825 [details, diff] gimp-print-4.2.7-as-needed.patch (patches Makefile.am) Ok, so this is an almost identical patch, except it applies to Makefile.am rather than Makefile.in. Don't forget to eautomake somewhere in the ebuild...
Gah I'm wasting quite a bit of time to get this working. I'll do the dirty trick of the year (editing both .am and .in), hoping that it will work.
Okay committed with double patching, seems to work, I hope so, if it regenerates autotools it will hurt, badly...