Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Build QT 5.2.0 on FreeBSD from source
Qt 6.11 is out! See what's new in the release blog

Build QT 5.2.0 on FreeBSD from source

Scheduled Pinned Locked Moved Installation and Deployment
14 Posts 5 Posters 8.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #5

    I did it. But not succesfully – xcb don’t compiling.

    Because someone hardcoded -ldl in xcb's project file. Remove it.
    -ldl is never supposed to be hardcoded in project files, it is supposed
    to be dragged in by the Qmake specs on those platforms that really
    need this library. (There are also platforms where it is named -ldld).

    I don’t know how to solve this ((

    Using that "timezone" variable is a crock anyway. The correct way
    were to use tm_gmtoff from struct tm:

    @
    --- qtbase/src/corelib/tools/qdatetime.cpp~ 2013-12-08 18:09:52.000000000 +0100
    +++ qtbase/src/corelib/tools/qdatetime.cpp 2014-01-12 21:47:45.000000000 +0100
    (at)(at) -2190,6 +2190,13 (at)(at)
    long offset;
    _get_timezone(&offset);
    return offset;
    +#elif defined(__POSIX_VISIBLE) && !defined(__linux)

    •    time_t dummy = (time_t)0;
      
    •    struct tm *p = localtime(&dummy);
      
    •    return -p->tm_gmtoff;   // tm_gmtoff uses positive values east
      
    •                            // of UTC, but historic "timezone"
      
    •                            // variable used positive values west
      
    •                            // of UTC.
      

    #else
    return timezone;
    #endif // Q_OS_WIN
    @

    I also needed an #include <sys/utsname> in order to use
    uname(3) correctly:

    @
    --- qtbase/src/corelib/io/qfileselector.cpp~ 2013-12-08 18:09:53.000000000 +0100
    +++ qtbase/src/corelib/io/qfileselector.cpp 2014-01-13 08:40:52.000000000 +0100
    (at)(at) -51,6 +51,18 (at)(at)
    #include <QtCore/QLocale>
    #include <QtCore/QDebug>

    +#if defined(Q_OS_UNIX)
    +# if defined(Q_OS_LINUX_ANDROID)
    +# elif defined(Q_OS_BLACKBERRY)
    +# elif defined(Q_OS_QNX)
    +# elif defined(Q_OS_IOS)
    +# elif defined(Q_OS_LINUX)
    +# elif defined(Q_OS_MAC)
    +# else
    +# include <sys/utsname.h>
    +# endif
    +#endif
    +
    QT_BEGIN_NAMESPACE

    //Environment variable to allow tooling full control of file selectors
    @

    Still, I didn't succeed completely. My current stop is here:

    @
    /usr/local/qt5/src/qt-everywhere-opensource-src-5.2.0/qtbase/lib/libQt5PlatformSupport.a(qevdevmousemanager.o): In function QEvdevMouseManager::QEvdevMouseManager(QString const&, QString const&, QObject*)': /usr/local/qt5/src/qt-everywhere-opensource-src-5.2.0/qtbase/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp:94: undefined reference to QDeviceDiscovery::create(QFlagsQDeviceDiscovery::QDeviceType, QObject*)'
    @

    (Replace the "(at)" strings in the patches by "at" signs. There
    doesn't appear to be a way to have those signs as part of a code
    block here.)

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dl8dtl
      wrote on last edited by
      #6

      (I dropped my previous account, as my original one has been recovered now.)

      The QDeviceDiscovery stuff requires this patch:

      @
      --- ./qtbase/src/platformsupport/devicediscovery/devicediscovery.pri~ 2013-12-08 18:09:47.000000000 +0100
      +++ ./qtbase/src/platformsupport/devicediscovery/devicediscovery.pri 2014-01-13 13:23:37.000000000 +0100
      (at)(at) -9,4 +9,8 (at)(at)
      } else {
      SOURCES += $$PWD/qdevicediscovery_static.cpp
      }
      +} else:unix {

      • HEADERS += $$PWD/qdevicediscovery_p.h
      • SOURCES += $$PWD/qdevicediscovery_static.cpp
        }
        @

      Next, there's couple of instances where Linux' pthread_getattr_np()
      needs to be replaced by FreeBSD's pthread_attr_get_np():

      @
      --- ./qtdeclarative/src/qml/jsruntime/qv4mm.cpp~ 2013-12-08 18:10:19.000000000 +0100
      +++ ./qtdeclarative/src/qml/jsruntime/qv4mm.cpp 2014-01-13 15:56:20.000000000 +0100
      (at)(at) -67,6 +67,10 (at)(at)
      #include <sys/storage.h> // __tls()
      #endif

      +#if OS(FREEBSD)
      +# include <pthread_np.h>
      +#endif
      +
      QT_BEGIN_NAMESPACE

      using namespace QV4;
      (at)(at) -218,6 +222,16 (at)(at)

      if OS(DARWIN)

       void *st = pthread_get_stackaddr_np(pthread_self());
       m_d->stackTop = static_cast<quintptr *>(st);
      

      +# elif OS(FREEBSD)

      • void* stackBottom = 0;
      • pthread_attr_t attr;
      • pthread_attr_init(&attr);
      • pthread_attr_get_np(pthread_self(), &attr);
      • size_t stackSize = 0;
      • pthread_attr_getstack(&attr, &stackBottom, &stackSize);
      • pthread_attr_destroy(&attr);
      • m_d->stackTop = static_cast<quintptr *>(stackBottom) + stackSize/sizeof(quintptr);

      else

       void* stackBottom = 0;
       pthread_attr_t attr;
      

      @
      and
      @
      --- ./qtdeclarative/src/qml/jsruntime/qv4mm.cpp~ 2013-12-08 18:10:19.000000000 +0100
      +++ ./qtdeclarative/src/qml/jsruntime/qv4mm.cpp 2014-01-13 15:56:20.000000000 +0100
      (at)(at) -67,6 +67,10 (at)(at)
      #include <sys/storage.h> // __tls()
      #endif

      +#if OS(FREEBSD)
      +# include <pthread_np.h>
      +#endif
      +
      QT_BEGIN_NAMESPACE

      using namespace QV4;
      (at)(at) -218,6 +222,16 (at)(at)

      if OS(DARWIN)

       void *st = pthread_get_stackaddr_np(pthread_self());
       m_d->stackTop = static_cast<quintptr *>(st);
      

      +# elif OS(FREEBSD)

      • void* stackBottom = 0;
      • pthread_attr_t attr;
      • pthread_attr_init(&attr);
      • pthread_attr_get_np(pthread_self(), &attr);
      • size_t stackSize = 0;
      • pthread_attr_getstack(&attr, &stackBottom, &stackSize);
      • pthread_attr_destroy(&attr);
      • m_d->stackTop = static_cast<quintptr *>(stackBottom) + stackSize/sizeof(quintptr);

      else

       void* stackBottom = 0;
       pthread_attr_t attr;
      

      @
      Then, there's alloca(), but apparently only ever tested on
      Linux. FreeBSD doesn't have alloca.h but declares it in stdlib.h.
      @
      --- ./qtdeclarative/src/qml/jsruntime/qv4alloca_p.h~ 2013-12-08 18:10:19.000000000 +0100
      +++ ./qtdeclarative/src/qml/jsruntime/qv4alloca_p.h 2014-01-13 16:06:21.000000000 +0100
      (at)(at) -49,6 +49,8 (at)(at)

      ifndef GNUC

      define alloca _alloca

      endif

      +#elif defined(Q_OS_FREEBSD)
      +# include <stdlib.h>
      #else

      include <alloca.h>

      #endif
      @

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dl8dtl
        wrote on last edited by
        #7

        (Have to split the posts to maintain the 6000 char limit.)

        Finally, all the multimedia stuff appears to be written for Linux only.
        There's plenty of #include <linux/something> all over the place. :(
        In order to get it compile at least (it won't make sense at runtime), I
        needed these patches:
        @
        --- ./qtmultimedia/src/gsttools/qgstreamervideoinputdevicecontrol.cpp~ 2013-12-08 18:10:15.000000000 +0100
        +++ ./qtmultimedia/src/gsttools/qgstreamervideoinputdevicecontrol.cpp 2014-01-13 17:52:25.000000000 +0100
        (at)(at) -44,7 +44,9 (at)(at)
        #include <QtCore/QDir>
        #include <QtCore/QDebug>

        -#include <linux/types.h>
        +#ifdef Q_OS_LINUX
        +# include <linux/types.h>
        +#endif
        #include <sys/time.h>
        #include <sys/ioctl.h>
        #include <sys/poll.h>
        (at)(at) -54,7 +56,9 (at)(at)
        #include <string.h>
        #include <stdlib.h>
        #include <sys/mman.h>
        -#include <linux/videodev2.h>
        +#ifdef Q_OS_LINUX
        +# include <linux/videodev2.h>
        +#endif

        QGstreamerVideoInputDeviceControl::QGstreamerVideoInputDeviceControl(QObject *parent)
        :QVideoDeviceSelectorControl(parent), m_selectedDevice(0)
        (at)(at) -110,7 +114,7 (at)(at)
        #ifdef Q_WS_MAEMO_6
        m_names << QLatin1String("primary") << QLatin1String("secondary");
        m_descriptions << tr("Main camera") << tr("Front camera");
        -#else
        +#elif defined(Q_OS_LINUX)
        QDir devDir("/dev");
        devDir.setFilter(QDir::System);

        (at)(at) -151,5 +155,7 (at)(at)
        }
        ::close(fd);
        }
        +#else
        +# warning "QGstreamerVideoInputDeviceControl::update() not implemented on this OS"
        #endif
        }
        --- ./qtmultimedia/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp~ 2013-12-08 18:10:15.000000000 +0100
        +++ ./qtmultimedia/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp 2014-01-13 18:01:59.000000000 +0100
        (at)(at) -44,7 +44,9 (at)(at)
        #include <QtCore/qdebug.h>
        #include <QtCore/qfile.h>

        -#include <linux/types.h>
        +#ifdef Q_OS_LINUX
        +# include <linux/types.h>
        +#endif
        #include <sys/time.h>
        #include <sys/ioctl.h>
        #include <sys/poll.h>
        (at)(at) -54,7 +56,9 (at)(at)
        #include <string.h>
        #include <stdlib.h>
        #include <sys/mman.h>
        -#include <linux/videodev2.h>
        +#ifdef Q_OS_LINUX
        +# include <linux/videodev2.h>
        +#endif

        QT_BEGIN_NAMESPACE
        static inline uint qHash(const QSize& key) { return uint(key.width()*256+key.height()); }
        (at)(at) -98,6 +102,7 (at)(at)

        void QGstreamerV4L2Input::updateSupportedResolutions(const QByteArray &device)
        {
        +#ifdef Q_OS_LINUX
        m_frameRates.clear();
        m_resolutions.clear();
        m_ratesByResolution.clear();
        (at)(at) -270,6 +275,9 (at)(at)

         //qDebug() << "frame rates:" << m_frameRates;
         //qDebug() << "resolutions:" << m_resolutions;
        

        +#else
        +# warning "QGstreamerV4L2Input::updateSupportedResolutions() not implemented on this OS"
        +#endif
        }

        @

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #8

          Hi Jörg,

          Did you considered submitting your patches to the Qt project ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dl8dtl
            wrote on last edited by
            #9

            @
            --- ./qtmultimedia/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp~ 2013-12-08 18:10:15.000000000 +0100
            +++ ./qtmultimedia/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp 2014-01-13 18:04:29.000000000 +0100
            (at)(at) -51,7 +51,9 (at)(at)
            #include "qgstreamercaptureservice.h"
            #include <private/qgstutils_p.h>

            -#include <linux/types.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/types.h>
            +#endif
            #include <sys/time.h>
            #include <sys/ioctl.h>
            #include <sys/poll.h>
            (at)(at) -61,7 +63,9 (at)(at)
            #include <string.h>
            #include <stdlib.h>
            #include <sys/mman.h>
            -#include <linux/videodev2.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/videodev2.h>
            +#endif
            #include <gst/gst.h>

            QMediaService* QGstreamerCaptureServicePlugin::create(const QString &key)
            (at)(at) -131,6 +135,7 (at)(at)

            void QGstreamerCaptureServicePlugin::updateDevices() const
            {
            +#ifdef Q_OS_LINUX
            m_cameraDevices.clear();
            m_cameraDescriptions.clear();

            (at)(at) -174,6 +179,9 (at)(at)
            }
            ::close(fd);
            }
            +#else
            +# warning "QGstreamerCaptureServicePlugin::updateDevices() not implemented on this OS"
            +#endif
            }
            #endif

            --- ./qtmultimedia/src/plugins/gstreamer/camerabin/camerabincontrol.cpp~ 2013-12-08 18:10:15.000000000 +0100
            +++ ./qtmultimedia/src/plugins/gstreamer/camerabin/camerabincontrol.cpp 2014-01-13 18:13:59.000000000 +0100
            (at)(at) -50,7 +50,9 (at)(at)
            #include <QtCore/qfile.h>
            #include <QtCore/qmetaobject.h>

            -#include <linux/types.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/types.h>
            +#endif
            #include <sys/time.h>
            #include <sys/ioctl.h>
            #include <sys/poll.h>
            (at)(at) -60,7 +62,9 (at)(at)
            #include <string.h>
            #include <stdlib.h>
            #include <sys/mman.h>
            -#include <linux/videodev2.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/videodev2.h>
            +#endif

            QT_BEGIN_NAMESPACE

            --- ./qtmultimedia/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp~ 2013-12-08 18:10:15.000000000 +0100
            +++ ./qtmultimedia/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp 2014-01-13 18:12:20.000000000 +0100
            (at)(at) -50,7 +50,9 (at)(at)
            #include "camerabinservice.h"
            #include <private/qgstutils_p.h>

            -#include <linux/types.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/types.h>
            +#endif
            #include <sys/time.h>
            #include <sys/ioctl.h>
            #include <sys/poll.h>
            (at)(at) -60,7 +62,9 (at)(at)
            #include <string.h>
            #include <stdlib.h>
            #include <sys/mman.h>
            -#include <linux/videodev2.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/videodev2.h>
            +#endif
            #include <gst/gst.h>

            QT_BEGIN_NAMESPACE
            (at)(at) -126,6 +130,7 (at)(at)

            void CameraBinServicePlugin::updateDevices() const
            {
            +#ifdef Q_OS_LINUX
            m_cameraDevices.clear();
            m_cameraDescriptions.clear();

            (at)(at) -167,6 +172,9 (at)(at)
            }
            ::close(fd);
            }
            +#else
            +# warning "CameraBinServicePlugin::updateDevices() not implemented on this OS"
            +#endif
            }

            QT_END_NAMESPACE
            --- ./qtmultimedia/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp~ 2013-12-08 18:10:15.000000000 +0100
            +++ ./qtmultimedia/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp 2014-01-13 17:56:57.000000000 +0100
            (at)(at) -49,7 +49,9 (at)(at)
            #include <QtCore/QDir>
            #include <QtCore/QDebug>

            -#include <linux/types.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/types.h>
            +#endif
            #include <sys/time.h>
            #include <sys/ioctl.h>
            #include <sys/poll.h>
            (at)(at) -59,7 +61,9 (at)(at)
            #include <string.h>
            #include <stdlib.h>
            #include <sys/mman.h>
            -#include <linux/videodev2.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/videodev2.h>
            +#endif
            #include <gst/gst.h>

            // #define QT_SUPPORTEDMIMETYPES_DEBUG
            --- ./qtmultimedia/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp~ 2013-12-08 18:10:15.000000000 +0100
            +++ ./qtmultimedia/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp 2014-01-13 18:09:30.000000000 +0100
            (at)(at) -51,7 +51,9 (at)(at)
            #include "qgstreamerplayerservice.h"
            #include <private/qgstutils_p.h>

            -#include <linux/types.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/types.h>
            +#endif
            #include <sys/time.h>
            #include <sys/ioctl.h>
            #include <sys/poll.h>
            (at)(at) -61,7 +63,9 (at)(at)
            #include <string.h>
            #include <stdlib.h>
            #include <sys/mman.h>
            -#include <linux/videodev2.h>
            +#ifdef Q_OS_LINUX
            +# include <linux/videodev2.h>
            +#endif
            #include <gst/gst.h>

            @

            With all that, I got it to compile. Alas, 1 GB of my datasegment size is too
            small to link it. :-( I'm afraid I have to reboot now ...

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dl8dtl
              wrote on last edited by
              #10

              [quote author="SGaist" date="1389648894"]Hi Jörg,

              Did you considered submitting your patches to the Qt project ?[/quote]

              Will certainly do, but I'd like to get it working for me, first.

              By posting it here, I was in hope to catch the attraction of some
              other FreeBSD developers before ...

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #11

                A central place to retrieve your patch would be a good idea then. Fellow developers could then jump in to help

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dl8dtl
                  wrote on last edited by
                  #12

                  [quote author="SGaist" date="1389650189"]A central place to retrieve your patch would be a good idea then.[/quote]

                  I'll review the patch before, and upload it onto my web server.

                  But now it's close to midnight here, time to fall asleep.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    stephane78
                    wrote on last edited by
                    #13
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      stephane78
                      wrote on last edited by
                      #14
                      This post is deleted!
                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved