Qt静态构建创建qmake报错,执行configure命令遇阻求助
Let’s work through this static build issue together—static Qt builds can be finicky, but we can narrow down the problem step by step.
First, let’s fix a small typo I noticed: you mentioned using set userformat=unix in vim, but the correct command to set Unix line endings is set fileformat=unix. If you used the wrong command, that file’s line endings might still be messed up, which can break shell scripts like configure. Double-check that by running :set fileformat? in vim when editing qtbase/configure—it should output fileformat=unix.
Here are other key checks to resolve the qmake creation error:
Verify all build dependencies are installed
Static Qt builds require a full set of development libraries that are often missing by default. For Debian/Ubuntu-based systems, install these packages (adjust for your distro if needed):sudo apt-get install build-essential libxcb-xinerama0-dev libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-devMissing dependencies are one of the most common causes of qmake build failures.
Adjust your configure command for clarity
Your current command is missing a few useful flags that can prevent unexpected behavior. Try running this instead (adjust the prefix path if needed, and ensure you have write permissions to/strg/Qt):./configure -static -release -prefix /strg/Qt -opensource -confirm-license -nomake examples -nomake testsThe
-releaseflag ensures you build a release-only static build (static debug builds have extra complications),-opensource -confirm-licenseskips interactive license prompts, and-nomakeflags reduce build time by skipping unnecessary components.Clean up old build artifacts
If you’ve tried building before, residual files from previous attempts can cause conflicts. Run these commands to start fresh:make distclean # If you ran make previously rm -rf qtbase/.qmake.cache qtbase/mkspecs/qconfig.priYou can also extract a fresh copy of the Qt 5.10.0 source tarball to eliminate any corrupted files from prior edits.
Grab the exact error output
The vague "exception feedback" doesn’t give us enough detail. Run the configure command again and capture the final 50 lines of output:./configure -static -prefix /strg/Qt 2>&1 | tail -50Share those lines, and we can pinpoint exactly why qmake isn’t compiling—whether it’s a missing header, linker error, or configuration misstep.
Check distro compatibility
Qt 5.10.0 is quite old (released in 2017), and it may not play nicely with modern Linux distros that have newer system libraries. If you’re using Ubuntu 20.04+, you might need to either use a newer Qt version (5.15 LTS is a better choice for static builds) or find legacy packages for your distro.
内容的提问来源于stack exchange,提问作者Radical Ed

