On Sun, 25 Aug 2019 15:20:01 -0600
Theo de Raadt wrote:

> I suspect the question is why is it getting the max() macro.  is it
> getting from sys/param.h?  Does some code have an #ifdef which pulls
> sys/param.h on some platforms or not others?

I used eg++ -M to see which headers are pulled, and sys/param.h does
not appear. I also used '-dD -E' to no avail - actually min and max are
undef'd by bits/c++config.h.

Even working against a way simpler port that has this issue
(games/xevil) didn't bring something interesting.

base-gcc and base-clang c++ STL use a similar definition of max() and
min(), so it works. ports-gcc uses an inlined version instead. That's
the only difference i've seen.

As such, i have no clue about what is going on.

> If this is from sys/param.h, I would suggest finding out why and
> stopping that practice.  I think all systems still have it in
> sys/param.h which is why I suspect someone has an #ifdef to get at
> something else in the file, and therefore causing this problem
> 
> Charlene Wendling <juliana...@posteo.jp> wrote:
> 
> > 
> > 
> > > http://build-failures.rhaalovely.net/sparc64/2019-08-21/x11/kde4/krfb.log
> > > http://build-failures.rhaalovely.net/powerpc/2019-08-09/x11/kde4/krfb.log
> > 
> > We've 3 issues here:
> > 
> > - a typical max() macro clash in the bundled libvncviewer. I did it
> > the harsh way, upstream has a different fix, but it has a bigger
> > footprint on the codebase [0]
> > - there was an occurrence where FALSE and TRUE were undefined, so i 
> >   redefined them. Looks like clang and gcc approaches are different
> > on that matter.
> > - headers must be placed as defined in style(9) in various places,
> >   otherwise some variables/functions are undefined, heavily
> > inspired by how Debian did it [1].
> > 
> > While here i've moved HOMEPAGE to https.
> > 
> > It builds fine on macppc [2] and amd64. The runtime is also good on 
> > these two platforms.
> > 
> > Comments/feedback are welcome :)
> > 
> > Charl??ne.
> > 
> > 
> > [0]
> > https://github.com/LibVNC/libvncserver/commit/785f0fa2d1fe18f08bf521ed4a0d34a5d0c87782
> > [1]
> > https://sources.debian.org/patches/krfb/4:17.08.3-1/build_against_gcc-6.patch/
> > [2] https://bin.charlenew.xyz/krfb.log
> > 
> > 
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/x11/kde4/krfb/Makefile,v
> > retrieving revision 1.9
> > diff -u -p -u -p -r1.9 Makefile
> > --- Makefile        27 Jun 2018 21:04:17 -0000      1.9
> > +++ Makefile        25 Aug 2019 20:35:56 -0000
> > @@ -2,10 +2,10 @@
> >  
> >  COMMENT =  desktop sharing
> >  DISTNAME = krfb-${MODKDE4_VERSION}
> > -REVISION = 4
> > +REVISION = 5
> >  
> >  CATEGORIES =       net
> > -HOMEPAGE =
> > http://projects.kde.org/projects/kde/kdenetwork/krfb +HOMEPAGE
> > =   https://userbase.kde.org/Krfb 
> >  SHARED_LIBS =      krfbprivate             52.0
> >  
> > Index: patches/patch-krfb_events_cpp
> > ===================================================================
> > RCS file: patches/patch-krfb_events_cpp
> > diff -N patches/patch-krfb_events_cpp
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-krfb_events_cpp   25 Aug 2019 20:35:56 -0000
> > @@ -0,0 +1,25 @@
> > +$OpenBSD$
> > +
> > +Fix for ports-gcc>=6
> > +
> > +Index: krfb/events.cpp
> > +--- krfb/events.cpp.orig
> > ++++ krfb/events.cpp
> > +@@ -22,8 +22,6 @@
> > +    Boston, MA 02110-1301, USA.
> > + */
> > + 
> > +-#include "events.h"
> > +-
> > + #include <QtGui/QApplication>
> > + #include <QtGui/QX11Info>
> > + #include <QtGui/QDesktopWidget>
> > +@@ -32,6 +30,8 @@
> > + #include <X11/Xutil.h>
> > + #include <X11/keysym.h>
> > + #include <X11/extensions/XTest.h>
> > ++
> > ++#include "events.h"
> > + 
> > + enum {
> > +     LEFTSHIFT = 1,
> > Index: patches/patch-krfb_framebuffer_h
> > ===================================================================
> > RCS file: patches/patch-krfb_framebuffer_h
> > diff -N patches/patch-krfb_framebuffer_h
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-krfb_framebuffer_h        25 Aug 2019 20:35:56
> > -0000 @@ -0,0 +1,24 @@
> > +$OpenBSD$
> > +Fix for ports-gcc>=6
> > +
> > +Index: krfb/framebuffer.h
> > +--- krfb/framebuffer.h.orig
> > ++++ krfb/framebuffer.h
> > +@@ -10,8 +10,6 @@
> > + #ifndef FRAMEBUFFER_H
> > + #define FRAMEBUFFER_H
> > + 
> > +-#include "rfb.h"
> > +-
> > + #include <kdemacros.h>
> > + 
> > + #include <QtCore/QObject>
> > +@@ -19,6 +17,8 @@
> > + #include <QtCore/QList>
> > + 
> > + #include <QtGui/QWidget>
> > ++
> > ++#include "rfb.h"
> > + 
> > + class FrameBuffer;
> > + /**
> > Index: patches/patch-krfb_invitationsrfbclient_cpp
> > ===================================================================
> > RCS file: patches/patch-krfb_invitationsrfbclient_cpp
> > diff -N patches/patch-krfb_invitationsrfbclient_cpp
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-krfb_invitationsrfbclient_cpp     25 Aug 2019
> > 20:35:56 -0000 @@ -0,0 +1,28 @@
> > +$OpenBSD$
> > +Fix for ports-gcc>=6
> > +
> > +Index: krfb/invitationsrfbclient.cpp
> > +--- krfb/invitationsrfbclient.cpp.orig
> > ++++ krfb/invitationsrfbclient.cpp
> > +@@ -18,16 +18,17 @@
> > +     You should have received a copy of the GNU Lesser General
> > Public License
> > +     along with this program.  If not, see
> > <http://www.gnu.org/licenses/>.
> > + */
> > ++#include <KNotification>
> > ++#include <KLocale>
> > ++#include <QtCore/QSocketNotifier>
> > ++#include <poll.h>
> > ++
> > + #include "rfb.h"
> > + #include "invitationsrfbclient.h"
> > + #include "invitationsrfbserver.h"
> > + #include "krfbconfig.h"
> > + #include "sockethelpers.h"
> > + #include "connectiondialog.h"
> > +-#include <KNotification>
> > +-#include <KLocale>
> > +-#include <QtCore/QSocketNotifier>
> > +-#include <poll.h>
> > + 
> > + struct PendingInvitationsRfbClient::Private
> > + {
> > Index: patches/patch-krfb_invitationsrfbserver_cpp
> > ===================================================================
> > RCS file: patches/patch-krfb_invitationsrfbserver_cpp
> > diff -N patches/patch-krfb_invitationsrfbserver_cpp
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-krfb_invitationsrfbserver_cpp     25 Aug 2019
> > 20:35:56 -0000 @@ -0,0 +1,28 @@
> > +$OpenBSD$
> > +Fix for ports-gcc>=6
> > +
> > +Index: krfb/invitationsrfbserver.cpp
> > +--- krfb/invitationsrfbserver.cpp.orig
> > ++++ krfb/invitationsrfbserver.cpp
> > +@@ -18,10 +18,6 @@
> > +     You should have received a copy of the GNU Lesser General
> > Public License
> > +     along with this program.  If not, see
> > <http://www.gnu.org/licenses/>.
> > + */
> > +-#include "invitationsrfbserver.h"
> > +-#include "invitationsrfbclient.h"
> > +-#include "krfbconfig.h"
> > +-#include "rfbservermanager.h"
> > + #include <QtCore/QTimer>
> > + #include <QtGui/QApplication>
> > + #include <QtNetwork/QHostInfo>
> > +@@ -33,6 +29,10 @@
> > + #include <KStringHandler>
> > + #include <KWallet/Wallet>
> > + #include <DNSSD/PublicService>
> > ++#include "invitationsrfbserver.h"
> > ++#include "invitationsrfbclient.h"
> > ++#include "krfbconfig.h"
> > ++#include "rfbservermanager.h"
> > + using KWallet::Wallet;
> > + 
> > + //static
> > Index: patches/patch-krfb_rfbclient_cpp
> > ===================================================================
> > RCS file: patches/patch-krfb_rfbclient_cpp
> > diff -N patches/patch-krfb_rfbclient_cpp
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-krfb_rfbclient_cpp        25 Aug 2019 20:35:56
> > -0000 @@ -0,0 +1,28 @@
> > +$OpenBSD$
> > +Fix for ports-gcc>=6
> > +
> > +Index: krfb/rfbclient.cpp
> > +--- krfb/rfbclient.cpp.orig
> > ++++ krfb/rfbclient.cpp
> > +@@ -17,16 +17,16 @@
> > +     You should have received a copy of the GNU Lesser General
> > Public License
> > +     along with this program.  If not, see
> > <http://www.gnu.org/licenses/>.
> > + */
> > +-#include "rfbclient.h"
> > +-#include "connectiondialog.h"
> > +-#include "krfbconfig.h"
> > +-#include "sockethelpers.h"
> > +-#include "events.h"
> > + #include <QtCore/QSocketNotifier>
> > + #include <KDebug>
> > + #include <KNotification>
> > + #include <poll.h>
> > + #include <strings.h> //for bzero()
> > ++#include "rfbclient.h"
> > ++#include "connectiondialog.h"
> > ++#include "krfbconfig.h"
> > ++#include "sockethelpers.h"
> > ++#include "events.h"
> > + 
> > + struct RfbClient::Private
> > + {
> > Index: patches/patch-krfb_rfbserver_cpp
> > ===================================================================
> > RCS file: patches/patch-krfb_rfbserver_cpp
> > diff -N patches/patch-krfb_rfbserver_cpp
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-krfb_rfbserver_cpp        25 Aug 2019 20:35:56
> > -0000 @@ -0,0 +1,26 @@
> > +$OpenBSD$
> > +Fix for ports-gcc>=6
> > +
> > +Also redefine TRUE and FALSE, that are getting undef'd in rfb.h
> > +
> > +Index: krfb/rfbserver.cpp
> > +--- krfb/rfbserver.cpp.orig
> > ++++ krfb/rfbserver.cpp
> > +@@ -17,12 +17,15 @@
> > +     You should have received a copy of the GNU Lesser General
> > Public License
> > +     along with this program.  If not, see
> > <http://www.gnu.org/licenses/>.
> > + */
> > +-#include "rfbserver.h"
> > +-#include "rfbservermanager.h"
> > + #include <QtCore/QSocketNotifier>
> > + #include <QApplication>
> > + #include <QClipboard>
> > + #include <KDebug>
> > ++#include "rfbserver.h"
> > ++#include "rfbservermanager.h"
> > ++
> > ++#define TRUE true
> > ++#define FALSE false
> > + 
> > + struct RfbServer::Private
> > + {
> > Index: patches/patch-krfb_rfbservermanager_cpp
> > ===================================================================
> > RCS file: patches/patch-krfb_rfbservermanager_cpp
> > diff -N patches/patch-krfb_rfbservermanager_cpp
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-krfb_rfbservermanager_cpp 25 Aug 2019
> > 20:35:56 -0000 @@ -0,0 +1,32 @@
> > +$OpenBSD$
> > +Fix for ports-gcc>=6
> > +
> > +Index: krfb/rfbservermanager.cpp
> > +--- krfb/rfbservermanager.cpp.orig
> > ++++ krfb/rfbservermanager.cpp
> > +@@ -18,12 +18,6 @@
> > +     You should have received a copy of the GNU Lesser General
> > Public License
> > +     along with this program.  If not, see
> > <http://www.gnu.org/licenses/>.
> > + */
> > +-#include "rfbservermanager.h"
> > +-#include "rfbserver.h"
> > +-#include "framebuffer.h"
> > +-#include "framebuffermanager.h"
> > +-#include "sockethelpers.h"
> > +-#include "krfbconfig.h"
> > + #include <QtCore/QTimer>
> > + #include <QtGui/QApplication>
> > + #include <QtGui/QDesktopWidget>
> > +@@ -33,6 +27,12 @@
> > + #include <KLocale>
> > + #include <KUser>
> > + #include <KNotification>
> > ++#include "rfbservermanager.h"
> > ++#include "rfbserver.h"
> > ++#include "framebuffer.h"
> > ++#include "framebuffermanager.h"
> > ++#include "sockethelpers.h"
> > ++#include "krfbconfig.h"
> > + 
> > + static const char *cur =
> > +     "                   "
> > Index: patches/patch-libvncserver_rfb_rfbproto_h
> > ===================================================================
> > RCS file: patches/patch-libvncserver_rfb_rfbproto_h
> > diff -N patches/patch-libvncserver_rfb_rfbproto_h
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-libvncserver_rfb_rfbproto_h       25 Aug 2019
> > 20:35:56 -0000 @@ -0,0 +1,19 @@
> > +$OpenBSD$
> > +
> > +ports-gcc fix for:
> > +error: macro "max" passed 3 arguments, but takes just 2
> > +
> > +Index: libvncserver/rfb/rfbproto.h
> > +--- libvncserver/rfb/rfbproto.h.orig
> > ++++ libvncserver/rfb/rfbproto.h
> > +@@ -90,6 +90,10 @@
> > + #define strncasecmp _strnicmp
> > + #endif
> > + 
> > ++#ifdef max
> > ++#undef max
> > ++#endif
> > ++
> > + #if !defined(WIN32) || defined(__MINGW32__)
> > + #define max(a,b) (((a)>(b))?(a):(b))
> > + #ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
> > 
> 

Reply via email to