When building a project with
cmake .
the command
find_package(Qt5Core REQUIRED)
in the CMakeLists fails.
It throws
CMake Error at C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:14 (message):
The imported target "Qt5::Core" references the file
"C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/Qt5Core.lib"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"C:/Qt/Tools/QtDesignStudio/qt5_design_studio_reduced_version/lib/cmake/Qt5Core/Qt5CoreConfig.cmake"
but not all the files it references.
as an error.
When searching for Qt5Core.lib through regular file explorer I can only find Qt5Core.prl and Qt5Core.dll but no Qt5Core.lib. How do I get Qt5Core.lib? Why doesn't it exist?
The code in Qt5CoreConfig.cmake in line 13 to 23:
if(NOT EXISTS "${file}" )
message(FATAL_ERROR "The imported target \"Qt5::Core\" references the file
\"${file}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
Related
I import grpc project use gRPCConfig.cmake file. But the following error occurred
CMake Error at /home/openwrt/openwrt/staging_dir/target-arm_cortex-a53+neon-vfpv4_glibc-2.22_eabi/usr/lib/cmake/grpc/gRPCTargets.cmake:178 (message):
The imported target "gRPC::gpr" references the file
"/usr/lib/libgpr.so"
but this file does not exist. Possible reasons include:
The file was deleted, renamed, or moved to another location.
An install or uninstall procedure did not complete successfully.
The installation package was faulty and contained
/home/openwrt/openwrt/staging_dir/target-arm_cortex-a53+neon-vfpv4_glibc-2.22_eabi/usr/lib/cmake/grpc/gRPCTargets.cmake
but not all the files it references.
I am searching for a way to get rid of the error message
SqLite header and source version mismatch 2016-04-08 15:09:49
fe7d3b75fe1bde41511b323925af8ae1b910bc4d 2015-07-29 20:00:57
cf538e2783e468bbc25e7cb2a9ee64d3e0e80b2f
when ,e.g., typing in sqlite3. I had to check a python script, using SQLite. I had to overwrite the libsqlite.so in my folder /usr/lib/x86_64-linux-gnu/ due to a project specific libsqlite.so-file.
But older files libsqlite3.la, libsqlite3.so.0 and libsqlite3.so.0.8.6 remained unchanged.
My folder /usr/local/lib does not contain any sqlite files. I found this hint to change the source_id in the .c- and .h-file:
https://forum.ubuntuusers.de/topic/header-and-source-version-mismatch-bei-sqlite3/2/
I did this for the file sqlite3.h, but the file sqlite3.c is also missing.
Any other suggestions how I can fix this annoying problem?
Update:
After deleting and re-installing sqlite3 and libsqlite3-dev, I am receiving the same error message. The delete process also included the deletion of the file libsqlite3.so, that was substituted by the use case specific libsqlite3.so.
I also deleted the files libsqlite3.so.0 and libsqlite3.so.0.8.6 in the folder /usr/lib/x86_64-linux-gnu/. This leads to the error message:
sqlite3: error while loading shared libraries: libsqlite3.so.0: cannot open > shared object file: No such file or directory
Kind regards
If you don't want to use the SQLite version that happens to be shipped with your distribution, put all the source files (sqlite3.h and sqlite3.c of the "amalgamation") of the desired version into your project, just like any other source file.
Using QT Creator I'm having a project (let's call it Proj A) that has a dependency on a static linked project (let's call it Proj B).
Proj A includes some headers needed from Proj B .
In Proj B I removed a header file named "SomeHeader.h" that was used by "MyClass.cpp" from Proj A, and moved the description etc in another header.
Of course in "MyClass.h" from Proj A I removed the old include and replaced it with the new one.
When compiling I get the following error (which honestly baffles me ) :
make : *** No rule to make target 'SomeHeader.h' , needed by 'MyClass.o' .
I searched compile output, .h , .cpp files , .pro files and 'SomeHeader' cannot be found anywhere.
I've cleaned the projects and rebuilt , still nothing.
I'm guessing QT Creator is making some temporary makefiles that become permanent in some way.
So what should I try next ?
Follow this step should fix your issue :
Do a build clean
run qmake again
enjoy
I want to integrate SQLite into my project using ExternalProject_Add.
cmake_minimum_required(VERSION 2.8.8)
include(ExternalProject)
# Download, configure, build and install SQLite
ExternalProject_Add(SQLite
PREFIX ${CMAKE_SOURCE_DIR}
TMP_DIR ${CMAKE_SOURCE_DIR}/temp
STAMP_DIR ${CMAKE_SOURCE_DIR}/stamp
#--Download step--------------
DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download
URL http://www.sqlite.org/2014/sqlite-autoconf-3080704.tar.gz
URL_HASH SHA1=70ca0b8884a6b145b7f777724670566e2b4f3cde
#--Update/Patch step----------
UPDATE_COMMAND ""
#--Configure step-------------
SOURCE_DIR ${CMAKE_SOURCE_DIR}/source
CONFIGURE_COMMAND "" # How to add sqlite3.c to the target here?
#--Build step-----------------
BINARY_DIR ${CMAKE_SOURCE_DIR}/build
BUILD_COMMAND "cmake --build ."
#--Install step---------------
INSTALL_DIR ${CMAKE_SOURCE_DIR}/install
)
The build command would use the native compiler to build all source files added to the target SQLite. However, there are non. How can I add the only source file sqlite3.c to the external project within the CONFIGURE_COMMAND?
ExternalProject_Add assumes that the project you want to pull in already ships with a (possibly complex, possibly non-CMake-based) working build system.
You have two possibilities here:
You can stick with the amalgamated autoconf version of sqlite that you are currently using. In that case the CONFIGURE_COMMAND would invoke configure and the BUILD_COMMAND would invoke make. Note that this approach will not be portable to platforms that do not have autoconf installed.
You can switch to the bare-source amalgamated version of sqlite and provide your own CMakeLists.txt for building. Since sqlite can be built with a minimum of configuration and the amalgamation only consists of a single source and header file, this is not as hard as it may sound. In this case you can simply invoke cmake for configuation and building.
Note however that you cannot provide this information in-line with ExternalProject_Add. You will need an external build script, whether that is CMake, autoconf or something else.
Building on the correct answer above, this is what I came up with. Instead of adding a second file to my repository, it gets generated from the existing CMake file. Since the source directory of the external project gets cleaned on build, the generated file must be stored in a temporary location and copied into the source directory in a later step of the external project, in this case the update command.
# SQLite
cmake_minimum_required(VERSION 2.8.8)
include(ExternalProject)
# Add CMake project file
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/temp)
file(WRITE ${CMAKE_SOURCE_DIR}/temp/CMakeLists.txt
"cmake_minimum_required(VERSION 2.8.8)\n"
"set(PROJECT_NAME sqlite)\n"
"include_directories(${CMAKE_SOURCE_DIR}/source)\n"
"add_library(sqlite3 ${CMAKE_SOURCE_DIR}/source/sqlite3.c)\n"
"install(TARGETS sqlite3 DESTINATION lib)\n"
"install(FILES sqlite3.h DESTINATION include)\n")
# Download, configure, build and install.
ExternalProject_Add(SQLite
# DEPENDS
PREFIX ${CMAKE_SOURCE_DIR}
TMP_DIR ${CMAKE_SOURCE_DIR}/temp
STAMP_DIR ${CMAKE_SOURCE_DIR}/stamp
#--Download step--------------
DOWNLOAD_DIR ${SFML_PREFIX}/download
URL http://www.sqlite.org/2014/sqlite-autoconf-3080704.tar.gz
URL_HASH SHA1=70ca0b8884a6b145b7f777724670566e2b4f3cde
#--Update/Patch step----------
UPDATE_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/temp/CMakeLists.txt
${CMAKE_SOURCE_DIR}/source/CMakeLists.txt
#--Configure step-------------
SOURCE_DIR ${CMAKE_SOURCE_DIR}/source
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_SOURCE_DIR}/install
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
#--Build step-----------------
BINARY_DIR ${CMAKE_SOURCE_DIR}/build
BUILD_COMMAND ${CMAKE_COMMAND} --build .
#--Install step---------------
INSTALL_DIR ${CMAKE_SOURCE_DIR}/install
)
Error-
$ qmake
qmake: could not find a Qt installation of ''
I installed Qt Version 4.8.2
Partial File of .profile in my home directory
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
PATH="/usr/local/Trolltech/Qt-4.8.2/bin:$PATH"
PATH="/home/user/qt-everywhere-opensource-src-4.8.2/bin:$PATH"
export PATH
fi
Output-
$ which qmake
/usr/bin/qmake
Properties
Name - qmake
Type - Link to executable (application/x-executable)
Link Target - qtchooser
Location - /usr/bin
qmake is present in this location
/usr/local/Trolltech/Qt-4.8.2/bin
Properties
Name - qmake
Type - executable (application/x-executable)
Size - 3.4 MB (3,407,312 bytes)
Location - /usr/local/Trolltech/Qt-4.8.2/bin
qmake is also present in this location
/home/username/qt-everywhere-opensource-src-4.8.2/bin
Properties
Name - qmake
Type - executable (application/x-executable)
Size - 11.2 MB (11,157,974 bytes)
Location - /home/username/qt-everywhere-opensource-src-4.8.2/bin
How to make qmake work? Which one is the correct path for qmake?
This is really simple. You don't need to modify any environmental variables, you don't need to set up QTDIR. There are only two facts you need to keep in mind:
You must invoke qmake from your desired version of Qt.
There's a 1:1 relationship between a particular installed Qt version and build, and qmake executable.
After the desired qmake was run and generated the makefile, invoking make will build your project using the version of Qt the qmake came from. This will happen in spite of any environmental variable settings etc.
So, all you need to know is which Qt installation you want to use, and its path. This should be obvious since you installed Qt yourself. There lies the bin/qmake that you need.
You can select the desired qmake just as you would select a particular binary to run. The process is not any different just because it is qmake and not, say gzip:
by explicitly typing out the path to the executable,
by using a shell alias,
by putting the desired Qt's bin folder onto the PATH.
Only you know where you installed your desired version of Qt - there are at least three paths in your question. Thus it's impossible to tell which qmake are you to invoke. Obviously one of them - the one picked up by which qmake - doesn't work.
You need to invoke the one that came with the version of Qt that you installed.
That's really all there's to it.
I think the source code is in this location:
/home/user/qt-everywhere-opensource-src-4.8.2/bin
and installation directory is at:
/usr/local/Trolltech/Qt-4.8.2/bin
you need to add the installation directory to your PATH, however if you have an other version (like the one in /usr/bin) you need to use /usr/local/Trolltech/Qt-4.8.2/bin/qmake to compile Qt project using this version.
My solution is to add this code to your .profile file:
export QTDIR="/usr/local/Trolltech/Qt-4.8.2"
export PATH="$QTDIR/bin:$PATH"
alias qmake-4.8="$QTDIR/bin/qmake"
after that use qmake-4.8 instead of qmake