Building QT6.4 on Ubuntu 22.04

I installed required packages:

sudo apt install build-essential
sudo apt install libx11-dev
sudo apt install ninja-build
sudo apt install openssl libssl-dev
sudo apt install libmd4c-dev libmd4c-html0-dev
sudo apt install pkg-config
sudo apt install mesa-utils libglu1-mesa-dev freeglut3-dev mesa-common-dev
sudo apt install libglew-dev libglfw3-dev libglm-dev
sudo apt install libao-dev libmpg123-dev
(more…)

Building QT6.4 with qttranslation module for Windows

I was able to successfully build QT6.4 for Windows with skipped qttranslation and qttools modules. But if I do not skip them and configure QT as follows:

"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64
    
set "CMAKE_ROOT=C:\dev\PFiles\cmake-3.24.0-rc4-windows-x86_64\bin"
set "NINJA_ROOT=C:\dev\PFiles\ninja-win"
set "PERL_ROOT=C:\dev\PFiles\Strawberry\perl\bin"
    
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=C:\dev\PFiles\Python35;%PATH%
    
rem Check if the tools are in PATH
where perl.exe
where python.exe
where cmake.exe
where ninja.exe
    
set MY_QT_SRC_DIR=C:\dev\repos\qt-everywhere-src-6.4.0
set "MY_INSTALL_PATH=C:/dev/libs/Qt6.4/windows"
set CL=/MP

%MY_QT_SRC_DIR%\configure.bat -prefix %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 -debug-and-release -force-debug-info -platform win32-msvc -opensource -confirm-license ^
  -c++std c++20 -static -static-runtime -I "C:/Program Files/OpenSSL/include" -L "C:/Program Files/OpenSSL/lib" -openssl-linked ^
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^
  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland ^
  -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qtquick3dphysics -skip qtspeech
(more…)

Specialization of parameterless template function in C++

At least this compiles and works:

#include <iostream>
#include <memory>
#include <string>

template <class T>
std::shared_ptr<T> make_instance();

template <class T> requires std::is_default_constructible_v<T>
std::shared_ptr<T> make_instance()
{
    return std::make_shared<T>();
}
(more…)

How I fixed my contact form

When I switched to PHP 7.4 I forgot to specify sendmail_path parameter in php.ini and my contact form stopped working. Today I found sendmail_path parameter in PHP 7.0:

cd /etc/php
find . -name "php.ini"
./7.0/fpm/php.ini
./7.0/cgi/php.ini
./7.0/cli/php.ini
./7.4/fpm/php.ini
./7.4/cli/php.ini
grep sendmail ./7.0/fpm/php.ini
sendmail_path = "/usr/sbin/sendmail -t -f *****@yandex.ru -i"
(more…)

Building QT6.4 with OpenSSL for Windows – iteration #1

I build it with similar commands as I used before for Building QT 6.3.1 with OpenSSL for Windows. The only difference was that I added -static-runtime option and skipped qtquick3dphysics and qtspeech modules:

"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64
   
set "CMAKE_ROOT=C:\dev\PFiles\cmake-3.24.0-rc4-windows-x86_64\bin"
set "NINJA_ROOT=C:\dev\PFiles\ninja-win"
set "PERL_ROOT=C:\dev\PFiles\Strawberry\perl\bin"
   
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=C:\dev\PFiles\Python35;%PATH%
   
rem Check if the tools are in PATH
where perl.exe
where python.exe
where cmake.exe
where ninja.exe
   
set "MY_INSTALL_PATH=C:/dev/libs/Qt6.4/windows"
set CL=/MP
 
configure.bat -prefix %MY_INSTALL_PATH% -DQT_NO_EXCEPTIONS=1 -debug-and-release -force-debug-info -platform win32-msvc -opensource -confirm-license ^
-c++std c++20 -static -static-runtime -I "C:/Program Files/OpenSSL/include" -L "C:/Program Files/OpenSSL/lib" -openssl-linked ^
  -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts -skip qtcoap -skip qtconnectivity ^
  -skip qtdatavis3d -skip qtdoc -skip qtlottie -skip qtmqtt -skip qtnetworkauth -skip qtopcua ^
  -skip qtserialport -skip qtpositioning -skip qtquicktimeline -skip qtquick3d -skip qtremoteobjects ^
  -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtvirtualkeyboard -skip qtwayland ^
  -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qttools -skip qttranslations -skip qtquick3dphysics -skip qtspeech
(more…)

Converting WAV files with Sox

Source file:

soxi short-borrowed-old.wav
Input File     : 'short-borrowed-old.wav' (flac)
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:00.60 = 26460 samples = 45 CDDA sectors
File Size      : 54.0k
Bit Rate       : 720k
Sample Encoding: 16-bit FLAC
Comment        : 'Comment=Processed by SoX'
(more…)

Throwing an exception from a function parameter in C++

There is no difference between lines 82 and 92 in the code below with both MSVC2022 and GCC11:

#include <utility>
#include <stdexcept>
#include <iostream>

struct Object
{
    virtual const char* name() = 0;

    virtual ~Object() = default;
};

struct A : public Object
{
    const char* name() override
    {
        return "A";
    }
};
(more…)

The rule of three/five/zero in C++

Using std::shared_ptr in QML

QT is developed by an alien civilization that hate humans. They can’t make std::shared_ptr work in QML since 2014:

(more…)

static_cast can’t convert from a virtual base class in C++

It converts only from non-virtual base class subobject:

struct B
{
    virtual ~B() {};
};

struct D : public virtual B { };

int main()
{
    D d;
    B& br1 = d;

    // cannot convert a 'B*' to a 'D*'; conversion from a virtual base class is implied
    // static_cast<D&>(br1); 

    dynamic_cast<D&>(br1);

    return 0;
}