Qt + VS2019 16.7.0: moc: Too many input files specified - qt

After updating msvc to the 16.7.0 version my project build is break.
I see the following error:
1> moc: Too many input files specified: 'D:\DevProj\C++\QtLib\src\QtLib\GUI\FramelessWindow.h' 'D:\DevProj\C++\ALib\src' 'D:\DevProj\C++\QtLib\src\' 'D:\libs\leathers\Source'
1> Usage: D:\libs\Qt\Qt.5.14.2\5.14.2\msvc2017_64\bin\moc.exe [options] [header-file] [#option-file]
1> Qt Meta Object Compiler version 67 (Qt 5.14.2)
1> Options:
1> -?, -h, --help Displays help on commandline options.
1> --help-all Displays help including Qt specific options.
1> -v, --version Displays version information.
1> -o <file> Write output to file rather than stdout.
1> -I <dir> Add dir to the include path for header files.
1> -F <framework> Add Mac framework to the include path for header
1> files.
1> -E Preprocess only; do not generate meta object
1> code.
1> -D <macro[=def]> Define macro, with optional definition.
1> -U <macro> Undefine macro.
1> -M <key=value> Add key/value pair to plugin meta data
1> --compiler-flavor <flavor> Set the compiler flavor: either "msvc" or "unix".
1> -i Do not generate an #include statement.
1> -p <path> Path prefix for included file.
1> -f <file> Force #include <file> (overwrite default).
1> -b <file> Prepend #include <file> (preserve default
1> include).
1> --include <file> Parse <file> as an #include before the main
1> source(s).
1> -n <which> Do not display notes (-nn) or warnings (-nw).
1> Compatibility option.
1> --no-notes Do not display notes.
1> --no-warnings Do not display warnings (implies --no-notes).
1> --ignore-option-clashes Ignore all options that conflict with compilers,
1> like -pthread conflicting with moc's -p option.
1> Arguments:
1> [header-file] Header file to read from, otherwise stdin.
1> [#option-file] Read additional options from option-file.
I found the similar question here for VS2010 with the answer that there are should be no spaces in the paths. But I dont have spaces in the paths.
Do anybody know why the abowe issue happens and how to fix it?

It seems, that 2.6.0.6 version of VS Qt Addin is broken. Fixed this issue by disabling automatic extension updates in Visual Studio options and reverting to the 2.5.1 version

It seems, that 2.6.0.6 version of VS Qt Addin is broken. Fixed this issue by disabling automatic extension updates in Visual Studio options and reverting to the 2.5.1 version
Correct, but it is fixed in Version 2.6.0.7.
At least for me the problem was solved with this update.

Related

How to embed soname to a shared library in Qt?

Is there a way to embed "soname" to a shared library that is created in Qt ?
Are there any flags to be assigned in .pro ?
My project.pro file contains
QT -= gui
TEMPLATE = lib
CONFIG += plugin
I am expecting the output to be like below
For example,
objdump -p libxyz.so | grep SONAME
This outputs: SONAME libxyz.so
Below is the command, I have used for adding SONAME to Qt shared libraries.
Below command is added in Qt .pro file
QMAKE_POST_LINK += patchelf --debug --set-soname libQtUILib.so libQtUILib.so
Below command is used to verify the SONAME
objdump -p libQtUILib.so | grep SONAME
SONAME libQtUILib.so

QMake ignore/edit project file variable

I want to reset LIBS variable of my project without touching pro file itself.
qmake fileName.pro LIBS=
this will not work, because "LIBS=" is performed before loading fileName.pro.
cat fileName.pro | grep -v "LIBS.*=" | qmake /dev/stdin
will not work too, qmake seems to NOT be intended for PIPE-ing.
so is there some other option for editing/ignoring/reseting variable insade qmake command line, without changing pro file.
it was the -after option that i was looking for:
qmake fileName.pro -after LIBS=
works well.

Building Qt from source, qmake is invoke by their script with invalid parameters?

I am trying to get a boot2qt build environment setup. It's for an iMX53 - not that it should really matter when it comes to answering my question...
So, as part of the process I run their script called "build_qt.sh". That calls a nested configure script with a big pile of parameters. That script, in turn, builds qmake from source, and then tries to use the new qmake to build the rest of qt (from what it looks like?).
After a long battle, I got it to successfully create the qmake binary, but then the script ends by invoking that with all the parameters passed to the configure script. Qmake then fails because most of these parameters are not valid qmake options!
Here's an excerpt from build_qt.sh:
CONFIGURE_ARGS="${CONFIGURE_ARGS} \
-commercial -confirm-license -release \
-device ${DEVICE} \
-device-option CROSS_COMPILE=${WORKDIR}/tmp/sysroots/x86_64-linux/usr/bin/${COMPILER} \
-sysroot ${WORKDIR}/toolchain/sysroots/${SYSROOT} \
-no-xcb -separate-debug-info -silent -nomake examples -nomake tests -tslib -no-pch -v"
...
./configure ${CONFIGURE_ARGS}
At the end of the that configure script, it does this:
"$outpath/bin/qmake" "$relpathMangled" -- "$#"
Note the $#. That's where all those config arguments end up, which blows it up. Specifically, it complains about the first argument it gets that isn't intended for qmake.
Here's the actual statement it tries to execute:
/home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/bin/qmake /home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/qt5-src -- -commercial -confirm-license -release -device linux-imx53qsb-hf-g++ -device-option CROSS_COMPILE=/home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/tmp/sysroots/x86_64-linux/usr/bin/armv7ahf-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi- -sysroot /home/osboxes/Qt/Boot2Qt-2.x/imx53qsb-eLinux/build-imx53qsb/toolchain/sysroots/armv7ahf-vfp-neon-poky-linux-gnueabi -no-xcb -separate-debug-info -silent -nomake examples -nomake tests -tslib -no-pch -v
And this is the result:
ERROR: Unknown command line option '-commercial'.
Here is the actual qmake binary help output, which defines the expected syntax:
Usage: ./bin/qmake [mode] [options] [files]
QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project
Mode:
-project Put qmake into project file generation mode
In this mode qmake interprets files as files to
be built,
defaults to *; *; *; *.ts; *.xlf; *.qrc
Note: The created .pro file probably will
need to be edited. For example add the QT variable to
specify what modules are required.
-makefile Put qmake into makefile generation mode (default)
In this mode qmake interprets files as project files to
be processed, if skipped qmake will try to find a project
file in your current working directory
Warnings Options:
-Wnone Turn off all warnings; specific ones may be re-enabled by
later -W options
-Wall Turn on all warnings
-Wparser Turn on parser warnings
-Wlogic Turn on logic warnings (on by default)
-Wdeprecated Turn on deprecation warnings (on by default)
Options:
* You can place any variable assignment in options and it will be *
* processed as if it was in [files]. These assignments will be *
* processed before [files] by default. *
-o file Write output to file
-d Increase debug level
-t templ Overrides TEMPLATE as templ
-tp prefix Overrides TEMPLATE so that prefix is prefixed into the value
-help This help
-v Version information
-early All subsequent variable assignments will be
parsed right before default_pre.prf
-before All subsequent variable assignments will be
parsed right before [files] (the default)
-after All subsequent variable assignments will be
parsed after [files]
-late All subsequent variable assignments will be
parsed right after default_post.prf
-norecursive Don't do a recursive search
-recursive Do a recursive search
-set <prop> <value> Set persistent property
-unset <prop> Unset persistent property
-query <prop> Query persistent property. Show all if <prop> is empty.
-qtconf file Use file instead of looking for qt.conf
-cache file Use file as cache [makefile mode only]
-spec spec Use spec as QMAKESPEC [makefile mode only]
-nocache Don't use a cache file [makefile mode only]
-nodepend Don't generate dependencies [makefile mode only]
-nomoc Don't generate moc targets [makefile mode only]
-nopwd Don't look for files in pwd [project mode only]
Note that the parent build_qt.sh script runs Make after this. Also, the qmake "default mode" is -makefile which will Put qmake into makefile generation mode (default). So, I'm pretty certain this command that is failing to execute is supposed to be writing a makefile (essentially this is a "configure script" inside another one).
Does anyone know what that command should be here?
Could someone run a similar instance of build_qt.sh for me and post what command is run here by their functional script? That would likely go a very long ways towards solving this.
Turns out the parent build_qt.sh script and the configure script come from different versions of Qt. They are not compatible! Older versions of Qt don't have this troublesome line:
"$outpath/bin/qmake" "$relpathMangled" -- "$#"
Instead they look like this:
"$outpath/bin/qmake" "$relpathMangled"
Which makes way more sense! I don't know why the current configure file has that funkiness in it, but it doesn't matter for me at the moment.

How to use existing QMake project (.pro project file) as "external project" in CMake?

Is there a concise doc or example for how to use an existing QMake project with .pro project file as an "external project" in CMake? This can somewhat be done in qtcreator by marking one project as dependency of another, but it would be nice to define it more explicitly with the ExternalProject() CMake syntax.
related question: CMake: How to build external projects and include their targets
Something like this works. You can then edit the files from either qtcreator in main CMake project tree, OR from opening the .pro file; great for iterating quickly on QT widgets in SomeGarbageApplication that is part of large cmake build tree.
macro(DeclareProjectFiles Tag Filez)
######### Trick: use this syntax to make arbitrary files
######### appear in IDE project. #######################
### Note: pass in the raw name of a list variable,
### since it will get expanded here in this macro.
add_custom_target(${Tag}_files ALL
pwd
COMMAND ls -ltrh
COMMENT " ${Tag} files thunk... got list: [ ${${Filez}} ]"
VERBATIM
SOURCES ${${Filez}}
)
endmacro()
message(STATUS "QT_QMAKE_EXE is: ${QT_QMAKE_EXECUTABLE}")
set(Z SomeGarbageApplication)
file(GLOB ${Z}_Files
./*.cpp
./*.h
./*.ui
./*.pro
./*.png
./*.jpg)
DeclareProjectFiles( ${Z}_grbg ${Z}_Files )
add_custom_target(${Z}_pro ALL)
set(ExtraQMakeArgs -r -spec linux-g++ CONFIG+=release)
# note: use killall because this can/will fail if the exe is running
# But, need || true to not fail build when it's not running.
add_custom_command(TARGET ${Z}_pro
COMMAND killall
ARGS -q -9 -v ${Z} || true
COMMAND ${QT_QMAKE_EXECUTABLE}
ARGS -query
COMMAND ${QT_QMAKE_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${Z}.pro ${ExtraQMakeArgs}
COMMAND make ${Z}
ARGS -j4
COMMAND cp
ARGS ${Z} ${CMAKE_CURRENT_SOURCE_DIR}/${${Z}_config} ${CMAKE_BINARY_DIR}/bin/
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
)
#################################################################

(How) Can I determine the version of the c99 compiler on my machine?

Is there a command line flag, or something similar, that I can use to get c99 to print it's version?
I'm looking for output similar to gcc's -v flag, which gives me:
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
I really only care about the Target: line and the last line.
c99 --version
~$c99 --version
gcc (Debian 4.4.5-8) 4.4.5
also try c99 --help
~$ c99 --help
Usage: gcc [options] file...
Options:
-pass-exit-codes Exit with highest error code from a phase
--help Display this information
--target-help Display target specific command line options
--help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]
Display specific types of command line options
(Use '-v --help' to display command line options of sub-processes)
--version Display compiler version information
-dumpspecs Display all of the built in spec strings
-dumpversion Display the version of the compiler
-dumpmachine Display the compiler's target processor
-print-search-dirs Display the directories in the compiler's search path
-print-libgcc-file-name Display the name of the compiler's companion library
-print-file-name=<lib> Display the full path to library <lib>
-print-prog-name=<prog> Display the full path to compiler component <prog>
-print-multi-directory Display the root directory for versions of libgcc
-print-multi-lib Display the mapping between command line options and
multiple library search directories
-print-multi-os-directory Display the relative path to OS libraries
-print-sysroot Display the target libraries directory
-print-sysroot-headers-suffix Display the sysroot suffix used to find headers
-Wa,<options> Pass comma-separated <options> on to the assembler
-Wp,<options> Pass comma-separated <options> on to the preprocessor
-Wl,<options> Pass comma-separated <options> on to the linker
-Xassembler <arg> Pass <arg> on to the assembler
-Xpreprocessor <arg> Pass <arg> on to the preprocessor
-Xlinker <arg> Pass <arg> on to the linker
-combine Pass multiple source files to compiler at once
-save-temps Do not delete intermediate files
-pipe Use pipes rather than intermediate files
-time Time the execution of each subprocess
-specs=<file> Override built-in specs with the contents of <file>
-std=<standard> Assume that the input sources are for <standard>
--sysroot=<directory> Use <directory> as the root directory for headers
and libraries
-B <directory> Add <directory> to the compiler's search paths
-b <machine> Run gcc for target <machine>, if installed
-V <version> Run gcc version number <version>, if installed
-v Display the programs invoked by the compiler
-### Like -v but options quoted and commands not executed
-E Preprocess only; do not compile, assemble or link
-S Compile only; do not assemble or link
-c Compile and assemble, but do not link
-o <file> Place the output into <file>
-x <language> Specify the language of the following input files
Permissible languages include: c c++ assembler none
'none' means revert to the default behavior of
guessing the language based on the file's extension
Options starting with -g, -f, -m, -O, -W, or --param are automatically
passed on to the various sub-processes invoked by gcc. In order to pass
other options on to these processes the -W<letter> options must be used.

Resources