C++ Is it possible to statically compile Qt 5.6 on FreeBSD?

Hello guys,

I wrote a simple application on Qt 5.6 (I use this specific version because it's working on old Linux and Windows versions too). I already done static compilation for Linux and Windows, and now trying to build it for BSD systems and didn't succeed.

My aim is to create fully statical build which help me to create portable GUI application for BSD systems with desktop (FreeBSD and GhostBSD, for example). Since I'm newbie to BSD systems, it's quite difficult for me.

What I did (on FreeBSD 14.0):

Code:
pkg install git gcc9

ln -s /usr/local/bin/gcc9 /usr/local/bin/gcc
ln -s /usr/local/bin/g++9 /usr/local/bin/g++

pkg install perl5-5.36.3_1
pkg install -g libxcb* libX11*

git clone -b 5.6 https://code.qt.io/qt/qt5.git
mv qt5 Qt-5.6
cd Qt-5.6
git clone -b 5.6 https://code.qt.io/qt/qtbase.git

./configure -prefix "/usr/local/Qt-5.6-release" -static -platform freebsd-g++ -release -opensource -confirm-license -fontconfig -system-freetype -no-cups -no-dbus -no-gif -no-iconv -no-icu -no-opengl -no-openssl -no-openvg -no-qml-debug -no-sql-sqlite -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-xcb -qt-xkbcommon-x11 -qt-zlib -nomake examples -nomake tests

make

So, when I use latest GCC version (probably it's 12), I got an error:
Code:
sorry, unimplemented: PCH allocation failure
When I use other GCC versions (from 4.8 to 10) I have an error:
Code:
internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report, with preprocessed source if appropriate.

Questions:
1) Is it possible to compile Qt 5.6 (or other versions) on FreeBSD without any source code fixing?
2) If answer to previous question is Yes. Probably now I need to switch to ports and try to build all requirements myself? If so, do I need to switch to specific quarterly branch on ports?
3) Maybe there are some ways to statically compile Qt apps on FreeBSD on other Qt version compatible with Qt 5? If so, I can consider building on another version.

I would be happy to get any advices. Thanks!
 
Well, thank you gpatrick! According to the description of the ticket related to PCH, it's an optional feature and could be disabled. So, I found that Qt configure script has "-no-pch" option and used it, and now everything works fine.

Hence, the final configure string looks like this:

./configure -prefix "/usr/local/Qt-5.6-release" -static -platform freebsd-g++ -release -opensource -confirm-license -fontconfig -system-freetype -no-cups -no-dbus -no-gif -no-iconv -no-icu -no-opengl -no-openssl -no-openvg -no-pch -no-qml-debug -no-sql-sqlite -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-xcb -qt-xkbcommon-x11 -qt-zlib -nomake examples -nomake tests -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtconnectivity -skip qtdeclarative -skip qtdoc -skip qtdocgallery -skip qtenginio -skip qtfeedback -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtpim -skip qtpurchasing -skip qtqa -skip qtquick1 -skip qtquickcontrols -skip qtquickcontrols2 -skip qtrepotools -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtsvg -skip qtsystems -skip qttools -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebkit -skip qtwebkit-examples -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras -skip qtxmlpatterns


P.S.: Also I installed Xfce, because it's easier to work in GUI. And maybe during the configuration Qt used some libs, which was installed as a requirements for Xfce. So I'm not sure, whether requirements of installing libxcb* libX11* is enough for building Qt or not.
 
Back
Top