Coder Social home page Coder Social logo

[poco] MTd link failure about vcpkg HOT 10 OPEN

az-faro avatar az-faro commented on August 26, 2024
[poco] MTd link failure

from vcpkg.

Comments (10)

az-faro avatar az-faro commented on August 26, 2024 2

Well this is exactly all the code in the test project I made to illustrate the issue. I think it's safe to say I'm not forcing PocoFoundationmtd to load.

#include <iostream>
#include "Poco/URI.h"

int main()
{
    std::cout << "Hello World!\n";
}

from vcpkg.

FrankXie05 avatar FrankXie05 commented on August 26, 2024

@az-faro Thanks for posting this issue, I think we have included the debug path correctly, can you rerun the command ./vcpkg integrate install and try again?

<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib;$(_ZVcpkgCurrentInstalledDir)$(_ZVcpkgConfigSubdir)lib\manual-link</AdditionalLibraryDirectories>

from vcpkg.

az-faro avatar az-faro commented on August 26, 2024

Hello @FrankXie05. This indeed now works correctly in debug.

The same issue persists in release though. I know I didn't mention that in the original bug report, but it's exactly the same issue in release as there is in debug.

from vcpkg.

az-faro avatar az-faro commented on August 26, 2024

Actually, upon closer inspection this still doesn't work for me. Using the latest version of vcpkg and poco 1.13.3 still shows exactly the same issue:

Build started...
1>------ Build started: Project: PocoTest, Configuration: Debug x64 ------
1>Installing vcpkg dependencies to C:\work\unversioned\PocoTest\vcpkg_installed\x64-windows
1>"C:\work\vcpkg\vcpkg\vcpkg.exe" install --x-wait-for-lock --triplet "x64-windows" --vcpkg-root "C:\work\vcpkg\vcpkg\" "--x-manifest-root=C:\work\unversioned\PocoTest\" "--x-install-root=C:\work\unversioned\PocoTest\vcpkg_installed\x64-windows\"
1>Detecting compiler hash for triplet x64-windows...
1>Compiler found: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
1>The following packages will be built and installed:
1> * expat:[email protected]
1> * pcre2[core,jit,platform-default-features]:[email protected]
1> poco:[email protected]
1> * vcpkg-cmake:x64-windows@2024-04-18
1> * vcpkg-cmake-config:x64-windows@2022-02-06#1
1> * zlib:[email protected]
1>Additional packages (*) will be modified to complete this operation.
1>Restored 6 package(s) from C:\Users\ZettersA\AppData\Local\vcpkg\archives in 5.1 s. Use --debug to see more details.
1>Installing 1/6 vcpkg-cmake:x64-windows@2024-04-18...
1>Elapsed time to handle vcpkg-cmake:x64-windows: 37 ms
1>vcpkg-cmake:x64-windows package ABI: 8b42a42ed1bdf897a526265f62c948a0025fbd3832eec15b9a644732e1bb56a2
1>Installing 2/6 zlib:[email protected]...
1>Elapsed time to handle zlib:x64-windows: 34.9 ms
1>zlib:x64-windows package ABI: 3ea500905e5b64da0a81e1616c29e8ecb067f2cfd89cceaedb122747f77d9a4d
1>Installing 3/6 vcpkg-cmake-config:x64-windows@2022-02-06#1...
1>Elapsed time to handle vcpkg-cmake-config:x64-windows: 16.7 ms
1>vcpkg-cmake-config:x64-windows package ABI: f2b3d24fa2b61fe3ca168cfb265f3c64a3cf82219fbeac798ca0317c7303e895
1>Installing 4/6 pcre2[core,jit,platform-default-features]:[email protected]...
1>Elapsed time to handle pcre2:x64-windows: 68.4 ms
1>pcre2:x64-windows package ABI: f029c303a48d9a6057ef886c81d05aec6e03b71e896d43090ba461a1d05dc104
1>Installing 5/6 expat:[email protected]...
1>Elapsed time to handle expat:x64-windows: 38.3 ms
1>expat:x64-windows package ABI: 92b9ffebe49c1fb841b90332f61195f5135143ff108dc6dc900e0bca216ee815
1>Installing 6/6 poco:[email protected]...
1>Elapsed time to handle poco:x64-windows: 886 ms
1>poco:x64-windows package ABI: a60bfe72fb139c264257e556727ee7396625f9a26a9e01bc5ffdfce931bb81e7
1>Total install time: 1.1 s
1>The package poco is compatible with built-in CMake targets:
1>
1> find_package(Poco REQUIRED [COMPONENTS ...])
1> target_link_libraries(main PRIVATE Poco::)
1>
1>PocoTest.cpp
1>LINK : fatal error LNK1104: cannot open file 'PocoFoundationmtd.lib'
1>Done building project "PocoTest.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

from vcpkg.

dg0yt avatar dg0yt commented on August 26, 2024
  1. Add {"name":"poco", "platform": "x64|windows"} to vcpkg.json.

Note that this request to install poco when you build "for x64 or for windows".
It does not set what type of lib to build. You have to set the vcpkg target triplet for that choice.

The PocoFoundatinmtd.lib is correctly built, it's just the linking that is incorrect.

Are you sure? The log says

1>Installing 6/6 poco:[email protected]...

And that package builds (CI logs):

poco:x64-windows:/debug/lib/PocoFoundationd.lib
poco:x64-windows:/lib/PocoFoundation.lib

from vcpkg.

az-faro avatar az-faro commented on August 26, 2024
  1. Add {"name":"poco", "platform": "x64|windows"} to vcpkg.json.

Note that this request to install poco when you build "for x64 or for windows". It does not set what type of lib to build. You have to set the vcpkg target triplet for that choice.

As far as I understand Visual Studio will decide which triplet to use depending on which configuration I choose to build and if I configure that I want to use static libraries or not.

The PocoFoundatinmtd.lib is correctly built, it's just the linking that is incorrect.

Are you sure? The log says

1>Installing 6/6 poco:[email protected]...

And that package builds (CI logs):

poco:x64-windows:/debug/lib/PocoFoundationd.lib poco:x64-windows:/lib/PocoFoundation.lib

Well that's the issue then isn't it? if it builds those version and then tries to link the mtd version? I don't choose which version to link, vcpkg does.

from vcpkg.

dg0yt avatar dg0yt commented on August 26, 2024

I don't choose which version to link, vcpkg does.

Does it? I assume you use msbuild, not CMake. Vcpkg uses "autolinking" for msbuild. It would choose exactly (all!) the files which are there.
However, if a source or header has a #pragma comment(lib PocoFoundatinmtd), the linker wants to have that lib, too. If such a header is installed by vcpkg, it is a bug. But quite often users find such lines in own code or non-vcpkg dependencies.

from vcpkg.

dg0yt avatar dg0yt commented on August 26, 2024

PocoFoundationmtd.lib belongs to the x64-windows-static triplet (static library linkage, static CRT linkage).

Use Static Libraries is set to No

I don't know if this is or should be passed to vcpkg. (Still not using Visual Something.)
I still believe that "You have to set the vcpkg target triplet":
https://learn.microsoft.com/en-us/vcpkg/users/buildsystems/msbuild-integration#vcpkgtriplet

from vcpkg.

dg0yt avatar dg0yt commented on August 26, 2024

And obviously "Use Static Libraries is set to No" poorly fits x64-windows-static.

from vcpkg.

az-faro avatar az-faro commented on August 26, 2024

I think it chooses the correct triplet x64-windows as seen in the logs. It's just that then when selecting which library to import it seems to take that from the project settings (i.e. that the runtime library is set to MTd), rather than the vcpkg settings Use Static Libraries = No.

from vcpkg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.