Replies: 7 comments 5 replies
-
设置 而
这里你理解不对,_load_package_from_system 跟 |
Beta Was this translation helpful? Give feedback.
-
我之前就尝试了。提示未找到
上面的代码会先执行。之后才是 所以 system 选项不会起到作用。
但是系统中存在,所以不应该继续尝试吗? 现在问题是就出在 _load_package 函数。该函数最先被执行。 |
Beta Was this translation helpful? Give feedback.
-
没遇到你说的问题,我这边一切正常。。我这里安装的是 gtk 4.14 也是高于 xmake-repo 中的版本 一切正常,能正常找到对应版本的系统 gtk4 add_requires("gtk4 >=4.14", {system = true})
target("test")
set_kind("binary")
add_files("src/*.cpp")
add_packages("gtk4") checking for pkgconfig::gtk4 ... gtk4 4.14.2
checking for xmake-repo::gtk4 ... gtk4 4.14.2
configure
{
clean = true
plat = linux
buildir = build
arch = x86_64
ndk_stdcxx = true
kind = static
host = linux
ccache = true
mode = release
}
ruki@c9f0fd23ebba:/tmp/test$ xmake -rv
checking for gcc ... /usr/bin/gcc
checking for the c++ compiler (cxx) ... gcc
checking for flags (-fPIC) ... ok
checking for flags (-fvisibility-inlines-hidden) ... ok
checking for flags (-O3) ... ok
checking for flags (-mfpmath=sse) ... ok
checking for flags (-msse) ... ok
checking for flags (-msse2) ... ok
checking for flags (-pthread) ... ok
checking for flags (-DNDEBUG) ... ok
[ 50%]: cache compiling.release src/main.cpp
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -isystem /usr/include/gtk-4.0 -isystem /usr/include/pango-1.0 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/harfbuzz -isystem /usr/include/freetype2 -isystem /usr/include/libpng16 -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/fribidi -isystem /usr/include/cairo -isystem /usr/include/pixman-1 -isystem /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include/webp -isystem /usr/include/graphene-1.0 -isystem /usr/lib/x86_64-linux-gnu/graphene-1.0/include -isystem /home/ruki/.xmake/packages/l/libffi/3.4.6/fe364041468445adabace9ccc642d997/include -isystem /home/ruki/.xmake/packages/z/zlib/v1.3.1/994fafa590ed48ac9f71516cc846d155/include -isystem /home/ruki/.xmake/packages/l/libx11/1.8.7/380a1842db954612a3e602b04bf6d53b/include -isystem /home/ruki/.xmake/packages/x/xtrans/1.4.0/269ba1f23faf46f3aafe004620bb0298/include -isystem /home/ruki/.xmake/packages/l/libxcb/1.16/181975c075a447b882a80a2500bab765/include -isystem /home/ruki/.xmake/packages/l/libxau/1.0.11/aafb5d682970499891e46ca51c4d9476/include -isystem /home/ruki/.xmake/packages/l/libxdmcp/1.1.4/f0bc220dc4b74f18989972e6fbdd1201/include -isystem /home/ruki/.xmake/packages/x/xorgproto/2023.2/3a1682704c034fbf87583b32455dde94/include -mfpmath=sse -msse -msse2 -pthread -DNDEBUG -o build/.objs/test/linux/x86_64/release/src/main.cpp.o src/main.cpp
checking for flags (-MMD -MF) ... ok
checking for flags (-fdiagnostics-color=always) ... ok
checking for flags (-Wno-gnu-line-marker -Werror) ... ok
checking for the linker (ld) ... g++
[ 75%]: linking.release test
/usr/bin/g++ -o build/linux/x86_64/release/test build/.objs/test/linux/x86_64/release/src/main.cpp.o -m64 -L/home/ruki/.xmake/packages/l/libffi/3.4.6/fe364041468445adabace9ccc642d997/lib -L/home/ruki/.xmake/packages/z/zlib/v1.3.1/994fafa590ed48ac9f71516cc846d155/lib -L/home/ruki/.xmake/packages/l/libx11/1.8.7/380a1842db954612a3e602b04bf6d53b/lib -L/home/ruki/.xmake/packages/l/libxcb/1.16/181975c075a447b882a80a2500bab765/lib -L/home/ruki/.xmake/packages/l/libxau/1.0.11/aafb5d682970499891e46ca51c4d9476/lib -L/home/ruki/.xmake/packages/l/libxdmcp/1.1.4/f0bc220dc4b74f18989972e6fbdd1201/lib -s -lgtk-4 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lvulkan -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lthai -lepoxy -lfribidi -lpng16 -lfontconfig -lfreetype -lexpat -lgthread-2.0 -lgmodule-2.0 -lffi -lz -lXrandr -lXi -lXcursor -lXrender -lX11 -lXdamage -lXfixes -lXinerama -lXext -lX11-xcb -lxcb -lxcb-composite -lxcb-damage -lxcb-dbe -lxcb-dpms -lxcb-dri2 -lxcb-dri3 -lxcb-present -lxcb-glx -lxcb-randr -lxcb-record -lxcb-render -lxcb-res -lxcb-screensaver -lxcb-shape -lxcb-shm -lxcb-sync -lxcb-xevie -lxcb-xf86dri -lxcb-xfixes -lxcb-xinerama -lxcb-xinput -lxcb-xkb -lxcb-xtest -lxcb-xv -lxcb-xvmc -lxcb-ge -lXau -lXdmcp -ldl
[100%]: build ok, spent 0.55s
在没设置 我这正常报 add_requires("gtk4 >=4.14")
target("test")
set_kind("binary")
add_files("src/*.cpp")
add_packages("gtk4") error: @programdir/core/main.lua:329: @programdir/modules/private/action/require/impl/package.lua:497: package(gtk4): version(>=4.14) not found!
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:1075]:
[@programdir/modules/private/action/require/impl/package.lua:497]: in function '_select_package_version'
[@programdir/modules/private/action/require/impl/package.lua:1042]: in function '_load_package'
[@programdir/modules/private/action/require/impl/package.lua:1155]: in function '_load_packages'
[@programdir/modules/private/action/require/impl/package.lua:1694]: in function 'load_packages'
[...modules/private/action/require/impl/install_packages.lua:689]: in function '_install_packages'
你还是没明白我说的啥,我的意思,就是 pkgconfig 能取到版本,但是 xmake 找不到的情况,让你自己调下我上面贴的基础代码路径,看下为啥没匹配到,因为我没时间调。 但我刚已经安装 gtk4 模拟你这情况调了,没法复现,这边正常能找到系统库,如果你这还是不行,就按我上面贴的 find_package 的位置自己调试
不可取,完全是瞎改,会各种 break |
Beta Was this translation helpful? Give feedback.
-
你遇到的这个错误,应该是你这是 windows host 导致,我没对应环境,只能在 linux 上测试。目前这个 error 我 dev 处理过了,可以再试试 但不保证还有其他遗漏的 case |
Beta Was this translation helpful? Give feedback.
-
这是个重要信息。这就是我的疑问来源。这属于 xmake 的设计理念。或许需要写明。 那解决方案应该修改 当 system 为真时,无论 package 是否存在都应该调用 _load_package_from_system 。因为用户要求从 system 获取。 |
Beta Was this translation helpful? Give feedback.
-
'version_str' 报错解决了。 |
Beta Was this translation helpful? Give feedback.
-
关于报错的提示信息是否可以改进一下。
鉴于这个设计。那么当 xrepo or project 来源不存在对应的版本时,是否应当明确哪个来源不存在指定版本? 在不知道这个设计的时候。我看到 现在,我以了然。指定的来源不存在对应的版本,需要使用 system=true。 所以在使用 add_requires 的时候,还需要参考 xrepo 中存在的包是否有对应的版本,看需求是否添加 system=true |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
xmake v2.9.7+20241220
这令我很困惑。
xrepo 的版本是 4.13.3
system(pkgconfig) 的版本是 4.16.7
当
add_requires("gtk4 >=4.16")
oradd_requires("gtk4 >=4.16", system=true)
则提示
package(gtk4): version(>=4.16.7) not found!
寻找到的相关代码
xmake/xmake/modules/private/action/require/impl/package.lua
Line 930 in 4ebeeb4
得到以下的搜索顺序
当 2 满足时则不会继续尝试 3
所以要满足条件则必须使用
pkgconfig::
前缀。没有特殊要求时,并不需要限制包的来源。
符合我想法的是:
依次对版本号进行尝试。
Beta Was this translation helpful? Give feedback.
All reactions