Build qt source in Fedora35

Extract qt-everywhere-src-6.2.2.zip to directory named qt,

sudo dnf install libxcb libxcb-devel xcb-util xcb-util-devel xcb-util-*-devel libX11-devel libXrender-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libdrm-devel libXcursor-devel libXcomposite-devel

cd qt
mkdir bld
cd bld
cmake -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/installed -DCMAKE_BUILD_TYPE="Debug" ..
cmake --build . --parallel
cmake --install . --prefix=`pwd`/installed

Can't locate English.pm in @INC

sudo dnf install perl-English

This application failed to start because no Qt platform plugin could be init...

If "xcb" things missing, we should "dnf install libxcb..." like above, and an annoying step we can't image is after we install required packages, we must delete CMakeCache.txt first and then to invoke cmake, if not, some modules like xcb-sm are always displayed not to be built.

Feature accessibility_atspi_bridge is already defined to be "OFF" and should now be set to "ON" when importing features from Qt6::Gui.

We only need to not let the message interrupt building progress,

/mnt/SDC2/qt/bld/installed/lib/cmake/Qt6/QtFeature.cmake:1136

	message(STATUS "Feature ${feature} is already defined to be \"${QT_FEATURE_${feature}}\" and should now be set to \"${value}\" when importing features from ${target}.")

refer to:
https://download.qt.io/official_releases/qtcreator/6.0/6.0.1/qt-creator-opensource-linux-x86_64-6.0.1.run
https://wiki.qt.io/Building_Qt_5_from_Git#Linux.2FX11
https://forum.qt.io/topic/121386/built-qt6-from-sources-problem-with-xcb-plugin/15
https://forum.qt.io/topic/128887/build-qt6-from-source-xcb-issue/3
https://forum.qt.io/topic/92834/configure-errors-disabling-x11-accessibility-bridge-d-bus-or-at-spi-is-missing/7

Debug ue4 in Fedora35

After running Setup.sh and GenerateProjectFiles.sh, we found UE4.pro created. It's like a fresh breeze coming from the roof window, we are free now, no more need to fear the once unbearable torment in Visual Studio IDE.

Qt source is not necessary to ue4, qtcreator is only a visual debugger to ue4.

Build Steps:

1
make UE4Editor-Linux-Debug ShaderCompileWorker-Linux-Debug -j8

Clean Steps:

1
make UE4Editor-Linux-Debug ShaderCompileWorker-Linux-Debug ARGS=-clean -j8

refer to:
https://docs.unrealengine.com/4.27/en-US/SharingAndReleasing/Linux/BeginnerLinuxDeveloper/SettingUpQtCreator/

Build virtualbox in fedora35

Download VirtualBox source and extract it to /home/work/vb/VirtualBox-6.1.32.

Involve qt,

# read in ./configure
#	for q in $QT5DIR "$DEVDIR/linux.$TARGET_MACHINE"/qt/v5.*; do
# so download qt5.9.2 and install to /home/work/qt/Qt5.9.2
wget http://download.qt.io/archive/qt/5.9/5.9.2/qt-opensource-linux-x64-5.9.2.run
# make a link to qt5.9.2
cd /home/work/vb/VirtualBox-6.1.32/tools/linux.amd64
mkdir qt
ln -s /home/work/qt/Qt5.9.2/5.9.2/gcc_64 `pwd`/qt/v5.9.2

Build it,

# must add '--skip-broken', or else our fedora os will be mute curiously, suddenly
# in the subsequent experience.
yum install gcc-c++ subversion subversion-gnome kernel-devel which tar gzip bzip2 \
  doxygen mscgen wine-core \
  glibc-devel libcap-devel libcurl-devel libIDL-devel \
  libstdc++-static libxslt-devel libvpx-devel libXmu-devel \
  pam-devel pulseaudio-libs-devel python-devel qt-devel rpm-build SDL_ttf-devel \
  SDL-static device-mapper-devel glibc-static zlib-static \
  glibc-devel.i686 libstdc++.i686 pulseaudio \
  texlive texlive-latex texlive-latex-bin texlive-ec \
  texlive-collection-fontsrecommended texlive-pdftex-def texlive-fancybox texlive-tabulary \
  libpng-devel openssl-devel acpica-tools opus opus-devel --skip-broken

# in addition to offical prerequisites
yum install python3-devel libXcursor-devel libXinerama-devel libXrandr-devel alsa-lib-devel makeself yasm

cd /home/work/vb/VirtualBox-6.1.32

# modify ./configure
#SUPPYTHONLIBS="python3.10 python2.7 ..."

# RTAssertShouldPanic error: this statement may fall through [-Werror=implicit-fallthrough=]
# modify ./Config.kmk
# uncomment below line
#VBOX_WITH_TESTCASES = 1

./configure --disable-hardening --disable-docs --disable-java
source ./env.sh
kmk BUILD_TYPE=debug -j 1

how to run,

cd out/linux.x86/release/bin/src
make
sudo make install

#sign generated vbox kernel modules

cd ..
export LD_LIBRARY_PATH=/home/work/qt/Qt5.9.2/5.9.2/gcc_64/lib:LD_LIBRARY_PATH
./VirtualBox

VERR_VM_DRIVER_NOT_ACCESSIBLE?

chmod ugo+rw /dev/vboxdrv

The VM session was aborted?

Maybe we forgot load vboxnetadp and vboxnetflt,

#modprobe vboxdrv
#modprobe vboxnetadp
#modprobe vboxnetflt

or the shared folder locates in U-disk but we have not mounted it.

Where to get guest additions iso?

http://download.virtualbox.org/virtualbox/6.1.32/VBoxGuestAdditions_6.1.32.iso

But why my Fedora os often drops dead?

What can make system dead must be that the modules we insert to kernel have problem.

The correct way to insert modules is that we should install official bundle first which will insert an configuation file in /etc/udev, modify /etc/udev/rules.d/60-vboxdrv.rules, give current user read and write permission and reboot system that will effect the rule. Then install the vbox*.ko we built.

refer to:
https://www.virtualbox.org/wiki/Downloads
https://download.virtualbox.org/virtualbox
How to sign module
https://www.virtualbox.org/wiki/Linux%20build%20instructions
https://blog.csdn.net/u013004700/article/details/81943881
https://www.linuxidc.com/Linux/2008-05/13132.htm

avoid rebuilding all in vs2010 everytime

  1. remove all nonexisted files in vs2010 project tree view by double clicking one by one.
  2. remove readonly attributes of file in explorer project directory recursively.
  3. reset all modify times to recent by

    1
    
    find . | xargs touch {}
  4. reboot system.

UE4 Shader源码编译过程

在主程序里拼成一个文件WorkerInputOnly.in后启动ShaderCompileWorker.exe进程编译shader源码。以下是调试时记录下来的命令行

D:/ue/Engine/Binaries/Win64/ShaderCompileWorker.exe "C:/Users/euhat/AppData/Local/Temp/UnrealShaderWorkingDir/A1AF8D424B2A34C30CE4378EDE6A0EFB/2/" 14492 2 WorkerInputOnly.in WorkerOutputOnly.out -communicatethroughfile  -TimeToLive=20.000000 -Multiprocess

compile ofp over dpdk in vmware

1. get software

1
2
git libtool automake build-essential pkg-config libssl-dev doxygen libconfig-dev libnuma-dev libpcap-dev net-tools
ln -s /usr/bin/python3 /usr/bin/python

2. compile dpdk

1
git clone http://dpdk.org/git/dpdk-stable --branch 19.11 --depth 1 dpdk-19.11

run dpdk-19.11/usertools/dpdk-setup.sh
>>> select and run "x86_64-native-linuxapp-gcc"
>>> Exit Script

3. compile odp-dpdk

1
git clone https://github.com/OpenDataPlane/odp-dpdk.git

odp-dpdk/m4/odp_dpdk.m4

1
2
3
4
5
6
7
8
9
10
11
12
13
# _ODP_DPDK_LEGACY(PATH, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
# ------------------------------------------------------------------------
# Locate DPDK installation
AC_DEFUN([_ODP_DPDK_LEGACY], [dnl
    DPDK_CFLAGS="-isystem $1/include"
    DPDK_LIB_PATH="$1/lib"
    DPDK_LDFLAGS="-L$DPDK_LIB_PATH"
    AS_IF([test -r "$DPDK_LIB_PATH"/libdpdk.so], [dnl
        DPDK_RPATH="-Wl,-rpath,$DPDK_LIB_PATH"
        DPDK_RPATH_LT="-R$DPDK_LIB_PATH"
        DPDK_SHARED=yes],
        [test ! -r "$DPDK_LIB_PATH"/libdpdk.a], [dnl
        AC_MSG_FAILURE([Could not find DPDK])])
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
 
DPDK_PATH=/home/eu/work/dpdk/dpdk-19.11/x86_64-native-linuxapp-gcc
 
cd odp-dpdk
./bootstrap
#--enable-debug --enable-debug-print
#--without-openssl
./configure --with-dpdk-path=${DPDK_PATH} \
                --prefix=`pwd`/installed \
                --enable-debug=full \
                --enable-helper-debug \
                --enable-debug-print \
                --enable-helper-debug-print \
                --disable-shared
make install

4. compile ofp

1
git clone https://github.com/OpenFastPath/ofp.git
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
 
ODP_DPDK_PATH=`pwd`/odp-dpdk/installed
 
cd ofp
./bootstrap
./configure --with-odp=${ODP_DPDK_PATH} \
        --with-odp-lib=odp-dpdk \
        --disable-shared \
        --enable-debug=yes \
        --enable-sp=no \
        --prefix=`pwd`/installed
make install

5. setup dpdk

1
2
3
4
cd dpdk-19.11/x86_64-native-linuxapp-gcc/kmod
modprobe uio
insmod igb_uio.ko
ifconfig ens33 down

run dpdk-19.11/usertools/dpdk-setup.sh
>>> select and run "Setup hugepage mappings for non-NUMA systems", enter 128
>>> select and run "Bind Ethernet/Baseband/Crypto device to IGB UIO module", will display like
0000:02:01.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' if=ens33 drv=e1000 unused=igb_uio,vfio-pci
>>>>>> enter 02:01.0
>>> Exit Script

6. test

let the vmware guest machine use NAT.

use ipconfig check ip settings in host machine. for example, my ip for "VMware Network Adapter VMnet8" is 192.168.204.1.

ofp/example/webserver/ofp.cli

1
2
3
debug 0
loglevel set debug
ifconfig fp0 192.168.204.33/24

ofp/example/webserver/www/aa.txt

1
Hello, the world!

ofp/example/webserver/run.sh

1
2
export www_dir=`pwd`/www
./webserver -i 0 -f ofp.cli

using web browser access

1
http://192.168.204.33:2048/aa.txt

编译时打印宏变量内容

1
2
3
4
5
6
7
8
9
#define PRINT_MACRO_HELPER(_x) #_x
#define PRINT_MACRO(_x) #_x " = " PRINT_MACRO_HELPER(_x)
 
#define DEFINED_PI 3.14
#define DEFINED_NULL
#pragma message(PRINT_MACRO(DEFINED_PI))
#pragma message(PRINT_MACRO(DEFINED_NULL))
#pragma message(PRINT_MACRO(UNDEFINED))
//#error print stop here.

refer to: https://blog.csdn.net/xshbx/article/details/7981564

qt5.6编译后运行designer

直接双击运行bin/designer.exe会报如下错误:

This application failed to start because it could not find or load the Qt platform plugin "windows" in ...

解决办法是,在bin目录中新建qt.conf文件,其内容如下:

1
2
[Paths]
Prefix=d:/qt5.6.1.x64/

其中d:/qt5.6.1.x64/是根目录,该目录直接下面是bin目录及plugins目录。同时要注意这里的路径字符串中是Linux下的斜杠,不是Windows的反斜杠。