Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
x-tools-author opened this issue Mar 31, 2024 · 9 comments
Closed
Labels

Comments

@x-tools-author
Copy link

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

@x-tools-author
Copy link
Author

x-tools-author commented Mar 31, 2024

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
Copy link
Owner

Fsu0413 commented Mar 31, 2024

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
Copy link
Owner

Fsu0413 commented Mar 31, 2024

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 Fsu0413 added the bug label Apr 1, 2024
@Fsu0413
Copy link
Owner

Fsu0413 commented Apr 1, 2024

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
Copy link

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

@x-tools-author
Copy link
Author

我也遇到了这个问题,我使用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
Copy link
Owner

Fsu0413 commented Apr 28, 2024

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

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

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

@Fsu0413
Copy link
Owner

Fsu0413 commented Apr 28, 2024

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

@Fsu0413
Copy link
Owner

Fsu0413 commented May 10, 2024

解决: #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 Fsu0413 closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2024
Fsu0413 added a commit that referenced this issue May 11, 2024
Fsu0413 added a commit that referenced this issue May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants