Fsu0413 / QtCompile

Personal build of Qt5 onwards, with SSL builtin. Multiple configuration available.
https://build-qt.fsu0413.me/
101 stars 12 forks source link

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

Closed x-tools-author closed 6 months ago

x-tools-author commented 8 months ago

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

x-tools-author commented 8 months ago

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.

Fsu0413 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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.

Obsidian200 commented 7 months ago

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

x-tools-author commented 7 months ago

我也遇到了这个问题,我使用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 (上面的路径自己建)

Fsu0413 commented 7 months ago

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

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

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

Fsu0413 commented 7 months ago

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

Fsu0413 commented 6 months ago

解决: #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 .