Open KnightJun opened 1 day ago
Bot detected the issue body's language is not English, translate it automatically.
Title: Use add_requires("openssl") under MacOS to specify the openssl1.x version. The actual version used during compilation is /opt/homebrew/Cellar/openssl@3/3.3.1
在工程目录的.xmake/macosx/arm64/cache/package文件里有这么一段:
openssl = {
static = true,
libfiles = {
"/opt/homebrew/Cellar/openssl@3/3.3.1/lib/libssl.a",
"/opt/homebrew/Cellar/openssl@3/3.3.1/lib/libcrypto.a"
},
sysincludedirs = "/opt/homebrew/Cellar/openssl@3/3.3.1/include",
links = {
"ssl",
"crypto"
},
__requirestr = "openssl",
envs = {
DYLD_LIBRARY_PATH = {
"/Users/knightjun/.xmake/packages/o/openssl/1.1.1-w/f82fa90c71a04249872bd914fd58164f/lib"
},
LD_LIBRARY_PATH = {
"/Users/knightjun/.xmake/packages/o/openssl/1.1.1-w/f82fa90c71a04249872bd914fd58164f/lib"
}
},
linkdirs = "/opt/homebrew/Cellar/openssl@3/3.3.1/lib",
version = "3.3.1",
__enabled = true
}
看起来是把repo里的信息和系统库的信息混起来了
Try add_requires("openssl", {system = false})
and xmake f -c
?
add_requires("openssl")
也没见你指定版本,你可以指定下 add_requires("openssl 1.x")
或者提 pr 改进下 openssl/fetch 限制只能找 1.x 的
Bot detected the issue body's language is not English, translate it automatically.
add_requires("openssl")
I don’t see the version you specified either.
add_requires("openssl")
也没见你指定版本,你可以指定下
add_requires("openssl 1.x")
或者提 pr 改进下 openssl/fetch 限制只能找 1.x 的
之前是试过指定版本的,不过后来去xmake repo里面看了一下,openssl里面都是1.x版本,另外有个openssl3专门用于openssl3.x版本,不过无论有没有指定版本,都是一样的
另外我试了手动安装openssl的package,结果会报错,xmake已经升级到了dev版本
xmake require -fvD openssl
/usr/bin/git rev-parse HEAD
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
-> openssl 1.1.1-w [runtimes:"MD"]
please input: y (y/n/m)
pinging the host(github.com) ... 65535 ms
/usr/bin/unzip -o OpenSSL_1_1_1w.zip -d source.tmp -x */fuzz/*
Archive: OpenSSL_1_1_1w.zip
这里省略一大堆解压过程
checking for the linker (ld) ... clang++
checking for flags (-fPIC) ... ok
> clang++ "-fPIC" "-target" "arm64-apple-macos10.15" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk" "-lz" "-target" "arm64-apple-macos10.15" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk" "-lz"
checking for the shared library linker (sh) ... clang++
./config --openssldir=/Users/knightjun/.xmake/packages/o/openssl/1.1.1-w/f82fa90c71a04249872bd914fd58164f --prefix=/Users/knightjun/.xmake/packages/o/openssl/1.1.1-w/f82fa90c71a04249872bd914fd58164f no-shared
Operating system: arm64-apple-darwinDarwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112
Configuring OpenSSL version 1.1.1w (0x1010117fL) for darwin64-arm64-cc
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile
**********************************************************************
*** ***
*** OpenSSL has been successfully configured ***
*** ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL file first) ***
*** ***
**********************************************************************
error: @programdir/modules/package/tools/make.lua:36: attempt to index a nil value (global 'compiler')
stack traceback:
[@programdir/modules/package/tools/make.lua:36]: in function '_map_compflags'
[@programdir/modules/package/tools/make.lua:56]: in function 'buildenvs'
[@programdir/modules/package/tools/make.lua:123]: in function 'make'
[@programdir/modules/package/tools/make.lua:160]: in function 'build'
[...ake/repositories/xmake-repo/packages/o/openssl/xmake.lua:141]: in function 'script'
[...dir/modules/private/action/require/impl/utils/filter.lua:114]: in function 'call'
[.../modules/private/action/require/impl/actions/install.lua:392]:
=> install openssl 1.1.1-w .. failed
error: @programdir/core/main.lua:329: @programdir/modules/async/runjobs.lua:325: .../modules/private/action/require/impl/actions/install.lua:494: install failed!
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:973]:
[.../modules/private/action/require/impl/actions/install.lua:494]: in function 'catch'
[@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
[.../modules/private/action/require/impl/actions/install.lua:361]:
[...modules/private/action/require/impl/install_packages.lua:496]: in function 'jobfunc'
[@programdir/modules/async/runjobs.lua:241]:
stack traceback:
[C]: in function 'error'
@programdir/core/base/os.lua:973: in function 'base/os.raiselevel'
(...tail calls...)
@programdir/core/main.lua:329: in upvalue 'cotask'
@programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>
另外我试了手动安装openssl的package,结果会报错,xmake已经升级到了dev版本 error: @programdir/modules/package/tools/make.lua:36: attempt to index a nil value (global 'compiler')
看错误行,根本不是最新版。
之前是试过指定版本的,不过后来去xmake repo里面看了一下,openssl里面都是1.x版本,另外有个openssl3专门用于openssl3.x版本,不过无论有没有指定版本,都是一样的 version = "3.3.1",
你这系统查找的能获取到版本 3.3,那么手动指定 1.x 版本 不可能还会去用它。add_requires("openssl 1.x")
如果版本限制没生效,可以调下这
Bot detected the issue body's language is not English, translate it automatically.
In addition, I tried to manually install the openssl package, but an error was reported. xmake has been upgraded to the dev version. error: @programdir/modules/package/tools/make.lua:36: attempt to index a nil value (global 'compiler')
Looking at the error line, it is not the latest version at all.
I tried the specified version before, but then I took a look in the xmake repo and found that openssl is all version 1.x. There is also openssl3 specifically for openssl3.x version, but it is the same regardless of whether there is a specified version or not. of version = "3.3.1",
You can get version 3.3 by searching on your system, so it is impossible to use it if you manually specify version 1.x. add_requires("openssl 1.x")
If the version restriction does not take effect, you can adjust this
问题清楚了,是因为工程里依赖了别的package,别的package设定的openssl版本是大于等于1.1.1,于是xmake就会去找openssl3,即使我在工程文件里指定了add_requires("openssl 1.x"),最后也是找openssl3,这个感觉也不算是bug,这种嵌套依赖的问题确实不好处理,我在代码里适配openssl3就行了,感谢作者的耐心解答
package_name: openssl
opt.require_version: 1.1.1-w
checking for xmake::openssl ... no
package_name: openssl
opt.require_version: >=1.1.1-a
checking for openssl ... pkgconfig::openssl 3.3.1
checking for xmake-repo::openssl ... openssl 3.3.1
Xmake 版本
xmake v2.8.1+master.22cd7c1f7
操作系统版本和架构
macos 14.5 (23F79)
描述问题
在xmake.lua上add_requires("openssl")并且add_packages("openssl"),预期是使用openssl1.x版本的,实际编译的时候查看编译参数只有-isystem /opt/homebrew/Cellar/openssl@3/3.3.1/include ,导致了代码编译出错 在windows上同样的文件能正确链接到openssl库,不会出现版本错误问题
期待的结果
能正确链接到openssl1.x版本
工程配置
add_requires("openssl") target("test") add_rules("qt.static") add_packages("openssl")
附加信息和错误日志
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -c -Qunused-arguments -target arm64-apple-macos10.15 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -g -Wall -Werror -O0 -std=c++20 -IThirdParty/QLogto/src/interfaces -IThirdParty/QLogto/include -I/Users/knightjun/code/private/PixPin/build/.gens/QLogto/macosx/arm64/debug/rules/qt/ui -IThirdParty/PixUtils -IThirdParty/PixUtils/PixScreenManager/include -DQT_QML_DEBUG -DQT_DEPRECATED_WARNINGS -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_CORE_LIB -F/Users/knightjun/code/lib/Qt/universal/lib -framework QtNetwork -framework QtGui -framework QtWidgets -framework QtCore -framework DiskArbitration -framework IOKit -framework CoreFoundation -framework CoreGraphics -framework OpenGL -framework Carbon -framework Foundation -framework AppKit -framework Security -framework SystemConfiguration -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtNetwork.framework/Headers -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtNetwork.framework/Headers/5.15.13 -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtNetwork.framework/Headers/5.15.13/QtNetwork -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtGui.framework/Headers -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtGui.framework/Headers/5.15.13 -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtGui.framework/Headers/5.15.13/QtGui -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtWidgets.framework/Headers -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtWidgets.framework/Headers/5.15.13 -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtWidgets.framework/Headers/5.15.13/QtWidgets -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtCore.framework/Headers -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtCore.framework/Headers/5.15.13 -isystem /Users/knightjun/code/lib/Qt/universal/lib/QtCore.framework/Headers/5.15.13/QtCore -isystem /Users/knightjun/code/lib/Qt/universal/include -isystem /Users/knightjun/code/lib/Qt/universal/mkspecs/macx-clang -isystem /opt/homebrew/Cellar/openssl@3/3.3.1/include -isystem /Users/knightjun/.xmake/packages/q/qcoro/v0.10.0/1c1e9409ab37470b9b512a4f0d61cfd9/include -fPIC -o build/.objs/QLogto/macosx/arm64/debug/ThirdParty/QLogto/src/modules/QJsonWebToken/qjsonwebtoken.cpp.o ThirdParty/QLogto/src/modules/QJsonWebToken/qjsonwebtoken.cpp