Bug 188678 - benchmarks/bonnie++ Clang/libc++ compatibility patch
Summary: benchmarks/bonnie++ Clang/libc++ compatibility patch
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: Ganael LAPLANCHE
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-16 02:50 UTC by Matthew Rezny
Modified: 2014-05-12 08:00 UTC (History)
0 users

See Also:


Attachments
file.diff (3.24 KB, patch)
2014-04-16 02:50 UTC, Matthew Rezny
no flags Details | Diff
patch-dragonfly-bonnie++.txt (1.25 KB, patch)
2014-05-09 16:20 UTC, Ganael LAPLANCHE
no flags Details | Diff
benchmarks_bonnie++_patch.txt (3.63 KB, text/plain; charset="UTF-8")
2014-05-10 11:18 UTC, Matthew Rezny
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Rezny freebsd_committer freebsd_triage 2014-04-16 02:50:01 UTC
bonnie++ currently has GCC=any in the Makefile. The history of the port indicates prior attempts to make it compatible with Clang, but problems with libc++ have prevented those efforts. I decided to dig in a little deeper.

The cause of the problem is the definition of min and max. They should come from the algorithm header instead of being defined directly. The configure script probes for algorithm, but the file port.h only checks for configure flags to indicate presence of algo or algo.h, falling back to defining min and max if neither of those are present. Worse, we had a patch that dropped all the checks in that file and just forced defining min and max. If we instead add recognition of the flag from configure for using the algorithm header to define min and max, then this port builds fine with Clang and libc++.

Fix: Use the HAVE_ALGORITHM result from configure script to #include <algorithm> in order to properly define min and max.

While I'm at it, move instances of "using namespace std;" to come after header includes to eliminate all the warnings about implicitly defining namespace std, and fix the definition of PRINTF_OFF_T to quash a printf format warning.

This patch does all that.


Patch attached with submission follows:
How-To-Repeat: Remove GCC=any from the Makefile
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-04-16 02:50:06 UTC
Responsible Changed
From-To: freebsd-ports-bugs->martymac

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 sbruno 2014-04-16 19:19:52 UTC
This is a very nice change to the build/install behavior.  I'm now
running bonnie++ with this change and the build/install pulled in zero
extra depends.

sean
Comment 3 dfilter service freebsd_committer freebsd_triage 2014-04-28 12:39:58 UTC
Author: martymac
Date: Mon Apr 28 11:39:52 2014
New Revision: 352485
URL: http://svnweb.freebsd.org/changeset/ports/352485
QAT: https://qat.redports.org/buildarchive/r352485/

Log:
  - Remove GCC dependency
  - Fix several compilation warnings
  
  PR:		ports/188678
  Submitted by:	Matthew Rezny <matthew@reztek.cz>

Added:
  head/benchmarks/bonnie++/files/patch-bonnie.h.in   (contents, props changed)
  head/benchmarks/bonnie++/files/patch-duration.cpp   (contents, props changed)
  head/benchmarks/bonnie++/files/patch-rand.h   (contents, props changed)
Modified:
  head/benchmarks/bonnie++/Makefile
  head/benchmarks/bonnie++/files/patch-port.h.in

Modified: head/benchmarks/bonnie++/Makefile
==============================================================================
--- head/benchmarks/bonnie++/Makefile	Mon Apr 28 11:39:24 2014	(r352484)
+++ head/benchmarks/bonnie++/Makefile	Mon Apr 28 11:39:52 2014	(r352485)
@@ -14,7 +14,6 @@ COMMENT=	Performance Test of Filesystem 
 LICENSE=	GPLv2
 
 GNU_CONFIGURE=	yes
-USE_GCC=	any
 
 USES=	shebangfix
 SHEBANG_FILES=	bon_csv2txt.in

Added: head/benchmarks/bonnie++/files/patch-bonnie.h.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/benchmarks/bonnie++/files/patch-bonnie.h.in	Mon Apr 28 11:39:52 2014	(r352485)
@@ -0,0 +1,20 @@
+--- bonnie.h.in.orig    2009-08-21 18:45:50.068536643 +0000
++++ bonnie.h.in 2009-08-21 18:45:58.564755017 +0000
+@@ -1,8 +1,6 @@
+ #ifndef BONNIE
+ #define BONNIE
+ 
+-using namespace std;
+-
+ #define BON_VERSION "@version@"
+ #define CSV_VERSION "@csv_version@"
+ 
+@@ -12,6 +10,8 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ 
++using namespace std;
++
+ typedef FILE *PFILE;
+ 
+ #define SemKey 4711

Added: head/benchmarks/bonnie++/files/patch-duration.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/benchmarks/bonnie++/files/patch-duration.cpp	Mon Apr 28 11:39:52 2014	(r352485)
@@ -0,0 +1,17 @@
+--- duration.cpp.orig   2009-08-21 18:45:50.068536643 +0000
++++ duration.cpp        2009-08-21 18:45:58.564755017 +0000
+@@ -1,5 +1,3 @@
+-using namespace std;
+-
+ #include <stdlib.h>
+ 
+ #include "duration.h"
+@@ -20,6 +18,8 @@
+ #endif
+ #endif
+ 
++using namespace std;
++
+ Duration_Base::Duration_Base()
+  : m_start(0.0)
+  , m_max(0.0)

Modified: head/benchmarks/bonnie++/files/patch-port.h.in
==============================================================================
--- head/benchmarks/bonnie++/files/patch-port.h.in	Mon Apr 28 11:39:24 2014	(r352484)
+++ head/benchmarks/bonnie++/files/patch-port.h.in	Mon Apr 28 11:39:52 2014	(r352485)
@@ -1,21 +1,35 @@
 --- port.h.in.orig	2009-08-21 18:45:50.068536643 +0000
 +++ port.h.in	2009-08-21 18:45:58.564755017 +0000
-@@ -3,18 +3,8 @@
- 
+@@ -4,12 +4,12 @@
  #include "conf.h"
  
--#ifndef HAVE_MIN_MAX
+ #ifndef HAVE_MIN_MAX
 -#if defined(HAVE_ALGO_H) || defined(HAVE_ALGO)
 -#ifdef HAVE_ALGO
--#include <algo>
++#if defined(HAVE_ALGORITHM)
++#include <algorithm>
++#elif defined(HAVE_ALGO)
+ #include <algo>
 -#else
--#include <algo.h>
++#elif defined(HAVE_ALGO_H)
+ #include <algo.h>
 -#endif
--#else
+ #else
  #define min(XX,YY) ((XX) < (YY) ? (XX) : (YY))
  #define max(XX,YY) ((XX) > (YY) ? (XX) : (YY))
+@@ -19,14 +19,7 @@
+ @semun@
+ @bool@
+ @snprintf@
+-#ifndef _LARGEFILE64_SOURCE
+-@large_file@
 -#endif
+-#ifdef _LARGEFILE64_SOURCE
+-#define OFF_T_PRINTF "%lld"
+-#else
+-#define OFF_T_PRINTF "%d"
 -#endif
++#define OFF_T_PRINTF "%ld"
  
- @semun@
- @bool@
+ #if @true_false@
+ #define false 0

Added: head/benchmarks/bonnie++/files/patch-rand.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/benchmarks/bonnie++/files/patch-rand.h	Mon Apr 28 11:39:52 2014	(r352485)
@@ -0,0 +1,15 @@
+--- rand.h.orig 2009-08-21 18:45:50.068536643 +0000
++++ rand.h      2009-08-21 18:45:58.564755017 +0000
+@@ -1,11 +1,11 @@
+ #ifndef RAND_H
+ #define RAND_H
+ 
+-using namespace std;
+ #include "port.h"
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string>
++using namespace std;
+ 
+ class Rand
+ {
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Ganael LAPLANCHE freebsd_committer freebsd_triage 2014-04-28 12:40:44 UTC
State Changed
From-To: open->closed

Committed, thanks!
Comment 5 freebsd.contact 2014-05-06 13:53:45 UTC
This port no longer builds with GCC (4.7 to be exact), which is the base
compiler for DragonFly:

--- bon_file.o ---
c++  -pipe -O2 -fno-strict-aliasing -DNDEBUG -Wall -W -Wshadow
-Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align
-Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security
-Wswitch-enum -Winit-self     -pipe -O2 -fno-strict-aliasing -c bon_file.cpp
--- bon_time.o ---
c++  -pipe -O2 -fno-strict-aliasing -DNDEBUG -Wall -W -Wshadow
-Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align
-Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security
-Wswitch-enum -Winit-self     -pipe -O2 -fno-strict-aliasing -c bon_time.cpp
--- bon_file.o ---
In file included from /usr/include/c++/4.7/string:54:0,
                 from rand.h:7,
                 from bon_time.h:6,
                 from bon_file.cpp:9:
/usr/include/c++/4.7/bits/basic_string.h: In static member function
'static int std::basic_string<_CharT, _Traits,
_Alloc>::_S_compare(std::basic_string<_CharT, _Traits,
_Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type)':
/usr/include/c++/4.7/bits/basic_string.h:408:12: error: 'max' is not a
member of '__gnu_cxx::__numeric_traits<int>'
/usr/include/c++/4.7/bits/basic_string.h:409:11: error: 'max' is not a
member of '__gnu_cxx::__numeric_traits<int>'
/usr/include/c++/4.7/bits/basic_string.h:410:17: error: 'min' is not a
member of '__gnu_cxx::__numeric_traits<int>'
/usr/include/c++/4.7/bits/basic_string.h:411:11: error: 'min' is not a
member of '__gnu_cxx::__numeric_traits<int>'
*** [bon_file.o] Error code 1


The full log is here (not forever, but for a while):
http://muscles.dragonflybsd.org/latest-builder-report/logs/errors/bonnie++-1.97_2.log


Please reopen this PR -- the last commit broke the port for GCC which is
a worse situation than before.

Thanks,
John
Comment 6 Matthew Rezny freebsd_committer freebsd_triage 2014-05-06 19:35:48 UTC
On Tuesday 06 May 2014 14:53:45 John Marino wrote:
> This port no longer builds with GCC (4.7 to be exact), which is the base
> compiler for DragonFly:
> 
> --- bon_file.o ---
> c++  -pipe -O2 -fno-strict-aliasing -DNDEBUG -Wall -W -Wshadow
> -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align
> -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security
> -Wswitch-enum -Winit-self     -pipe -O2 -fno-strict-aliasing -c bon_file.cpp
> --- bon_time.o ---
> c++  -pipe -O2 -fno-strict-aliasing -DNDEBUG -Wall -W -Wshadow
> -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align
> -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security
> -Wswitch-enum -Winit-self     -pipe -O2 -fno-strict-aliasing -c bon_time.cpp
> --- bon_file.o ---
> In file included from /usr/include/c++/4.7/string:54:0,
>                  from rand.h:7,
>                  from bon_time.h:6,
>                  from bon_file.cpp:9:
> /usr/include/c++/4.7/bits/basic_string.h: In static member function
> 'static int std::basic_string<_CharT, _Traits,
> _Alloc>::_S_compare(std::basic_string<_CharT, _Traits,
> _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type)':
> /usr/include/c++/4.7/bits/basic_string.h:408:12: error: 'max' is not a
> member of '__gnu_cxx::__numeric_traits<int>'
> /usr/include/c++/4.7/bits/basic_string.h:409:11: error: 'max' is not a
> member of '__gnu_cxx::__numeric_traits<int>'
> /usr/include/c++/4.7/bits/basic_string.h:410:17: error: 'min' is not a
> member of '__gnu_cxx::__numeric_traits<int>'
> /usr/include/c++/4.7/bits/basic_string.h:411:11: error: 'min' is not a
> member of '__gnu_cxx::__numeric_traits<int>'
> *** [bon_file.o] Error code 1
> 
> 
> The full log is here (not forever, but for a while):
> http://muscles.dragonflybsd.org/latest-builder-report/logs/errors/bonnie++-1
> .97_2.log
> 
> 
> Please reopen this PR -- the last commit broke the port for GCC which is
> a worse situation than before.
> 
> Thanks,
> John

John,

I guess fixing the definition of min and max (using those defined in standard 
headers) broke GCC. From the errors mentioned, it appears the definitions of 
min and max used by GCC are not compatible with libstdc++. Could you share the 
log of configure phase of build with GCC as well as files generated at that time 
(bonnie.h, conf.h, port.h, etc)? I'm guessing there is no usable algorithm 
header and so it picks up incompatible legacy definitions from algo.h, but I 
don't have a working GCC in front of me to verify that right now.

As to whether the situation is worse than before, that depends on perspective. 
Pulling in GCC, and all it's dependencies, just for a simple test tool was not 
a good situation at all. Considering that Clang is the default compiler in 
FreeBSD, being compatible with that at the expense of GCC is preferable (to 
me). If that is an issue for DragonFly, I suggest dports stick with the prior 
version until we can come up with a solution that works for both.

BR,
Matthew
Comment 7 freebsd.contact 2014-05-06 20:55:18 UTC
On 5/6/2014 20:35, Matthew Rezny wrote:
> On Tuesday 06 May 2014 14:53:45 John Marino wrote:
>> This port no longer builds with GCC (4.7 to be exact), which is the base
>> compiler for DragonFly:
>>
>> --- bon_file.o ---
>> c++  -pipe -O2 -fno-strict-aliasing -DNDEBUG -Wall -W -Wshadow
>> -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align
>> -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security
>> -Wswitch-enum -Winit-self     -pipe -O2 -fno-strict-aliasing -c bon_file.cpp
>> --- bon_time.o ---
>> c++  -pipe -O2 -fno-strict-aliasing -DNDEBUG -Wall -W -Wshadow
>> -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align
>> -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security
>> -Wswitch-enum -Winit-self     -pipe -O2 -fno-strict-aliasing -c bon_time.cpp
>> --- bon_file.o ---
>> In file included from /usr/include/c++/4.7/string:54:0,
>>                  from rand.h:7,
>>                  from bon_time.h:6,
>>                  from bon_file.cpp:9:
>> /usr/include/c++/4.7/bits/basic_string.h: In static member function
>> 'static int std::basic_string<_CharT, _Traits,
>> _Alloc>::_S_compare(std::basic_string<_CharT, _Traits,
>> _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type)':
>> /usr/include/c++/4.7/bits/basic_string.h:408:12: error: 'max' is not a
>> member of '__gnu_cxx::__numeric_traits<int>'
>> /usr/include/c++/4.7/bits/basic_string.h:409:11: error: 'max' is not a
>> member of '__gnu_cxx::__numeric_traits<int>'
>> /usr/include/c++/4.7/bits/basic_string.h:410:17: error: 'min' is not a
>> member of '__gnu_cxx::__numeric_traits<int>'
>> /usr/include/c++/4.7/bits/basic_string.h:411:11: error: 'min' is not a
>> member of '__gnu_cxx::__numeric_traits<int>'
>> *** [bon_file.o] Error code 1
>>
>>
>> The full log is here (not forever, but for a while):
>> http://muscles.dragonflybsd.org/latest-builder-report/logs/errors/bonnie++-1
>> .97_2.log
>>
>>
>> Please reopen this PR -- the last commit broke the port for GCC which is
>> a worse situation than before.
>>
>> Thanks,
>> John
> 
> John,
> 
> I guess fixing the definition of min and max (using those defined in standard 
> headers) broke GCC. From the errors mentioned, it appears the definitions of 
> min and max used by GCC are not compatible with libstdc++. Could you share the 
> log of configure phase of build with GCC as well as files generated at that time 
> (bonnie.h, conf.h, port.h, etc)? I'm guessing there is no usable algorithm 
> header and so it picks up incompatible legacy definitions from algo.h, but I 
> don't have a working GCC in front of me to verify that right now.

I would have have to try to build it in poudriere / testport mode and
copy over the logs.  I can do that the but poudriere is busy with the
rest of the bulk run, plus then all the cleanups that come with it.  So
it would be a while (couple of days?)

I would guess that adding "USE_GCC=yes" back would be enough to reproduce?


> As to whether the situation is worse than before, that depends on perspective. 
> Pulling in GCC, and all it's dependencies, just for a simple test tool was not 
> a good situation at all. 

Well, that also assumes that no other port previously pulled it in,
which is not a particularly good assumption.  It's probably already on
most systems due to other ports.

The fact is that the port regressed.

> Considering that Clang is the default compiler in 
> FreeBSD, being compatible with that at the expense of GCC is preferable (to 
> me). If that is an issue for DragonFly, I suggest dports stick with the prior 
> version until we can come up with a solution that works for both.

Locking ports is possible but it comes with numerous issues (essentially
it becomes a fork that has to be maintained separately and the freebsd
ports infrastructure is changing constantly).  Until the new bonnie++
builds, the old one stays in place (that's how dports works).  So I
don't really have to do anything immediately.  What is the ETA for a
solution?   if it's < 1 month that's fine.

John
Comment 8 Ganael LAPLANCHE freebsd_committer freebsd_triage 2014-05-07 07:17:57 UTC
State Changed
From-To: closed->open

Re-open as per request
Comment 9 Ganael LAPLANCHE freebsd_committer freebsd_triage 2014-05-08 14:50:00 UTC
On Tue, 6 May 2014 20:00:01 GMT, John Marino wrote

Hi John, Matthew,

>  I would guess that adding "USE_GCC=yes" back would be enough 
> to reproduce?

Yes, I have tried to reproduce the problem by adding :

USE_GCC= 4.7

to the port, and it breaks. The build results are here :

http://box.martymac.org/FreeBSD-Packages/FBSD100amd64-default/2014-05-08_13h26m24s/logs/errors/bonnie++-1.97_2.log

> Well, that also assumes that no other port previously pulled 
> it in, which is not a particularly good assumption.  It's 
> probably already on most systems due to other ports.
>  
>  The fact is that the port regressed.

John, you are right : the port is broken on Dragonfly, but from a
FreeBSD point of view, it's better not to pull-in useless dependencies
and the port builds with all recent -supported- versions of FreeBSD.

> [...] So I don't really have to do 
> anything immediately.  What is the ETA for a solution?   if 
> it's < 1 month that's fine.

I hope so. I'll see what I can do to make the port build again with GCC
4.7 ; I am quite busy but I'll work on it ASAP.

Matthew, if you have an idea... ? :)

Best regards,

--
Ganael LAPLANCHE <ganael.laplanche@martymac.org>
http://www.martymac.org | http://contribs.martymac.org
FreeBSD: martymac <martymac@FreeBSD.org>, http://www.FreeBSD.org
Comment 10 freebsd.contact 2014-05-09 16:12:43 UTC
On 5/9/2014 17:10, Ganael LAPLANCHE wrote:
> Hi John, Matthew,
> 
>> I'll see what I can do to make the port build again 
>> with GCC 4.7 ; I am quite busy but I'll work on it ASAP.
> 
> Well, fighting to make the port build with gcc 4.7 may not be the best
> solution.
> 
> I guess the easiest way to fix it would be to require a c++11-ready
> compiler when the base compiler used is not gcc 4.2.1 (because we do not
> want to force clang dependency on FreeBSD 8.x and 9.x).
> 
> Mk/Uses/compiler.mk should help us do that.
> 
> Would the attached patch allow the port to build again on Dragonfly ?
> 

No patch was attached.  It would be better if it was posted so I could
fetch it directly though.
Thanks,
John
Comment 11 Ganael LAPLANCHE freebsd_committer freebsd_triage 2014-05-09 16:20:01 UTC
Hi John, Matthew,

(re-send with patch attached)

> I'll see what I can do to make the port build again 
> with GCC 4.7 ; I am quite busy but I'll work on it ASAP.

Well, fighting to make the port build with gcc 4.7 may not be the best
solution.

I guess the easiest way to fix it would be to require a c++11-ready
compiler when the base compiler used is not gcc 4.2.1 (because we do not
want to force clang dependency on FreeBSD 8.x and 9.x).

Mk/Uses/compiler.mk should help us do that.

Would the attached patch allow the port to build again on Dragonfly ?

--
Ganael LAPLANCHE <ganael.laplanche@martymac.org>
http://www.martymac.org | http://contribs.martymac.org
FreeBSD: martymac <martymac@FreeBSD.org>, http://www.FreeBSD.org
Comment 12 Ganael LAPLANCHE freebsd_committer freebsd_triage 2014-05-09 16:20:04 UTC
Hi John, Matthew,

> I'll see what I can do to make the port build again 
> with GCC 4.7 ; I am quite busy but I'll work on it ASAP.

Well, fighting to make the port build with gcc 4.7 may not be the best
solution.

I guess the easiest way to fix it would be to require a c++11-ready
compiler when the base compiler used is not gcc 4.2.1 (because we do not
want to force clang dependency on FreeBSD 8.x and 9.x).

Mk/Uses/compiler.mk should help us do that.

Would the attached patch allow the port to build again on Dragonfly ?

--
Ganael LAPLANCHE <ganael.laplanche@martymac.org>
http://www.martymac.org | http://contribs.martymac.org
FreeBSD: martymac <martymac@FreeBSD.org>, http://www.FreeBSD.org
Comment 13 freebsd.contact 2014-05-09 16:42:45 UTC
On 5/9/2014 17:11, Ganael LAPLANCHE wrote:
> 
> Mk/Uses/compiler.mk should help us do that.
> 
> Would the attached patch allow the port to build again on Dragonfly ?
> 

Nope.
http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/bonnie%2b%2b-1.97_3.log

John
Comment 14 Matthew Rezny freebsd_committer freebsd_triage 2014-05-10 11:18:57 UTC
On Friday 09 May 2014 17:42:45 John Marino wrote:
> On 5/9/2014 17:11, Ganael LAPLANCHE wrote:
> > Mk/Uses/compiler.mk should help us do that.
> > 
> > Would the attached patch allow the port to build again on Dragonfly ?
> 
> Nope.
> http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/
> bonnie%2b%2b-1.97_3.log
> 
> John

Try this patch. It removes definition of __min and __max. The #defines that 
aliased __min and __max to min and max were the actual source of trouble with 
GCC/libstdc++. They were only used used in a couple files so, I removed the 
#defines and changed bonnie++ to just use the min and max that it gets from the 
chosen header. Tested on Clang 3.4 and GCC 4.7.
Comment 15 freebsd.contact 2014-05-10 13:54:00 UTC
On 5/10/2014 12:18, Matthew Rezny wrote:
> 
> Try this patch. It removes definition of __min and __max. The #defines that 
> aliased __min and __max to min and max were the actual source of trouble with 
> GCC/libstdc++. They were only used used in a couple files so, I removed the 
> #defines and changed bonnie++ to just use the min and max that it gets from the 
> chosen header. Tested on Clang 3.4 and GCC 4.7.

We have a winner, thanks (don't forget to bump portrevision).
http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/bonnie%2b%2b-1.97_2.log

John
Comment 16 dfilter service freebsd_committer freebsd_triage 2014-05-12 07:50:09 UTC
Author: martymac
Date: Mon May 12 06:50:03 2014
New Revision: 353774
URL: http://svnweb.freebsd.org/changeset/ports/353774
QAT: https://qat.redports.org/buildarchive/r353774/

Log:
  Fix build with Gcc/libstdc++
  
  PR:		ports/188678
  Submitted by:	Matthew Rezny <matthew@reztek.cz>
  Tested by:	marino

Modified:
  head/benchmarks/bonnie++/Makefile
  head/benchmarks/bonnie++/files/patch-bonnie++.cpp   (contents, props changed)
  head/benchmarks/bonnie++/files/patch-duration.cpp
  head/benchmarks/bonnie++/files/patch-port.h.in

Modified: head/benchmarks/bonnie++/Makefile
==============================================================================
--- head/benchmarks/bonnie++/Makefile	Mon May 12 06:29:42 2014	(r353773)
+++ head/benchmarks/bonnie++/Makefile	Mon May 12 06:50:03 2014	(r353774)
@@ -3,7 +3,7 @@
 
 PORTNAME=	bonnie++
 PORTVERSION=	1.97
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	benchmarks
 MASTER_SITES=	http://www.coker.com.au/bonnie++/experimental/
 EXTRACT_SUFX=	.tgz

Modified: head/benchmarks/bonnie++/files/patch-bonnie++.cpp
==============================================================================
--- head/benchmarks/bonnie++/files/patch-bonnie++.cpp	Mon May 12 06:29:42 2014	(r353773)
+++ head/benchmarks/bonnie++/files/patch-bonnie++.cpp	Mon May 12 06:50:03 2014	(r353774)
@@ -1,8 +1,24 @@
-$FreeBSD$
-
---- bonnie++.cpp.orig	Mon Aug 25 17:08:46 2003
-+++ bonnie++.cpp	Mon Aug 25 17:08:46 2003
-@@ -322,11 +322,7 @@
+--- bonnie++.cpp.orig	2009-07-03 04:38:14.000000000 +0200
++++ bonnie++.cpp	2014-05-10 12:04:25.000000000 +0200
+@@ -73,7 +73,7 @@
+   void set_io_chunk_size(int size)
+     { delete m_buf; pa_new(size, m_buf, m_buf_pa); m_io_chunk_size = size; }
+   void set_file_chunk_size(int size)
+-    { delete m_buf; m_buf = new char[__max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
++    { delete m_buf; m_buf = new char[max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
+ 
+   // Return the page-aligned version of the local buffer
+   char *buf() { return m_buf_pa; }
+@@ -138,7 +138,7 @@
+  , m_buf(NULL)
+  , m_buf_pa(NULL)
+ {
+-  pa_new(__max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
++  pa_new(max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
+   SetName(".");
+ }
+ 
+@@ -294,11 +294,7 @@
        {
          char *sbuf = _strdup(optarg);
          char *size = strtok(sbuf, ":");
@@ -14,7 +30,7 @@ $FreeBSD$
          size = strtok(NULL, "");
          if(size)
          {
-@@ -411,15 +407,6 @@
+@@ -384,17 +380,8 @@
      if(file_size % 1024 > 512)
        file_size = file_size + 1024 - (file_size % 1024);
    }
@@ -27,10 +43,14 @@ $FreeBSD$
 -    usage();
 -  }
 -#endif
-   globals.byte_io_size = __min(file_size, globals.byte_io_size);
-   globals.byte_io_size = __max(0, globals.byte_io_size);
+-  globals.byte_io_size = __min(file_size, globals.byte_io_size);
+-  globals.byte_io_size = __max(0, globals.byte_io_size);
++  globals.byte_io_size = min(file_size, globals.byte_io_size);
++  globals.byte_io_size = max(0, globals.byte_io_size);
  
-@@ -503,14 +490,6 @@
+   if(machine == NULL)
+   {
+@@ -465,14 +452,6 @@
       && (directory_max_size < directory_min_size || directory_max_size < 0
       || directory_min_size < 0) )
      usage();

Modified: head/benchmarks/bonnie++/files/patch-duration.cpp
==============================================================================
--- head/benchmarks/bonnie++/files/patch-duration.cpp	Mon May 12 06:29:42 2014	(r353773)
+++ head/benchmarks/bonnie++/files/patch-duration.cpp	Mon May 12 06:50:03 2014	(r353774)
@@ -1,5 +1,5 @@
---- duration.cpp.orig   2009-08-21 18:45:50.068536643 +0000
-+++ duration.cpp        2009-08-21 18:45:58.564755017 +0000
+--- duration.cpp.orig	2008-12-23 23:26:42.000000000 +0100
++++ duration.cpp	2014-05-10 12:04:40.000000000 +0200
 @@ -1,5 +1,3 @@
 -using namespace std;
 -
@@ -15,3 +15,12 @@
  Duration_Base::Duration_Base()
   : m_start(0.0)
   , m_max(0.0)
+@@ -38,7 +38,7 @@
+   getTime(&tv);
+   double ret;
+   ret = tv - m_start;
+-  m_max = __max(m_max, ret);
++  m_max = max(m_max, ret);
+   return ret;
+ }
+ 

Modified: head/benchmarks/bonnie++/files/patch-port.h.in
==============================================================================
--- head/benchmarks/bonnie++/files/patch-port.h.in	Mon May 12 06:29:42 2014	(r353773)
+++ head/benchmarks/bonnie++/files/patch-port.h.in	Mon May 12 06:50:03 2014	(r353774)
@@ -1,5 +1,5 @@
---- port.h.in.orig	2009-08-21 18:45:50.068536643 +0000
-+++ port.h.in	2009-08-21 18:45:58.564755017 +0000
+--- port.h.in.orig	2008-12-24 01:16:16.000000000 +0100
++++ port.h.in	2014-05-10 12:05:20.000000000 +0200
 @@ -4,12 +4,12 @@
  #include "conf.h"
  
@@ -33,3 +33,12 @@
  
  #if @true_false@
  #define false 0
+@@ -49,8 +42,6 @@
+ #endif
+ 
+ typedef int FILE_TYPE;
+-#define __min min
+-#define __max max
+ typedef unsigned int UINT;
+ typedef unsigned long ULONG;
+ typedef const char * PCCHAR;
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 17 Ganael LAPLANCHE freebsd_committer freebsd_triage 2014-05-12 07:50:33 UTC
State Changed
From-To: open->closed

Committed, thanks!