QtCompile icon indicating copy to clipboard operation
QtCompile copied to clipboard

:-1: error: LNK1181: 无法打开输入文件“libssl.lib”

Open x-tools-author opened this issue 3 months ago • 5 comments

编译程序出现以下错误::-1: error: LNK1181: 无法打开输入文件“libssl.lib” 使用的包是:Qt6.5.3-Windows-x86_64-VS2022-17.9.0-staticFull-20240216 是我打开的姿势有问题吗,大佬教教我

x-tools-author avatar Mar 31 '24 10:03 x-tools-author

I known, just copy the libs(libcrypto.lib and libssl.lib) to the path[D:\Jenkins10\workspace\Qt\q6_5wx6v2sf\buildDir\OpenSSL3.0.13-Windows-x86_64-VS2022-17.9.0-static\lib]

Edit by Fsu0413: Not proper workaround from my point of view. Just add LIBS += -L$$[QT_INSTALL_LIBS] in your .pro file and it's done.

x-tools-author avatar Mar 31 '24 10:03 x-tools-author

~~So the library path is (again!) hardcoded in the configuration files.~~ ~~It is include path and library path which needs to be set in CMake scripts instead of CMake variable OPENSSL_ROOT_DIR~~

https://github.com/Fsu0413/Fs-scripts/blob/acff47a26738c29d78bf3119f49e53c60ddaa879/Compile/lib/qtCompile/conf.lua#L4031

The resulting files are as I expected (-L / -l combination) and the static libraries are put into $$[QT_INSTALL_LIBS] as probably automatically specified by Qt. The directory specified by -L may not exist. I wonder if Qt 6.5.3 really don't add -L$$[QT_INSTALL_LIBS] in the prl files. If that's the case it'll be frustrating. The replacement should be done in every static package.

Fsu0413 avatar Mar 31 '24 10:03 Fsu0413

I don't think there is any problem building with CMake.

CMake use CMAKE_PREFIX_PATH variable which finds the libssl.lib and libcrypto.lib automatically in the lib directory.

Since prl files may be used only by qmake so....

Fsu0413 avatar Mar 31 '24 13:03 Fsu0413

The only solution I came up with is to add QMAKE_PRL_LIBS += -L$$[QT_INSTALL_LIBS] to QtCore.prl In theory every Qt version needs this one or OpenSSL and MariaDB static libraries can't be linked.

Fsu0413 avatar Apr 01 '24 12:04 Fsu0413

我也遇到了这个问题,我使用VS2022工程编译,我应该在sln工程怎么设置?

Obsidian200 avatar Apr 26 '24 18:04 Obsidian200

我也遇到了这个问题,我使用VS2022工程编译,我应该在sln工程怎么设置? 将bin目录下的libcrypto.lib 和libssl.lib复制到D:\Jenkins10\workspace\Qt\q6_5wx6v2sf\buildDir\OpenSSL3.0.13-Windows-x86_64-VS2022-17.9.0-static\lib (上面的路径自己建)

x-tools-author avatar Apr 28 '24 00:04 x-tools-author

我也遇到了这个问题,我使用VS2022工程编译,我应该在sln工程怎么设置?

我为了这个问题现场装了 Qt VS Tools。。。。。平时我不用VS的

右键工程 Properties -> Linker -> All Options 右边列表找到 Additional Library Directories 添加一项 $(QtInstallDir)/lib

Fsu0413 avatar Apr 28 '24 00:04 Fsu0413

主要是我不太想deploy后改这个东西。。。。。。。。 包括macOS还有rpath的问题,都是要deploy之后改的,我现在也不知道有没有什么好办法统一处理一下

Fsu0413 avatar Apr 28 '24 00:04 Fsu0413

解决: #25 简单来说:在 Windows / macOS 上不再于静态构建中附带 OpenSSL。

这个 issue 我关了。如果要追进度的化,看 #25。


Solution: #25 tl;dr: No longer ships OpenSSL with static builds on Windows / macOS.

This ticket will be closed. For future progress please refer to #25 .

Fsu0413 avatar May 10 '24 13:05 Fsu0413