当前位置: 首页 > news >正文

当使用vcpkg安装的qt5时,在VS调用出现libcrypto-*-x64.dll不是有效路径时

英文解决站点

applocal.ps1 fails in Visual Studio 2019 because of wildcard path in VcpkgAppLocalDLLs · Issue #28614 · microsoft/vcpkg

 虽然这个bug不影响生成exe文件,第一次会弹出该错误,再次运行就正常,vcpkg会把对应的libcrypto-*-x64.dll版本复制到exe路径下..但是对于强迫症来说,还是别扭的.

找到vcpkg安装路径中  

release版路径

installed\<环境路径>\plugins\qtdeploy.ps1

# This script is based on the implementation of windeployqt for qt5.7.1
#
# Qt's plugin deployment strategy is that each main Qt Module has a hardcoded
# set of plugin subdirectories. Each of these subdirectories is deployed in
# full if that Module is referenced.
#
# This hardcoded list is found inside qttools\src\windeployqt\main.cpp. For
# updating, inspect the symbols qtModuleEntries and qtModuleForPlugin.

# Note: this function signature and behavior is depended upon by applocal.ps1
function deployPluginsIfQt([string]$targetBinaryDir, [string]$QtPluginsDir, [string]$targetBinaryName) {
    $baseDir = Split-Path $QtPluginsDir -parent
    $binDir = "$baseDir\bin"

    function deployPlugins([string]$pluginSubdirName) {
        if (Test-Path "$QtPluginsDir\$pluginSubdirName") {
            Write-Verbose "  Deploying plugins directory '$pluginSubdirName'"
            New-Item "$targetBinaryDir\plugins\$pluginSubdirName" -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
            Get-ChildItem "$QtPluginsDir\$pluginSubdirName\*.dll" | % {
                deployBinary "$targetBinaryDir\plugins\$pluginSubdirName" "$QtPluginsDir\$pluginSubdirName" $_.Name
                resolve "$targetBinaryDir\plugins\$pluginSubdirName\$($_.Name)"
            }
        } else {
            Write-Verbose "  Skipping plugins directory '$pluginSubdirName': doesn't exist"
        }
    }

    # We detect Qt modules in use via the DLLs themselves. See qtModuleEntries in Qt to find the mapping.
    if ($targetBinaryName -match "Qt5Cored?.dll") {
        if (!(Test-Path "$targetBinaryDir\qt.conf")) {
            "[Paths]" | Out-File -encoding ascii "$targetBinaryDir\qt.conf"
        }
    } elseif ($targetBinaryName -match "Qt5Guid?.dll") {
        Write-Verbose "  Deploying platforms"
        New-Item "$targetBinaryDir\plugins\platforms" -ItemType Directory -ErrorAction SilentlyContinue | Out-Null
        Get-ChildItem "$QtPluginsDir\platforms\qwindows*.dll" | % {
            deployBinary "$targetBinaryDir\plugins\platforms" "$QtPluginsDir\platforms" $_.Name
        }

        deployPlugins "accessible"
        deployPlugins "imageformats"
        deployPlugins "iconengines"
        deployPlugins "platforminputcontexts"
        deployPlugins "styles"
    } elseif ($targetBinaryName -match "Qt5Networkd?.dll") {
        deployPlugins "bearer"
        if (Test-Path "$binDir\libcrypto-3-x64.dll")
        {
            deployBinary "$targetBinaryDir" "$binDir" "libcrypto-3-x64.dll"
            deployBinary "$targetBinaryDir" "$binDir" "libssl-3-x64.dll"
        }
        if (Test-Path "$binDir\libcrypto-3.dll")
        {
            deployBinary "$targetBinaryDir" "$binDir" "libcrypto-3.dll"
            deployBinary "$targetBinaryDir" "$binDir" "libssl-3.dll"
        }
    } elseif ($targetBinaryName -match "Qt5Sqld?.dll") {
        deployPlugins "sqldrivers"
    } elseif ($targetBinaryName -match "Qt5Multimediad?.dll") {
        deployPlugins "audio"
        deployPlugins "mediaservice"
        deployPlugins "playlistformats"
    } elseif ($targetBinaryName -match "Qt5PrintSupportd?.dll") {
        deployPlugins "printsupport"
    } elseif ($targetBinaryName -match "Qt5Qmld?.dll") {
        if(!(Test-Path "$targetBinaryDir\qml"))
        {
            if (Test-Path "$binDir\..\qml") {
                cp -r "$binDir\..\qml" $targetBinaryDir
            } elseif (Test-Path "$binDir\..\..\qml") {
                cp -r "$binDir\..\..\qml" $targetBinaryDir
            } else {
                throw "FAILED"
            }
        }
        foreach ($a in @("Qt5Quick", "Qt5Quickd", "Qt5QmlModels", "Qt5QmlModelsd", "Qt5QuickControls2", "Qt5QuickControls2d", "Qt5QuickShapes", "Qt5QuickShapesd", "Qt5QuickTemplates2", "Qt5QuickTemplates2d", "Qt5QmlWorkerScript", "Qt5QmlWorkerScriptd", "Qt5QuickParticles", "Qt5QuickParticlesd", "Qt5QuickWidgets", "Qt5QuickWidgetsd"))
        {
            if (Test-Path "$binDir\$a.dll")
            {
                deployBinary "$targetBinaryDir" "$binDir" "$a.dll"
            }
        }
        deployPlugins "scenegraph"
        deployPlugins "qmltooling"
    } elseif ($targetBinaryName -match "Qt5Quickd?.dll") {
        foreach ($a in @("Qt5QuickControls2", "Qt5QuickControls2d", "Qt5QuickShapes", "Qt5QuickShapesd", "Qt5QuickTemplates2", "Qt5QuickTemplates2d", "Qt5QmlWorkerScript", "Qt5QmlWorkerScriptd", "Qt5QuickParticles", "Qt5QuickParticlesd", "Qt5QuickWidgets", "Qt5QuickWidgetsd"))
        {
            if (Test-Path "$binDir\$a.dll")
            {
                deployBinary "$targetBinaryDir" "$binDir" "$a.dll"
            }
        }
        deployPlugins "scenegraph"
        deployPlugins "qmltooling"
    } elseif ($targetBinaryName -like "Qt5Declarative*.dll") {
        deployPlugins "qml1tooling"
    } elseif ($targetBinaryName -like "Qt5Positioning*.dll") {
        deployPlugins "position"
    } elseif ($targetBinaryName -like "Qt5Location*.dll") {
        deployPlugins "geoservices"
    } elseif ($targetBinaryName -like "Qt5Sensors*.dll") {
        deployPlugins "sensors"
        deployPlugins "sensorgestures"
    } elseif ($targetBinaryName -like "Qt5WebEngineCore*.dll") {
        deployPlugins "qtwebengine"
    } elseif ($targetBinaryName -like "Qt53DRenderer*.dll") {
        deployPlugins "sceneparsers"
    } elseif ($targetBinaryName -like "Qt5TextToSpeech*.dll") {
        deployPlugins "texttospeech"
    } elseif ($targetBinaryName -like "Qt5SerialBus*.dll") {
        deployPlugins "canbus"
    }
}

        将文件中出现 libcrypto-*-x64.dll ,libssl-*-x64.dll中的*直接改为编译好的dll中的数字,笔者的vcpkg中的版本为3,所以改成了3就正常了,反正就是不要出现*号通配符.

deployPlugins "bearer"
        if (Test-Path "$binDir\libcrypto-*-x64.dll")
        {
            deployBinary "$targetBinaryDir" "$binDir" "libcrypto-*-x64.dll"
            deployBinary "$targetBinaryDir" "$binDir" "libssl-*-x64.dll"
        }
        if (Test-Path "$binDir\libcrypto-*.dll")
        {
            deployBinary "$targetBinaryDir" "$binDir" "libcrypto-*.dll"
            deployBinary "$targetBinaryDir" "$binDir" "libssl-*.dll"
        }

改为:

deployPlugins "bearer"
        if (Test-Path "$binDir\libcrypto-3-x64.dll")
        {
            deployBinary "$targetBinaryDir" "$binDir" "libcrypto-3-x64.dll"
            deployBinary "$targetBinaryDir" "$binDir" "libssl-3-x64.dll"
        }
        if (Test-Path "$binDir\libcrypto-3.dll")
        {
            deployBinary "$targetBinaryDir" "$binDir" "libcrypto-3.dll"
            deployBinary "$targetBinaryDir" "$binDir" "libssl-3.dll"
        }

debug版路径 

笔者电脑路径: G:\vcpkg\installed\x64-windows\debug\plugins

直接将release版本改好的替换即可,32位环境下也是一样的

相关文章:

  • Design Compiler:边界优化(Boundary Optimization)
  • nginx ngx_http_module(7) 指令详解
  • 从函数到神经网络
  • 解锁机器学习核心算法 | K-平均:揭开K-平均算法的神秘面纱
  • Unity性能优化个人经验总结(不定期更新)
  • 如何在本机上模拟IP地址
  • 金融交易算法单介绍
  • 在系统中如何集成限流组件单机和集群
  • 车载音频配置(二)
  • 基于javaweb的SpringBoot校园二手商品系统设计和实现(源码+文档+部署讲解)
  • 使用 NVM 随意切换 Node.js 版本
  • .NET周刊【2月第2期 2025-02-09】
  • Linux基础25-C语言之分支结构Ⅱ【入门级】
  • Flutter - 初体验
  • XML DOM 高级
  • 15. 三数之和(LeetCode 热题 100)
  • PyCharm Terminal 自动切换至虚拟环境
  • Jredis和SpringDataRedis学习笔记
  • 大数据开发治理平台~DataWorks(核心功能汇总)
  • AI 编程助手 cursor的系统提示词 prompt
  • 中国社科院:网文市场超430亿元,作者破3000万人
  • 时代中国控股:前4个月销售额18.1亿元,境外债重组协议押后聆讯至5月底
  • 宇数科技王兴兴:第一桶金来自上海,欢迎上海的年轻人加入
  • 印度一战机在巴基斯坦旁遮普省被击落,飞行员被俘
  • 网络主播直播泄机密,别让这些“小事”成威胁国家安全的“突破口”
  • 工行回应两售出金条发现疑似杂质:情况不属实,疑似杂质应为金条售出后的外部附着物