Skip to content

x64-debug has link error, x64-Release build success #143

Description

@huiseliming

In Windows using CMake

F:\vcpkg>vcpkg version
skyr-url install by vcpkg
Vcpkg package management program version 2020.02.04-nohash

See LICENSE.txt for license information.

windows\debug\lib\libcrypto.lib F:\vcpkg\installed\x64-windows\debug\lib\fmtd.lib F:\vcpkg\installed\x64-windows\lib\skyr-url.lib F:\vcpkg\installed\x64-windows\debug\lib\gtestd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:tests\CMakeFiles\tests.dir/intermediate.manifest tests\CMakeFiles\tests.dir/manifest.res" failed (exit code 1319) with the following output:
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(url_search_parameters.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(url_search_parameters.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(url.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(url.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(ipv4_address.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(ipv4_address.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(ipv6_address.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(ipv6_address.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(domain.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(domain.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(parse.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(parse.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(punycode.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(punycode.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(idna.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(idna.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(url_parser_context.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(url_parser_context.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(host.cpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\skyr-url.lib(host.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in GreyDawnNetworkTest.cpp.obj
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
G:\GreyDawnModule\GreyDawnNetwork\out\build\x64-Debug\bin\tests.exe : fatal error LNK1319: 20 mismatches detected
ninja: build stopped: subcommand failed.

Build All failed.

Activity

  1. github-actions commented on Aug 7, 2020

    @github-actions

    Thanks for using the library and creating an issue report!

  2. self-assigned this
    on Aug 7, 2020
  3. added this to the v2.0 milestone on Aug 7, 2020
  4. coreprocess commented on Aug 11, 2020

    @coreprocess

    @huiseliming here is what you can add right after the find_package call to make it work:

    # Import target "skyr::skyr-url" for configuration "Debug"
    set_property(TARGET skyr::skyr-url APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
    set_target_properties(skyr::skyr-url PROPERTIES
      IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
      IMPORTED_LOCATION_DEBUG "${VCPKG_ROOT}/installed/x64-windows/debug/lib/skyr-urld.lib"
    )
    
  5. glynos commented on Aug 11, 2020

    @glynos
    Member

    Thanks for the response, @Core-Process

    It's not easy for me to test using this library on Windows using the package manager. Do you think it's sufficient to add this as a comment in the README file, or can I add that somewhere in the install set up?

  6. shrinktofit commented on Sep 4, 2020

    @shrinktofit

    @Core-Process ${VCPKG_ROOT} is empty on VS2019

  7. emmenlau commented on Mar 31, 2021

    @emmenlau

    I'm sorry to jump into this thread but I think think this is not an issue of url. The build log shows a mismatch of Visual Studio setting _ITERATOR_DEBUG_LEVEL. This can happen for example if you use the project https://github.com/xtensor-stack/xtensor, that requires _ITERATOR_DEBUG_LEVEL=0. The clean solution is to compile all your projects with the same setting for _ITERATOR_DEBUG_LEVEL. This may be achieved inside vcpkg, or possibly by setting CPPFLAGS="/D_ITERATOR_DEBUG_LEVEL=0" before building the first package.

    I do not think there is anything this package here can (or should) do.

  8. coreprocess commented on Mar 31, 2021

    @coreprocess

    @emmenlau if that is true, why is it going away with the simple snippet above? :-)

  9. coreprocess commented on Mar 31, 2021

    @coreprocess

    @glynos Its like the debug configuration is not exported properly. I am not a vcpkg expert, therefore unfortunately I have no idea what you would have to do differently.

  10. emmenlau commented on Mar 31, 2021

    @emmenlau

    @emmenlau if that is true, why is it going away with the simple snippet above? :-)

    Without reading the snippet above I would assume that this would be a possible solution to the problem. But in my humble opinion its not the clean solution.

    Giving flags like _ITERATOR_DEBUG_LEVEL=0 (or similar flags, like /arch:AVX2 or /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS etcetc) can, and should be, completely in users hands. I.e. with a cmake-based build, set the variables CFLAGS and/or CXXFLAGS accordingly, they will be respected by all cmake projects (unless the project explicitly removes flags, which is highly unlikely and probably an error).

    On a related note, we build literally hundreds of packages with cmake (and even a few other build systems like Perl for OpenSSL) on many platforms, including MSVC with both the Visual Studio Compiler and the Clang compiler. On MSVC we use _ITERATOR_DEBUG_LEVEL=0 amongst other flags for all packages, otherwise they are binary incompatible. None of the packages does anything special to respect or support this setting.

    This works with url (amongst many others) without problems.

  11. coreprocess commented on Mar 31, 2021

    @coreprocess

    @emmenlau The snippet just makes sure that it links to "skyr-urld.lib" and not "skyr-url.lib" for DEBUG builds. And it fixes the problem here. Maybe it is something that needs to be fixed in this library? ;-)

  12. emmenlau commented on Mar 31, 2021

    @emmenlau

    @coreprocess Maybe I'm missing something but can you say why current url would not already link "skyr-urld.lib"?

    I see in my windows build:

    #> grep -Irn "urld" lib/cmake/skyr-url
    lib/cmake/skyr-url/skyr-url-targets-debug.cmake:12:  IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/skyr-urld.lib"
    lib/cmake/skyr-url/skyr-url-targets-debug.cmake:16:list(APPEND _IMPORT_CHECK_FILES_FOR_skyr::skyr-url "${_IMPORT_PREFIX}/lib/skyr-urld.lib" )

    Why do you think cmake would not link urld? At least in "plain" cmake this just works.

  13. coreprocess commented on Mar 31, 2021

    @coreprocess

    @emmenlau Interesting, that skyr-url-targets-debug.cmake does not get generated here. At least that is a lead we can have a look at.

  14. emmenlau commented on Mar 31, 2021

    @emmenlau

    @coreprocess Yes maybe there is really something fundamentally different in how vcpkg builds or uses cmake. Thanks for following this up!

  15. glynos commented on Apr 1, 2021

    @glynos
    Member

    Thanks for following up! I'm not ignoring this thread, but I don't know yet how to apply a fix here, or if it's something to do with the configuration of vcpkg. I will take a look.

  16. added a commit that references this issue on Mar 18, 2024
    3f9954e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions