I use conan-installed Qt-6.2.2.
I created Qt Widgets Project in VS-2019, switched language to std:c++17, added /Zc:__cplusplus to additional options.
Since this is conan-installed QT, it don't have Qt.props, so I manually created one which includes the props file generated by conan install.
But it still complains:
Severity Code Description Project File Line Suppression State
Error C1189 #error: "Qt requires a C++17 compiler, and a suitable
value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus
option to the
compiler." QtWidgetsApplication2 D:.conan\579957\1\include\QtCore\qglobal.h 94
Try setting the options -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458.
I had the same issue with Qt6.2.0 and Qt-VS-Tools2.7.2 in VS2019.
Setting only /Zc:__cplusplus as the error message proposes did not solve it,
but setting the options above worked for me.
(I copied them from an old project where they were autogenerated)
In Visual Studio, Changing "Properties->General-> C++ Language standard" to $(Qt_STDCPP_) solved the problem form me.
I also had the same issue in VS2019 with qt-vsaddin-msvc2019-2.5.2-rev.01. I had to install qt-vsaddin-msvc2019-2.8.1, switch the "C++ Language Standard" to std:c++17 and add /Zc:__cplusplus to additional options.
Related
I'm kinda new to the world of Intel's HPC toolchain and I'm facing some troubles making even simple DPC++ application to work when gtest is used as a testing framework
This is the CMakeLists "structure" I'm following
cmake_minimum_required(VERSION 3.14)
project(foo)
set(CMAKE_CXX_COMPILER "dpcpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3 -fsycl")
# add executables
# target linked libraries
# ...
option(ENABLE_TESTS ON)
if(ENABLE_TESTS)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_subdirectory(tests)
endif()
If I remove the last block, it compiles and runs as expected, otherwise I get the following error:
CMake Error at build/_deps/googletest-src/CMakeLists.txt:10 (project):
The CMAKE_CXX_COMPILER:
dpcpp
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "/home/u141905/foo/build/CMakeFiles/CMakeOutput.log".
See also "/home/u141905/foo/build/CMakeFiles/CMakeError.log".
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_CXX_COMPILER= /usr/bin/c++
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
make: *** [Makefile:2: all] Error 1
Please notice that dpcpp is correctly set, in fact I'm using Intel's devcloud platform.
Setting CXXto the output of whereis dpcpp produces the same error.
The only "workaround" (I doubt it is one though) I found is using clang++ instead (the version from Intel's llvm). Any help or suggestion is much appreciated, thanks in advance!
EDIT: after some more attempts, I noticed that if I set CMAKE_CXX_COMPILER just after fetching gtest, everything works fine. Anyway I don't understand why this happens and how can be properly fixed.
Use the path for dpcpp binary for setting the CMAKE_CXX_COMPILER instead of using"set(CMAKE_CXX_COMPILER "dpcpp")". After adding the path("/opt/intel/oneapi/compiler/2022.0.1/linux/bin/dpcpp") to the CMAKE_CXX_COMPILER, you can run the program successfully.
Please find the below CMakeLists.txt for setting the CMAKE_CXX_COMPILER:
project(foo)
set(CMAKE_CXX_COMPILER "/opt/intel/oneapi/compiler/2022.0.1/linux/bin/dpcpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3 -fsycl")
# add executables
# target linked libraries
# ...
set(ENABLE_TESTS ON)
include(FetchContent)
if(ENABLE_TESTS)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_subdirectory(tests)
endif()
Thanks & Regards,
Hemanth
Did you run the source /opt/intel/oneapi/setvars.sh intel64 script? I.e. is dpcpp on your path before running cmake?
I have read this qt6 doc, so I start to play with this, but maybe the docs leaks some infos and the configure step fails quickly with this error:
CMake Error at cmake/QtBaseConfigureTests.cmake:21 (message):
Failed to compile architecture detection file.
Call Stack (most recent call first):
cmake/QtBaseConfigureTests.cmake:120 (qt_run_config_test_architecture)
cmake/QtBaseConfigureTests.cmake:133 (qt_run_qtbase_config_tests)
CMakeLists.txt:68 (include)
My cmake command is here:
'/usr/local/bin/cmake' '-DQT_HOST_PATH=/opt/qt6/6.0.1/gcc_64' '-DCMAKE_TOOLCHAIN_FILE=/home/mattia/raspi4-qt6/qt-cross/toolchain.cmake' '-DQT_BUILD_TOOLS_WHEN_CROSSCOMPILING=ON' '-DCMAKE_INSTALL_PREFIX=/usr/local/qt_v6.0.1' '-DCMAKE_STAGING_PREFIX=/home/mattia/raspi4-qt6/build/qt_v6.0.1' '-DQT_BUILD_EXAMPLES=FALSE' '-DQT_BUILD_TESTS=FALSE' '-DCMAKE_BUILD_TYPE=Release' '-DINPUT_opengl=es2' '-DINPUT_eglfs=ON' '-G' 'Ninja' '/home/mattia/raspi4-qt6/src/qtbase
While mine toolchaine.cmake is here:
cmake_minimum_required(VERSION 3.18)
include_guard(GLOBAL)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR armv8)
set(TARGET_SYSROOT /home/mattia/raspi4-qt6/sysroot)
set(CROSS_COMPILER /home/mattia/raspi4-qt6/tools/cross-pi-gcc-10.2.0-2/bin)
set(CMAKE_SYSROOT ${TARGET_SYSROOT})
set(CMAKE_C_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-g++)
set(ENV{PKG_CONFIG_PATH} "")
set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_SYSROOT}/usr/lib/arm-gnueabihf/pkgconfig:${CMAKE_SYSROOT}/usr/share/pkgconfig)
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
The doc you linked worked properly for me. I added some more notes here: https://bugfreeblog.duckdns.org/2021/09/qt-6-on-raspberry-pi-on-eglfs.html. Maybe you can try with the toolchain I linked in the article.
I suppose that you are using Cygwin. I had same problem with cygwin, because ARM compiler not understand cygwin path /cygdrive/d/cygwin/home.....
For crosscompile qt6 on windows host use windows cmake and windows CMD. Cygwin is not needed..
I'm trying setup an environment to cross-compile my projects from ubuntu to windows.
Looking around I managed to compile qt through mxe, now the problem is I can't get it to work inside qtcreator.
Being specific, I added in QtVersion tab
/home/user_name/mxe/usr/i686-w64-mingw32.static/qt5/bin/qmake
which has the following attributes
Name: Qt 5.4.0 (qt5)
ABI: x86-windows-unknown-pe-32bit
Source: /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
mkspec: win32-g++
qmake: /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/bin/qmake
Version: 5.4.0
QMAKE_SPEC linux-g++
QMAKE_VERSION 3.0
QMAKE_XSPEC win32-g++
QT_HOST_BINS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/bin
QT_HOST_DATA /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_HOST_LIBS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/lib
QT_HOST_PREFIX /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_INSTALL_ARCHDATA /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_INSTALL_BINS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/bin
QT_INSTALL_CONFIGURATION /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/etc/xdg
QT_INSTALL_DATA /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_INSTALL_DEMOS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/examples
QT_INSTALL_DOCS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/doc
QT_INSTALL_EXAMPLES /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/examples
QT_INSTALL_HEADERS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/include
QT_INSTALL_IMPORTS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/imports
QT_INSTALL_LIBEXECS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/bin
QT_INSTALL_LIBS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/lib
QT_INSTALL_PLUGINS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/plugins
QT_INSTALL_PREFIX /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5
QT_INSTALL_QML /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/qml
QT_INSTALL_TESTS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/tests
QT_INSTALL_TRANSLATIONS /home/snake91/mxe/usr/i686-w64-mingw32.static/qt5/translations
QT_SYSROOT
QT_VERSION 5.4.0
I tried to add every file in ../mxe/usr/bin directory as compiler but I always receive the same msg: "The compiler xxxxxx cannot produce code for this QT version"
Note that I simply gave make qt5, without arguments...
ps of course I set the "new" qt version also in the kit tab
Open QtCreator and go to Tools->Options->Build&Run->Compilers menu then change the default ABI value of installed appropriate compiler to what you see in the spec output of the toolchain: x86-unknown-unknown-32bit to x86-windows-unknown-pe-32bit.
I am trying to install opinionfinder and I getting stuck when i am trying to make autoannotate for sundance apps.
The error log I get is huge and it has all undefined reference errors.
The first line says in function 'my_init_sundance(sunstr,sunstr)' and a list of undefined reference errors.
Anyway i can solve it?
Thanks in advance.
Before trying to compile autoannotate you must make sure Sundance compiled successfully. Check that your sundance-4.37/bin contains: aslog nlp prepro
In order for Sundance to compile on my 64 bit machine I had to edit the Makefile files in both src and include and add -m32 to the CFLAGS variable (or the NormalCC). Also down after the shared_lib_linux: target. Since I am on OSX I also had to add -dynamic flat to NormalOpts and LIBS.
I'm trying to build a simple application that uses ffmpeg's libav* libraries in xcode 4 and getting the following error:
ld: illegal text reloc to non_lazy_ptr from /ffmpeg/temp/ffmpeg-0.8/builduni/lib/libavcodec.a(ac3.o) in _ff_ac3_bit_alloc_calc_psd for architecture i386
I've already tried to run ranlib -c libavcodec.a to fix this problem, but nothing happend.
One more thing: my libav* libraries are fat binaries (i386 + x86_64).
Any ideas what can it be?
I have the same error. Finally, I got the solution at
http://lists.apple.com/archives/unix-porting/2008/Jan/msg00027.html
just add other link flag:
-read_only_relocs suppress
* EXPLANATION * The two assembly commands load the absolutes address of _trail into R15. Doing so is fine if _trail is ultimately
in the same linkage unit. _trail is in libmodule.dylib. For this to
work, at runtime the dynamic loader (dyld) would have to rewrite the
two instructions. Normally dyld only updates data pointers. One work
around is to make libdyalog an archive (e.g. libdyalog.a) and link
that with pere.s. Then all the code would be in the same linkage unit,
so there would be no need for runtime text relocs. The runtime (dyld)
does support text relocs (updating instructions) for i386, but you
need to link with -read_only_relocs suppress.