KDAB / KDSoap

A Qt-based client-side and server-side SOAP component
https://www.kdab.com/development-resources/qt-tools/kd-soap
Other
146 stars 92 forks source link

(CMake-VCPKG) KDSoap 1.9 build issue #263

Open VictorKozachek opened 1 year ago

VictorKozachek commented 1 year ago

Hello,

Trying to build build our project which deals with KDSoap. We use QT5. As for KDSoap 1.8 we can't see any problem. We are trying to get KDSoapfrom VCPKG and that's OK. We can see libraries ets. The only problem is that KDSoap installs kdwsdl2cpp.exe into incorrect folder. It installs it to \builds\vcpkg-static\vcpkg_installed\x86-windows-static\tools instead of builds\vcpkg-static\vcpkg_installed\x86-windows-static\tools\kd-soap and thentrying to find it by correct path. That's not a big problem, we can move it manually. But.... Ok.

The bigest problem is that we can't build project due to linker problems. Wecan see such errors:

[build] mocs_compilation_Debug.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void * __thiscall KDSoapJob::qt_metacast(char const *)" (__imp_?qt_metacast@KDSoapJob@@UAEPAXPBD@Z) referenced in function "public: virtual void * __thiscall AbdicateDomOwnershipJob::qt_metacast(char const *)" (?qt_metacast@AbdicateDomOwnershipJob@@UAEPAXPBD@Z)
[build] mocs_compilation_Debug.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual int __thiscall KDSoapJob::qt_metacall(enum QMetaObject::Call,int,void * *)" (__imp_?qt_metacall@KDSoapJob@@UAEHW4Call@QMetaObject@@HPAPAX@Z) referenced in function "public: virtual int __thiscall AbdicateDomOwnershipJob::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@AbdicateDomOwnershipJob@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
[build] mocs_compilation_Debug.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static struct QMetaObject const KDSoapJob::staticMetaObject" (__imp_?staticMetaObject@KDSoapJob@@2UQMetaObject@@B) referenced in function "public: static struct QMetaObject const * __cdecl QMetaObject::staticMetaObject<&public: static struct QMetaObject const KDSoapJob::staticMetaObject>(void)" (??$staticMetaObject@$1?staticMetaObject@KDSoapJob@@2UQMetaObject@@B@QMetaObject@@SAPBU0@XZ)
[build] error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct QMetaObject const KDSoapJob::staticMetaObject" (__imp_?staticMetaObject@KDSoapJob@@2UQMetaObject@@B)
[build] error LNK2001: unresolved external symbol "__declspec(dllimport) public: static struct QMetaObject const KDSoapJob::staticMetaObject" (__imp_?staticMetaObject@KDSoapJob@@2UQMetaObject@@B)
[build] error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall KDSoapJob::start(void)" (__imp_?start@KDSoapJob@@QAEXXZ) referenced in function "protected: class KDSoapJob * __thiscall EsxiClient::startJob(class KDSoapJob *)" (?startJob@EsxiClient@@IAEPAVKDSoapJob@@PAV2@@Z)
[build] error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall KDSoapJob::start(void)" (__imp_?start@KDSoapJob@@QAEXXZ)
[build] error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall KDSoapJob::finished(class KDSoapJob *)" (__imp_?finished@KDSoapJob@@QAEXPAV1@@Z) referenced in function "protected: class KDSoapJob * __thiscall EsxiClient::startJob(class KDSoapJob *)" (?startJob@EsxiClient@@IAEPAVKDSoapJob@@PAV2@@Z)
[build] error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall KDSoapJob::finished(class KDSoapJob *)" (__imp_?finished@KDSoapJob@@QAEXPAV1@@Z)
[build] error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall KDSoapClientInterface::setSslConfiguration(class QSslConfiguration const &)" (__imp_?setSslConfiguration@KDSoapClientInterface@@QAEXABVQSslConfiguration@@@Z) referenced in function "public: void __thiscall EsxiClient::init(class QString const &)" (?init@EsxiClient@@QAEXABVQString@@@Z)
[build] error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall KDSoapClientInterface::setSslConfiguration(class QSslConfiguration const &)" (__imp_?setSslConfiguration@KDSoapClientInterface@@QAEXABVQSslConfiguration@@@Z)
[build] error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall KDSoapClientInterface::timeout(void)const " (__imp_?timeout@KDSoapClientInterface@@QBEHXZ) referenced in function "public: int __thiscall EsxiClient::timeout(void)const " (?timeout@EsxiClient@@QBEHXZ)
[build] error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall KDSoapClientInterface::setTimeout(int)" (__imp_?setTimeout@KDSoapClientInterface@@QAEXH@Z) referenced in function "public: void __thiscall EsxiClient::setTimeout(int)" (?setTimeout@EsxiClient@@QAEXH@Z)

We can't see such problem for KDSoap 1.8

Thanks

winterz commented 1 year ago

I'm a bit confused. is the link failing when built with vcpkg recipe? or normally outside of vcpkg?

I don't know where you're getting the vcpkg recipe for vcpkg -- we didn't provide one to my knowledge and I don't see kdsoap in the vcpkg/ports

VictorKozachek commented 1 year ago

hi. no. Building KDSoap 1.9 fromVCPKG is OK. I can't build my project when use KDSoap 1.9 from VCPKG

VictorKozachek commented 1 year ago

I use this template formy project https://github.com/lukka/CppCMakeVcpkgTemplate

Inside vcpkg.json I have:

{
  "name": "mycoolproject",
  "builtin-baseline": "50a4aa2be9c05e16d34c98369a8e1dd01796c3f0",
  "version-string": "2.5.0",
  "dependencies": [
    "zstd",
    "libsodium",
    "kd-soap",
    {
      "name": "libzip"
    },
    {
      "name": "qt5-base",
      "version>=": "5.15.9"
    },
    {
      "name": "qt5-websockets",
      "version>=": "5.15.9"
    },
    "openssl",
    "autobahn",
    "boost-dll",
    "boost-log",
    "boost-uuid",
    "boost-iostreams",
    "boost-locale",
    "boost-thread"
  ],
  "overrides": [
    {
      "name": "qt5-base",
      "version": "5.15.9"
    },
    {
      "name": "qt5-websockets",
      "version": "5.15.9"
    },
    {
      "name": "kd-soap",
      "version": "1.9.0"
    }
  ]
}

In CMakeLists.txt I have this:

add_library (${PROJECT_NAME} OBJECT)
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS})

target_sources(${PROJECT_NAME} PRIVATE ${SRC_FILES} ${HDR_FILES})

add_subdirectory(tasks)

find_package(KDSoap 1.9 CONFIG REQUIRED)

set (LIB_EXTRA_LINK_LIBS 
    Qt5::WinMain
    KDSoap::kdsoap
)
target_link_libraries( ${PROJECT_NAME} PRIVATE ${LIB_EXTRA_LINK_LIBS})

I can now configure my project withCMake and that will build and installVCPKG with KDSoap. During VCPKG building I can see such error:

1> [CMake] CMake Error at builds/mycoolproject-vcpkg-static/vcpkg_installed/x86-windows-static/share/KDSoap/KDSoapTargets.cmake:89 (message):
1> [CMake]   The imported target "KDSoap::kdwsdl2cpp" references the file
1> [CMake]
1> [CMake]      "D:/dev/mycoolproject/builds/mycoolproject-vcpkg-static/vcpkg_installed/x86-windows-static/tools/kd-soap/kdwsdl2cpp.exe"
1> [CMake]
1> [CMake]   but this file does not exist.  Possible reasons include:
1> [CMake]
1> [CMake]   * The file was deleted, renamed, or moved to another location.
1> [CMake]
1> [CMake]   * An install or uninstall procedure did not complete successfully.
1> [CMake]
1> [CMake]   * The installation package was faulty and contained
1> [CMake]
1> [CMake]      "D:/dev/mycoolproject/builds/mycoolproject-vcpkg-static/vcpkg_installed/x86-windows-static/share/KDSoap/KDSoapTargets.cmake"
1> [CMake]
1> [CMake]   but not all the files it references.
1> [CMake]
1> [CMake] Call Stack (most recent call first):
1> [CMake]   builds/mycoolproject-vcpkg-static/vcpkg_installed/x86-windows-static/share/KDSoap/KDSoapConfig.cmake:30 (include)
1> [CMake]   vcpkg/scripts/buildsystems/vcpkg.cmake:855 (_find_package)
1> [CMake]   esxi-integration/CMakeLists.txt:51 (find_package)
1> [CMake] -- Configuring incomplete, errors occurred!

That error is connected to the fact that KDSoap tool has been installed by wrong path. Yes,we can move that tool by correct path and it will configure project withut any problem, but we can't do such thing with autobuild, say with TeamCity.

Ok. After configuration I'm trying to build my project and can see linker errors.

If I use KDSoap 1.8 I will be able to build my project.

VictorKozachek commented 1 year ago

I'm trying to do that on VS 2022

winterz commented 1 year ago

I had no idea that there was a vcpkg port for kdsoap.

sorry, but this is something you'll need to discuss with the vcpkg people as we were not involved.

Hint: looking in the kd-soap portfile.cmake I see that they are building for Qt6

Hint2: we do provide recipes for homebrew and various linux distros. We solved the qt5/qt6 issue in those by providing recipes for kdsoap-qt5 and kdsoap-qt6

VictorKozachek commented 1 year ago

I use this port and master branch https://github.com/microsoft/vcpkg/tree/master/ports/kd-soap