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

add_requires apt包报错 #1786

Closed
likun123687 opened this issue Oct 30, 2021 · 13 comments
Closed

add_requires apt包报错 #1786

likun123687 opened this issue Oct 30, 2021 · 13 comments
Milestone

Comments

@likun123687
Copy link

描述问题

add_requires("apt::libboost-dev") 报error

期待的结果

从apt中安装正确安装boost

错误信息

   xmake -vD:
  checking for gcc ... /usr/bin/gcc
  checkinfo: runv(dmd --version) failed(127)
  checking for dmd ... no
  checkinfo: runv(ldc2 --version) failed(127)
  checking for ldc2 ... no
  checkinfo: runv(gdc --version) failed(127)
  checking for gdc ... no
  checkinfo: runv(zig version) failed(127)
  checking for zig ... no
  checkinfo: runv(zig version) failed(127)
  checking for zig ... no
  checking for unzip ... /usr/bin/unzip
  checking for git ... /usr/bin/git
  checking for gzip ... /bin/gzip
  checking for tar ... /bin/tar
  finding libboost-dev from apt ..
  checking for dpkg ... /usr/bin/dpkg  checking for apt::libboost-dev ... no
  note: install or modify (m) these packages (pass -y to skip confirm)?
  in apt:
    -> apt::libboost-dev latest
  please input: y (y/n/m)
  y
  installing libboost-dev from apt ..
  checking for apt ... /usr/bin/apt
  checking for sudo ... /usr/bin/sudo
  note: try installing libboost-dev with administrator permission (pass -y or --confirm=y/n/d to skip confirm)?
  please input: y (y/n)
  y
  /usr/bin/sudo env PATH=/home/lk/.local/bin:/home/lk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/sn  ap/bin XMAKE_STATS= COLORTERM= /usr/bin/apt install -y libboost-dev
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  Suggested packages:
    libboost-doc
  The following NEW packages will be installed:
    libboost-dev
  0 upgraded, 1 newly installed, 0 to remove and 183 not upgraded.
Need to get 0 B/3,134 B of archives.
  After this operation, 10.2 kB of additional disk space will be used.
  Selecting previously unselected package libboost-dev:amd64.
  (Reading database ... 80848 files and directories currently installed.)
  Preparing to unpack .../libboost-dev_1.58.0.1ubuntu1_amd64.deb ...
  Unpacking libboost-dev:amd64 (1.58.0.1ubuntu1) ...
  Setting up libboost-dev:amd64 (1.58.0.1ubuntu1) ...
  finding libboost-dev from apt ..
  checking for apt::libboost-dev ... no
  
  error: .../modules/private/action/require/impl/actions/install.lua:194: fetch apt::libboost-dev-latest failed!
  stack traceback:
      [C]: in function 'error'
      [@programdir/core/base/os.lua:829]: in function 'raiselevel'
      [@programdir/core/sandbox/modules/utils.lua:181]: in function 'assert'
      [.../modules/private/action/require/impl/actions/install.lua:194]:
      [C]: in function 'trycall'
      [@programdir/core/sandbox/modules/try.lua:121]: in function 'try'
      [.../modules/private/action/require/impl/actions/install.lua:137]: in function 'action_install'
      [...modules/private/action/require/impl/install_packages.lua:364]: in function 'jobfunc'
      [@programdir/modules/private/async/runjobs.lua:208]:
      [C]: in function 'trycall'
      [@programdir/core/sandbox/modules/try.lua:121]: in function 'try'
      [@programdir/modules/private/async/runjobs.lua:201]: in function 'cotask'
      [@programdir/core/base/scheduler.lua:365]:
  
    => install apt::libboost-dev latest .. failed
  error: @programdir/modules/private/async/runjobs.lua:232: .../modules/private/action/require/impl/actions/install.lua:253: install failed!
  stack traceback:
      [C]: in function 'error'
      [@programdir/core/base/os.lua:829]: in function 'raise'
      [.../modules/private/action/require/impl/actions/install.lua:253]: in function 'catch'
      [@programdir/core/sandbox/modules/try.lua:127]: in function 'try'
      [.../modules/private/action/require/impl/actions/install.lua:137]: in function 'action_install'
      [...modules/private/action/require/impl/install_packages.lua:364]: in function 'jobfunc'
      [@programdir/modules/private/async/runjobs.lua:208]:
      [C]: in function 'trycall'
      [@programdir/core/sandbox/modules/try.lua:121]: in function 'try'
      [@programdir/modules/private/async/runjobs.lua:201]: in function 'cotask'
      [@programdir/core/base/scheduler.lua:365]:
  stack traceback:
      ▏   [C]: in function 'error'
      ▏   @programdir/core/base/os.lua:829: in function 'raise'
      ▏   @programdir/modules/private/async/runjobs.lua:232: in function 'catch'
      ▏   @programdir/core/sandbox/modules/try.lua:127: in function 'try'
      ▏   @programdir/modules/private/async/runjobs.lua:201: in function 'cotask'
      ▏   @programdir/core/base/scheduler.lua:365: in function <@programdir/core/base/scheduler.lua:362>

相关环境

  • xmake版本:xmake v2.5.7+202109290007
  • xmake运行平台:Ubuntu 16.04.6 LTS
  • xmake目标平台:Ubuntu 16.04.6 LTS

xmake.lua内容

add_rules("mode.debug", "mode.release")
set_languages("cxx17")
add_requires("apt::libboost-dev")
target("test")
set_kind("binary")
add_files("src/*.cpp")

@xq114
Copy link
Contributor

xq114 commented Oct 30, 2021

看看dpkg -L libboost-dev的输出

@likun123687
Copy link
Author

看看dpkg -L libboost-dev的输出

lk@ubuntu:~/cpp_test/test$ dpkg -L libboost-dev
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libboost-dev
/usr/share/doc/libboost-dev/changelog.gz
/usr/share/doc/libboost-dev/copyright

@xq114
Copy link
Contributor

xq114 commented Oct 30, 2021

libboost-dev是一个meta package,目前xmake还不支持从meta package的依赖包里面获取信息(这点之后可以加上),现在暂时只能手动指定实际依赖上的package:

add_requires("apt::libboost1.74-dev") -- for example, may vary from different systems

@likun123687
Copy link
Author

libboost-dev是一个meta package,目前xmake还不支持从meta package的依赖包里面获取信息(这点之后可以加上),现在暂时只能手动指定实际依赖上的package:

add_requires("apt::libboost1.74-dev") -- for example, may vary from different systems

这种方式我也试过,也是报错:
xmake.lua:

add_requires("apt::libboost1.58-dev")

报错信息:

  => install apt::libboost1.58-dev latest .. failed
if you want to get verbose errors, please see:
  -> /home/lk/.xmake/cache/packages/2110/a/apt_libboost1.58-dev/latest/installdir.failed/logs/install.txt
error: install failed!

系统中的boost包如下:

dpkg -l|grep boost
ii  libboost-dev:amd64                  1.58.0.1ubuntu1                            amd64        Boost C++ Libraries development files (default version)
ri  libboost1.58-dev:amd64              1.58.0+dfsg-5ubuntu3.1                     amd64        Boost C++ Libraries development files

@xq114
Copy link
Contributor

xq114 commented Oct 30, 2021

这应该是xmake fetch 只有头文件的包的时候的bug。

修复之前可以先把这行注释掉,ubuntu上apt安装了就可以正常找到头文件不需要add_requires也能编译运行。

@likun123687
Copy link
Author

好吧,先将就用着,谢谢兄弟解答

@likun123687
Copy link
Author

这应该是xmake fetch 只有头文件的包的时候的bug。

修复之前可以先把这行注释掉,ubuntu上apt安装了就可以正常找到头文件不需要add_requires也能编译运行。

啥时候能修复呢

@waruqi
Copy link
Member

waruqi commented Oct 30, 2021

这两天没空,具体看个人时间安排,建议优先用 xmake-repo 仓库的包,全平台支持 add_requires("boost")

apt的包只能ubuntu/debian上用

如果等不及,可以自己提个pr过来 帮忙改进下 https://github.com/xmake-io/xmake/blob/dev/xmake/modules/package/manager/apt/find_package.lua

@waruqi
Copy link
Member

waruqi commented Oct 31, 2021

libboost-dev是一个meta package,目前xmake还不支持从meta package的依赖包里面获取信息(这点之后可以加上)

怎么取?

add_requires("apt::libboost1.74-dev") -- for example, may vary from different systems

这个改了下 应该可以了。

@xq114
Copy link
Contributor

xq114 commented Oct 31, 2021

libboost-dev是一个meta package,目前xmake还不支持从meta package的依赖包里面获取信息(这点之后可以加上)

怎么取?

dpkg --status <package>可以取;但取出来的是所有依赖(包括运行时依赖,gcc/libc/libstdc++这种),没办法只取编译期依赖。如果把所有依赖都加进去可能会导致多出很多不必要的链接。我觉得可以只处理alias的情况,类似libboost-dev是libboost1.74-dev的接口,本身不包含任何头文件/库文件,这时才去依赖包里面找。其他包与包之间的依赖关系留给用户自己解决。

@waruqi
Copy link
Member

waruqi commented Oct 31, 2021

$ dpkg --status libboost-dev
Package: libboost-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 11
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Architecture: amd64
Multi-Arch: same
Source: boost-defaults
Version: 1.74.0.3ubuntu5
Depends: libboost1.74-dev

怎么判断是 alias? 要么仅处理 only one Depends 且没有任何 include/links的情况。

@waruqi waruqi added this to the v2.6.1 milestone Oct 31, 2021
@waruqi
Copy link
Member

waruqi commented Oct 31, 2021

这个等下个版本吧。今天发版了。

@waruqi
Copy link
Member

waruqi commented Nov 2, 2021

dev我改进过了,支持 alias 了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants