Bug 155183 - graphics/gegl build failure because of missing log2f()
Summary: graphics/gegl build failure because of missing log2f()
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pietro Cerutti
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-02 10:00 UTC by Christoph Moench-Tegeder
Modified: 2011-03-02 15:20 UTC (History)
0 users

See Also:


Attachments
gegl.diff (685 bytes, patch)
2011-03-02 14:39 UTC, Guido Falsi
no flags Details | Diff
gegl.diff (685 bytes, patch)
2011-03-02 14:44 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Moench-Tegeder freebsd_committer freebsd_triage 2011-03-02 10:00:20 UTC
Build of gegl-0.1.6 fails because of missing log2f():

 CXX    exp_combine-exp_combine.o                                               
exp_combine.cpp: In function 'gfloat expcombine_get_file_ev(const gchar*)':     
exp_combine.cpp:94: error: 'log2f' was not declared in this scope               
gmake[2]: *** [exp_combine-exp_combine.o] Error 1                               
gmake[2]: Leaving directory `/usr/ports/graphics/gegl/work/gegl-0.1.6/tools'

log2f() is in POSIX and C89, so FreeBSD should have one, too; but that is
outside the scope of this PR.

Fix: If I got my logarithms right, the following patch should produce equivalent
code without relying on log2f(). Please review, in case I'm making a fool
of myself.



Regards,
Christoph--TpBmpqwvbL8Sw8NfjNGz05mWnHzDrikaebco9WdEApYMPNCC
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

diff -Nru gegl.orig/files/patch-tools-exp_combine.cpp gegl/files/patch-tools-exp_combine.cpp
--- gegl.orig/files/patch-tools-exp_combine.cpp	1970-01-01 01:00:00.000000000 +0100
+++ gegl/files/patch-tools-exp_combine.cpp	2011-03-02 10:26:21.000000000 +0100
@@ -0,0 +1,11 @@
+--- tools/exp_combine.cpp.orig	2011-03-02 10:23:52.000000000 +0100
++++ tools/exp_combine.cpp	2011-03-02 10:25:03.000000000 +0100
+@@ -91,7 +91,7 @@
+       gain = 1.0f;
+     }
+ 
+-  return log2f (aperture * aperture) + log2f (1 / time) + log2f (gain);
++  return logf (aperture * aperture * gain / time) / logf (2.0);
+ }
+ 
+ 
How-To-Repeat: 	try to build gegl
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-03-02 10:00:32 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gahr

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 swell.k 2011-03-02 10:39:03 UTC
As log2f(3) was added to /head in r216211 can you hide the patch behind
OSVERSION < 900027?
Comment 3 b. f. 2011-03-02 12:20:24 UTC
This patch shouldn't be applied unconditionally, because the missing
functions are in 9-CURRENT (for OSVERSION > 900026 although they
haven't been merged, presumably because das@ was busy, and no one else
noticed):

http://svn.freebsd.org/viewvc/base?view=revision&revision=216211
http://svn.freebsd.org/viewvc/base?view=revision&revision=216212

Also, while I think that the new expression in the patch is formally
correct, I wonder if there was a reason why the original calculation
was split into parts.  Probably the new expression should be checked
to make sure that no parts of it will {over,under}flow, or lose
precision due to round-off.

b.
Comment 4 dfilter service freebsd_committer freebsd_triage 2011-03-02 12:43:10 UTC
gahr        2011-03-02 12:42:51 UTC

  FreeBSD ports repository

  Added files:
    graphics/gegl/files  patch-tools_exp_combine.cpp 
  Log:
  - Add a patch to workaround the lack of log2f in older releases.
    NOTE: this should not hit users of CURRENT, 7.4 or 8.2.
  
  Reported by:    ajtiM <lumiwa@gmail.com>
                  Warren Block <wblock@wonkity.com>
                  Christoph Moench-Tegeder <cmt@burggraben.net>
  PR:             ports/155183
  
  Revision  Changes    Path
  1.1       +14 -0     ports/graphics/gegl/files/patch-tools_exp_combine.cpp (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 Pietro Cerutti freebsd_committer freebsd_triage 2011-03-02 12:43:11 UTC
State Changed
From-To: open->closed

A patch has been committed
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2011-03-02 14:39:04 UTC
The committed patch excludes recent 8.2-STABLE systems from using the
patch, making gegl fail on those.

I'm attaching a patch which includes stable systems and uses >= and <=
in place of < and > where appropriate.

Hope this is the correct solution to this problem.

IMHO stable systems should be included, a new bump in __FreeBSD_version
should be made when the relevand log2f code is MFCed and the patch
updated again then.

-- 
Guido Falsi <mad@madpilot.net>
Comment 7 Guido Falsi freebsd_committer freebsd_triage 2011-03-02 14:44:32 UTC
I missed the latest bump in __FreeBSD_version. please use the attached
revised patch.

-- 
Guido Falsi <mad@madpilot.net>
Comment 8 kamikaze 2011-03-02 14:53:07 UTC
Request reopening, not fixed!

The #if definition in the committed patch is wrong, 8.2 is among
the affected versions.

Similarly I'd expect 7.4 to be affected, too.

> uname -a
FreeBSD mobileKamikaze.norad 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0: Tue Feb  8 15:38:58 CET 2011     root@mobileKamikaze.norad:/usr/obj/HP6510b-8/amd64/usr/src/sys/HP6510b-8  amd64

Changing the comparison to < 803000 fixes the problem for me.

Regards

-- 
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Comment 9 dfilter service freebsd_committer freebsd_triage 2011-03-02 15:11:06 UTC
gahr        2011-03-02 15:10:45 UTC

  FreeBSD ports repository

  Modified files:
    graphics/gegl/files  patch-tools_exp_combine.cpp 
  Log:
  - Adjust recent patch to include un-MFC'd stable branches.
  
  PR:             155183
  Reported by:    Guido Falsi <mad@madpilot.net>
                  Warren Block <wblock@wonkity.com>
  
  Revision  Changes    Path
  1.2       +1 -1      ports/graphics/gegl/files/patch-tools_exp_combine.cpp
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"