Closed lpmrfentazis closed 3 weeks ago
Hi @lpmrfentazis
Thanks for your question.
Could you please share the full output of the conan install
command and also the output of the cmake
command? It can have useful information (please share it as text, better than image, so we can search, copy, etc). Thanks!
conan install . --output-folder=build --build=missing
output:
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
======== Computing dependency graph ========
Graph root
conanfile.txt: D:\programs\lorettAntennaXZ\conanfile.txt
Requirements
brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519 - Cache
bzip2/1.0.8#411fc05e80d47a89045edc1ee6f23c1d - Cache
double-conversion/3.3.0#33321c201741cc32b51169c6d2d05e60 - Cache
freetype/2.13.2#c9ee90dc6f88356febac6fcdba0b2249 - Cache
libjpeg/9e#68269859e4325ddc3f995d1fd3fc9187 - Cache
libpng/1.6.40#0337b7b87ac125307ed70fd064c31eea - Cache
libpq/15.4#886b735649233063640188e1d7892fd4 - Cache
md4c/0.4.8#84b2885aa93a27653f5067a77044b0e3 - Cache
opengl/system#b29589c04d6df84c110d6acb066ab653 - Cache
openssl/3.2.0#d81e0a8c08372368fe7cb757280e2196 - Cache
pcre2/10.42#74a354d74d291503aadffe6453d976f5 - Cache
qt/5.15.11#b959a2b2a41e6c47c851bf6497087a6c - Cache
sqlite3/3.44.2#6aea4802c643c19f97b7f5a8a4b4f16d - Cache
zlib/1.3#06023034579559bb64357db3a53f88a4 - Cache
zstd/1.5.5#b87dc3b185caa4b122979ac4ae8ef7e8 - Cache
Build requirements
jom/1.1.3#47af92eea59a73d13d7e18149f0a1835 - Cache
nasm/2.15.05#ca1c14c2060af0ec151048b54ced9262 - Cache
strawberryperl/5.32.1.1#8f83d05a60363a422f9033e52d106b47 - Cache
Resolved version ranges
openssl/[>=1.1 <4]: openssl/3.2.0
zlib/[>=1.2.11 <2]: zlib/1.3
======== Computing necessary packages ========
Requirements
brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519:75df3523cadfb3cb5a2c1cc2d61e8c640e1f9b96#249943a2756eb869cac284274651a4ab - Cache
bzip2/1.0.8#411fc05e80d47a89045edc1ee6f23c1d:67bfcb7b4b78262b9d05495e479dcd92f747316b#7d944f387aef9d7e05a93c6be6033e42 - Cache
double-conversion/3.3.0#33321c201741cc32b51169c6d2d05e60:9bdee485ef71c14ac5f8a657202632bdb8b4482b#2676cc725a3e2249b2b2811c48133298 - Cache
freetype/2.13.2#c9ee90dc6f88356febac6fcdba0b2249:79f73b3fcb4ea3718b05e96b46594ae8f2ec3895#60086e1b3fc43a98c19fae18bb5f9db4 - Cache
libjpeg/9e#68269859e4325ddc3f995d1fd3fc9187:7bfde258ff4f62f75668d0896dbddedaa7480a0f#cbec5e3664b98a475ae70e69b26ec5e9 - Cache
libpng/1.6.40#0337b7b87ac125307ed70fd064c31eea:e0d2306461d10438fbd847f0556a0f0ac5653d3a#ec5db30a5b08f152a06b3a27afcabe91 - Cache
libpq/15.4#886b735649233063640188e1d7892fd4:05bf1a61df8ad420b533b8f994d863f4ee516906#b657ea39a6f6337cc4578a776b206f28 - Cache
md4c/0.4.8#84b2885aa93a27653f5067a77044b0e3:f55a78cc20dfe61b6b25458bc1b7e17f987b7176#7dccb248acf8da9e7dba13052b4a91c2 - Cache
opengl/system#b29589c04d6df84c110d6acb066ab653:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
openssl/3.2.0#d81e0a8c08372368fe7cb757280e2196:b72e7531dedb4fa501756abb356a3d5cc0bc8c00#4476b654c30974122c03403f21624c33 - Cache
pcre2/10.42#74a354d74d291503aadffe6453d976f5:1bbffc30d8479a890917ef6674ab5e5f3c5b2036#4a4b8b1d7682bb40407c22223ddeac17 - Cache
qt/5.15.11#b959a2b2a41e6c47c851bf6497087a6c:985358055f4d0d9fac2329a5614f2f6b59d242e3#44d23c8f9e628a564890cc8d0e6a423e - Cache
sqlite3/3.44.2#6aea4802c643c19f97b7f5a8a4b4f16d:6506537eae25fcb702cd9e1718c3d5a491c4af15#64ab94245a74801dd912b3d4e759e0a8 - Cache
zlib/1.3#06023034579559bb64357db3a53f88a4:7bfde258ff4f62f75668d0896dbddedaa7480a0f#67a13c948e95f6037be3f15318d222c1 - Cache
zstd/1.5.5#b87dc3b185caa4b122979ac4ae8ef7e8:c60581f2463ba21c248b22570dc9f7e6dcb636f7#accd19eda1e1e9f1e006913c0f94a205 - Cache
Build requirements
Skipped binaries
jom/1.1.3, nasm/2.15.05, strawberryperl/5.32.1.1
======== Installing packages ========
brotli/1.1.0: Already installed! (1 of 15)
bzip2/1.0.8: Already installed! (2 of 15)
double-conversion/3.3.0: Already installed! (3 of 15)
libjpeg/9e: Already installed! (4 of 15)
md4c/0.4.8: Already installed! (5 of 15)
opengl/system: Already installed! (6 of 15)
sqlite3/3.44.2: Already installed! (7 of 15)
zlib/1.3: Already installed! (8 of 15)
zstd/1.5.5: Already installed! (9 of 15)
libpq/15.4: Already installed! (10 of 15)
libpng/1.6.40: Already installed! (11 of 15)
pcre2/10.42: Already installed! (12 of 15)
pcre2/10.42: Appending PATH environment variable: C:\Users\MrFentazis\.conan2\p\pcre2d85e041fe43c5\p\bin
openssl/3.2.0: Already installed! (13 of 15)
freetype/2.13.2: Already installed! (14 of 15)
qt/5.15.11: Already installed! (15 of 15)
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated: 'cpp_info.names' used in: bzip2/1.0.8, zstd/1.5.5, qt/5.15.11, sqlite3/3.44.2, brotli/1.1.0, libpng/1.6.40, md4c/0.4.8, libpq/15.4, freetype/2.13.2, pcre2/10.42, libjpeg/9e, zlib/1.3, openssl/3.2.0
WARN: deprecated: 'cpp_info.build_modules' used in: qt/5.15.11, sqlite3/3.44.2, freetype/2.13.2, bzip2/1.0.8, openssl/3.2.0
WARN: deprecated: 'env_info' used in: zstd/1.5.5, sqlite3/3.44.2, md4c/0.4.8, libpq/15.4, freetype/2.13.2, pcre2/10.42, bzip2/1.0.8, openssl/3.2.0
WARN: deprecated: 'cpp_info.filenames' used in: freetype/2.13.2, sqlite3/3.44.2, opengl/system
WARN: deprecated: 'user_info' used in: freetype/2.13.2
======== Finalizing install (deploy, generators) ========
conanfile.txt: Writing generators to D:\programs\lorettAntennaXZ\build\build\generators
conanfile.txt: Generator 'CMakeDeps' calling 'generate()'
conanfile.txt: Generator 'CMakeToolchain' calling 'generate()'
conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake
conanfile.txt: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23
conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=D:\programs\lorettAntennaXZ\build\build\generators\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW'
conanfile.txt: CMakeToolchain generated: CMakePresets.json
conanfile.txt: CMakeToolchain generated: ..\..\..\CMakeUserPresets.json
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully
Also the output of the cmake command, please. Thanks!
cmake .. -DCMAKE_TOOLCHAIN_FILE="./build/generators/conan_toolchain.cmake"
-- Using Conan toolchain: D:/programs/lorettAntennaXZ/build/build/generators/conan_toolchain.cmake
-- Conan toolchain: C++ Standard 14 with extensions OFF
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
-- Conan: Component target declared 'Qt5::Core'
-- Conan: Component target declared 'Qt5::WinMain'
-- Conan: Component target declared 'Qt5::Gui'
-- Conan: Component target declared 'Qt5::EventDispatcherSupport'
-- Conan: Component target declared 'Qt5::FontDatabaseSupport'
-- Conan: Component target declared 'Qt5::ThemeSupport'
-- Conan: Component target declared 'Qt5::AccessibilitySupport'
-- Conan: Component target declared 'Qt5::Widgets'
-- Conan: Component target declared 'Qt5::PrintSupport'
-- Conan: Component target declared 'Qt5::WindowsUIAutomationSupport'
-- Conan: Component target declared 'Qt5::QWindowsIntegrationPlugin'
-- Conan: Component target declared 'Qt5::QWindowsVistaStylePlugin'
-- Conan: Component target declared 'Qt5::QSQLiteDriverPlugin'
-- Conan: Component target declared 'Qt5::QPSQLDriverPlugin'
-- Conan: Component target declared 'Qt5::Network'
-- Conan: Component target declared 'Qt5::Sql'
-- Conan: Component target declared 'Qt5::Test'
-- Conan: Component target declared 'Qt5::OpenGL'
-- Conan: Component target declared 'Qt5::OpenGLExtensions'
-- Conan: Component target declared 'Qt5::Concurrent'
-- Conan: Component target declared 'Qt5::Xml'
-- Conan: Target declared 'qt::qt'
-- Conan: Component target declared 'OpenSSL::Crypto'
-- Conan: Component target declared 'OpenSSL::SSL'
-- Conan: Target declared 'openssl::openssl'
-- Conan: Target declared 'ZLIB::ZLIB'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/opensd90dd1a179ee9/p/lib/cmake/conan-official-openssl-variables.cmake'
-- Conan: Component target declared 'PCRE2::8BIT'
-- Conan: Component target declared 'PCRE2::POSIX'
-- Conan: Component target declared 'PCRE2::16BIT'
-- Conan: Component target declared 'PCRE2::32BIT'
-- Conan: Target declared 'pcre2::pcre2'
-- Conan: Target declared 'BZip2::BZip2'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/bzip2390e62dbed9cd/p/lib/cmake/conan-official-bzip2-variables.cmake'
-- Conan: Target declared 'double-conversion::double-conversion'
-- Conan: Target declared 'Freetype::Freetype'
-- Conan: Component target declared 'brotli::brotlicommon'
-- Conan: Component target declared 'brotli::brotlidec'
-- Conan: Component target declared 'brotli::brotlienc'
-- Conan: Target declared 'brotli::brotli'
-- Conan: Target declared 'PNG::PNG'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/freetf84857ac0f13d/p/lib/cmake/conan-official-freetype-variables.cmake'
-- Conan: Target declared 'JPEG::JPEG'
-- Conan: Component target declared 'SQLite::SQLite3'
-- Conan: Component target declared 'libpq::pgport'
-- Conan: Component target declared 'libpq::pgcommon'
-- Conan: Component target declared 'libpq::pq'
-- Conan: Target declared 'PostgreSQL::PostgreSQL'
-- Conan: Target declared 'opengl::opengl'
-- Conan: Component target declared 'zstd::libzstd_static'
-- Conan: Component target declared 'md4c::md4c'
-- Conan: Component target declared 'md4c::md4c-html'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/b/qte8334aa9523ea/p/lib/cmake/Qt5Core/conan_qt_core_extras.cmake'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/b/qte8334aa9523ea/p/lib/cmake/Qt5Core/conan_qt_qt5_coreprivate.cmake'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/b/qte8334aa9523ea/p/lib/cmake/Qt5Core/Qt5CoreMacros.cmake'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/b/qte8334aa9523ea/p/lib/cmake/Qt5Gui/conan_qt_qt5_guiprivate.cmake'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/b/qte8334aa9523ea/p/lib/cmake/Qt5Widgets/conan_qt_qt5_widgetsprivate.cmake'
-- Conan: Including build module from 'C:/Users/MrFentazis/.conan2/p/b/qte8334aa9523ea/p/lib/cmake/Qt5Widgets/Qt5WidgetsMacros.cmake'
-- Configuring done (0.2s)
CMake Error at CMakeLists.txt:39 (target_link_libraries):
Target "app" links to:
Qt5::SerialPort
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
-- Generating done (0.0s)
CMake Generate step failed. Build files cannot be regenerated correctly.
Ok, that is helpful.
You can see that CMake is listing the available targets created by Conan: Conan: Component target declared 'Qt5::Core'
, and yours is not available there, so it is not found later.
The issue is that this component is not built by default, as it is not that commonly used. There is a recipe option in Qt5, you can check it for example listing existing binaries:
conan list "qt/[<6]:*" -r=conancenter
....
options
commercial: False
...
qtserialport: False
Or also in https://conan.io/center/recipes/qt?version=5.15.11 -> packages -> options
So trying:
conan install ... -o qt*:qtserialport=True --build=missing
Should opt-in into it (build it from source, as there is no pre-compiled binary for this configuration), the target should appear in the cmake output, and it should work.
Ок, это полезно. Вы можете видеть, что CMake перечисляет доступные цели, созданные Conan:
Conan: Component target declared 'Qt5::Core'
, а ваша там недоступна, поэтому она не будет найдена позже.Проблема в том, что этот компонент не создан по умолчанию, поскольку он не так часто используется. В Qt5 есть опция рецепта, вы можете проверить это, например, со списком существующих двоичных файлов:
conan list "qt/[<6]:*" -r=conancenter .... options commercial: False ... qtserialport: False
Или также в https://conan.io/center/recipes/qt?version=5.15.11 -> пакеты -> параметры
Итак, пытаюсь:
conan install ... -o qt*:qtserialport=True --build=missing
Следует зарегистрироваться в нем (собрать его из исходного кода, поскольку для этой конфигурации нет предварительно скомпилированного двоичного файла), цель должна появиться в выходных данных cmake, и она должна работать.
It worked, thank you!
Or not... I'm not sure if it has to do with how the QSerialPort connected
lor.obj : error LNK2019: ссылка на неразрешенный внешний символ "char * icfgBuf" (?icfgBuf@@3PADA) в функции "private:
void __cdecl Win::on_SaveOrig_pressed(void)" (?on_SaveOrig_pressed@Win@@AEAAXXZ). [D:\programs\lorettAntennaXZ\build\ap
p.vcxproj]
Указание на символы, которые определены и могут подойти:
"unsigned char * icfgBuf" (?icfgBuf@@3PAEA)
main.obj : error LNK2019: ссылка на неразрешенный внешний символ "signed char AdmMode" (?AdmMode@@3CA) в функции main.
[D:\programs\lorettAntennaXZ\build\app.vcxproj]
Указание на символы, которые определены и могут подойти:
"bool AdmMode" (?AdmMode@@3_NA)
main.obj : error LNK2019: ссылка на неразрешенный внешний символ "unsigned short Port" (?Port@@3GA) в функции "char __c
decl Loadini(void)" (?Loadini@@YADXZ). [D:\programs\lorettAntennaXZ\build\app.vcxproj]
Указание на символы, которые определены и могут подойти:
"unsigned int Port" (?Port@@3IA)
Qt5SerialPort.lib(qserialportinfo_win.obj) : error LNK2019: ссылка на неразрешенный внешний символ __imp_SetupDiEnumDev
iceInfo в функции "public: static class QList<class QSerialPortInfo> __cdecl QSerialPortInfo::availablePorts(void)" (?a
vailablePorts@QSerialPortInfo@@SA?AV?$QList@VQSerialPortInfo@@@@XZ). [D:\programs\lorettAntennaXZ\build\app.vcxproj]
Qt5SerialPort.lib(qserialportinfo_win.obj) : error LNK2019: ссылка на неразрешенный внешний символ __imp_SetupDiDestroy
DeviceInfoList в функции "public: static class QList<class QSerialPortInfo> __cdecl QSerialPortInfo::availablePorts(voi
d)" (?availablePorts@QSerialPortInfo@@SA?AV?$QList@VQSerialPortInfo@@@@XZ). [D:\programs\lorettAntennaXZ\build\app.vcxp
roj]
Qt5SerialPort.lib(qserialportinfo_win.obj) : error LNK2019: ссылка на неразрешенный внешний символ __imp_SetupDiGetClas
sDevsW в функции "public: static class QList<class QSerialPortInfo> __cdecl QSerialPortInfo::availablePorts(void)" (?av
ailablePorts@QSerialPortInfo@@SA?AV?$QList@VQSerialPortInfo@@@@XZ). [D:\programs\lorettAntennaXZ\build\app.vcxproj]
Qt5SerialPort.lib(qserialportinfo_win.obj) : error LNK2019: ссылка на неразрешенный внешний символ __imp_SetupDiOpenDev
RegKey в функции "class QString __cdecl devicePortName(void *,struct _SP_DEVINFO_DATA *)" (?devicePortName@@YA?AVQStrin
g@@PEAXPEAU_SP_DEVINFO_DATA@@@Z). [D:\programs\lorettAntennaXZ\build\app.vcxproj]
Qt5SerialPort.lib(qserialportinfo_win.obj) : error LNK2019: ссылка на неразрешенный внешний символ __imp_SetupDiGetDevi
ceRegistryPropertyW в функции "class QString __cdecl deviceRegistryProperty(void *,struct _SP_DEVINFO_DATA *,unsigned l
ong)" (?deviceRegistryProperty@@YA?AVQString@@PEAXPEAU_SP_DEVINFO_DATA@@K@Z). [D:\programs\lorettAntennaXZ\build\app.vc
xproj]
Qt5SerialPort.lib(qserialportinfo_win.obj) : error LNK2019: ссылка на неразрешенный внешний символ __imp_CM_Get_Device_
IDW в функции "class QString __cdecl deviceInstanceIdentifier(unsigned long)" (?deviceInstanceIdentifier@@YA?AVQString@
@K@Z). [D:\programs\lorettAntennaXZ\build\app.vcxproj]
Qt5SerialPort.lib(qserialportinfo_win.obj) : error LNK2019: ссылка на неразрешенный внешний символ __imp_CM_Get_DevNode
_Status в функции "class QString __cdecl deviceSerialNumber(class QString,unsigned long)" (?deviceSerialNumber@@YA?AVQS
tring@@V1@K@Z). [D:\programs\lorettAntennaXZ\build\app.vcxproj]
Qt5SerialPort.lib(qserialportinfo_win.obj) : error LNK2019: ссылка на неразрешенный внешний символ __imp_CM_Get_Parent
в функции "class QString __cdecl deviceSerialNumber(class QString,unsigned long)" (?deviceSerialNumber@@YA?AVQString@@V
1@K@Z). [D:\programs\lorettAntennaXZ\build\app.vcxproj]
D:\programs\lorettAntennaXZ\build\Release\app.exe : fatal error LNK1120: неразрешенных внешних элементов: 11 [D:\progra
ms\lorettAntennaXZ\build\app.vcxproj]
Error messages are a bit difficult to understand if not in English, it seems Russian, and it seems that those are linking errors. They don't look directly related to the serial port, but something different.
It would be necessary to have something that we can reproduce, ideally a minimal main.cpp
, a minimal CMakeLists.txt
and the minimal conanfile
to make it fail that way.
Hi @lpmrfentazis
Any update here? Did you manage to solve those link errors?
Closing this ticket as inactive and staled, please re-open or create new tickets if necessary.
What is your question?
Hi, this is my first time working with conan, I am trying to convert my colleague's project from qmake to cmake+conan, but ran into the fact that I can't seem to get QSerialPort, although the other parts of QT have been obtained.
Have you read the CONTRIBUTING guide?