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

安装包时发生错误,显示"versions.txt" #5971

Closed
HOMODELUNA opened this issue Dec 13, 2024 · 8 comments
Closed

安装包时发生错误,显示"versions.txt" #5971

HOMODELUNA opened this issue Dec 13, 2024 · 8 comments
Labels

Comments

@HOMODELUNA
Copy link

Xmake 版本

2.9.6

操作系统版本和架构

Linux lunadomo 5.15.167.4-microsoft-standard-WSL2 xmake-io/xmake#1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

描述问题

添加了add_requires("curlpp") 包, 执行xmake q时显示"versions.txt",而包并没有安装上去

homodeluna@lunadomo:~/src/test-curlpp$ xmake q  -v -D
/usr/bin/git rev-parse HEAD
dump from _versions_list @@programdir/core/package/package.lua:1270
"versions.txt"
checking for xmake-repo::openssl ... openssl 3.0.13

然后在编译过程出错

期待的结果

理论上它应当下载并安装curlpp包

工程配置

err-test-curlpp.zip

附加信息和错误日志

checking for gcc ... /usr/bin/gcc
checking for the c++ compiler (cxx) ... gcc
checking for flags (-fPIC) ... ok
> gcc "-fPIC" "-m64"
checking for flags (-fvisibility-inlines-hidden) ... ok
> gcc "-fvisibility-inlines-hidden" "-m64"
checking for flags (-O3) ... ok
> gcc "-O3" "-m64"
checking for flags (-DNDEBUG) ... ok
> gcc "-DNDEBUG" "-m64"
[ 25%]: cache compiling.release src/test-ftp-list-files.cpp
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -isystem /usr/include/x86_64-linux-gnu -DNDEBUG -o build/.objs/test-curlpp/linux/x86_64/release/src/test-ftp-list-files.cpp.o src/test-ftp-list-files.cpp
checking for flags (-MMD -MF) ... ok
> gcc "-MMD" "-MF" "/dev/null" "-m64"
checking for flags (-fdiagnostics-color=always) ... ok
> gcc "-fdiagnostics-color=always" "-m64"
error: @programdir/core/main.lua:306: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:320: @programdir/modules/private/action/build/object.lua:91: @programdir/modules/core/tools/gcc.lua:842: src/test-ftp-list-files.cpp:1:10: fatal error: curlpp/Easy.hpp: 没有那个文件或目录
    1 | #include <curlpp/Easy.hpp>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:957]:
    [@programdir/modules/core/tools/gcc.lua:842]: in function 'catch'
    [@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
    [@programdir/modules/core/tools/gcc.lua:783]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]:
    [@programdir/core/tool/compiler.lua:278]: in function 'compile'
    [@programdir/modules/private/action/build/object.lua:91]: in function 'script'
    [@programdir/modules/private/action/build/object.lua:122]: in function 'build_object'
    [@programdir/modules/private/action/build/object.lua:147]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:237]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/async/runjobs.lua:220]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:404]:

stack traceback:
        [C]: in function 'error'
        @programdir/core/base/os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir/core/main.lua:306: in upvalue 'cotask'
        @programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>
@HOMODELUNA HOMODELUNA added the bug label Dec 13, 2024
@waruqi waruqi transferred this issue from xmake-io/xmake Dec 13, 2024
@waruqi
Copy link
Member

waruqi commented Dec 13, 2024

不要去单独执行 xmake q,那个通常是 xmake buildxrepo install 内部用,直接执行有缓存,就不会重复安装

xmake f -cvD
xmake -rvD

给下完整 logs

@HOMODELUNA
Copy link
Author

homodeluna@lunadomo:~/src/test-curlpp$ xmake f -cvD
checking for platform ... linux
checking for architecture ... x86_64
checking for gcc ... /usr/bin/gcc
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checking for unzip ... /usr/bin/unzip
checking for git ... /usr/bin/git
checking for gzip ... /usr/bin/gzip
checking for tar ... /usr/bin/tar
/usr/bin/git rev-parse HEAD
dump from _versions_list @@programdir/core/package/package.lua:1270
"versions.txt"
checking for cmake ... no
checking for cmake ... /usr/bin/cmake
finding libcurl from xmake ..
checking for xmake::libcurl ... no
finding curl from pacman ..
checkinfo: cannot runv(pacman --version), No such file or directory
checking for pacman ... no
checking for pacman::curl ... no
finding libcurl4-gnutls-dev from apt ..
checking for dpkg ... /usr/bin/dpkg
checking for apt::libcurl4-gnutls-dev ... no
finding libcurl4-nss-dev from apt ..
checking for apt::libcurl4-nss-dev ... no
finding libcurl4-openssl-dev from apt ..
checking for pkg-config ... /usr/bin/pkg-config
checking for gcc ... /usr/bin/gcc
checking for the c compiler (cc) ... gcc
checking for /usr/bin/gcc ... ok
checking for flags (-fPIC) ... ok
> gcc "-fPIC" "-m64"
> /usr/bin/gcc -c -m64 -o /tmp/.xmake1002/241213/_E3436AF9435D411087C01E44AE331020.o /tmp/.xmake1002/241213/_775FB00633BC4F66BF87D39CCDE5CF30.c
checking for flags (-fdiagnostics-color=always) ... ok
> gcc "-fdiagnostics-color=always" "-m64"
checking for g++ ... /usr/bin/g++
checking for the linker (ld) ... g++
checking for /usr/bin/g++ ... ok
checking for flags (-fPIC) ... ok
> g++ "-fPIC" "-m64" "-m64"
> /usr/bin/g++ -o /tmp/.xmake1002/241213/_E3436AF9435D411087C01E44AE331020.b /tmp/.xmake1002/241213/_E3436AF9435D411087C01E44AE331020.o -m64 -llibcurl
/usr/bin/ld: 找不到 -llibcurl: 没有那个文件或目录
/usr/bin/ld: note to link with /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libcurl.a use -l:libcurl.a or rename it to liblibcurl.a
collect2: error: ld returned 1 exit status
> checking for c links(libcurl)
> checking for c snippet(find_package/libcurl)
checkinfo: ...gramdir/core/sandbox/modules/import/core/tool/linker.lua:75: @programdir/core/sandbox/modules/os.lua:378: execv(/usr/bin/g++ -o /tmp/.xmake1002/241213/_E3436AF9435D411087C01E44AE331020.b /tmp/.xmake1002/241213/_E3436AF9435D411087C01E44AE331020.o -m64 -llibcurl) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:957]:
    [@programdir/core/sandbox/modules/os.lua:378]: in function 'execv'
    [@programdir/modules/core/tools/gcc.lua:527]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]:
    [@programdir/core/tool/linker.lua:221]: in function 'link'
    [...gramdir/core/sandbox/modules/import/core/tool/linker.lua:73]: in function 'link'
    [@programdir/modules/lib/detect/check_cxsnippets.lua:249]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/lib/detect/check_cxsnippets.lua:236]:
    [@programdir/modules/package/manager/system/find_package.lua:68]:
    [...amdir/modules/package/manager/pkgconfig/find_package.lua:47]:
    [@programdir/modules/package/manager/apt/find_package.lua:68]:
    [@programdir/modules/package/manager/find_package.lua:111]: in function '_find_package'
    [@programdir/modules/package/manager/find_package.lua:195]:
    [@programdir/modules/lib/detect/find_package.lua:109]:
    [@programdir/core/package/package.lua:1768]: in function '_fetch_library'
    [@programdir/core/package/package.lua:1935]: in function 'fetch'
    [...modules/private/action/require/impl/install_packages.lua:333]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:237]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/async/runjobs.lua:220]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:404]:

checking for apt::libcurl4-openssl-dev ... libcurl4-openssl-dev 8.5.0
finding curlpp from xmake ..
checking for xmake::curlpp ... no
checkinfo: cannot runv(emerge --version), No such file or directory
checking for emerge ... no
finding curlpp from brew ..
checking for brew ... no
finding curlpp from vcpkg ..
finding curlpp from conan ..
finding curlpp from pkgconfig ..
finding curlpp from system ..
> /usr/bin/gcc -c -m64 -o /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.o /tmp/.xmake1002/241213/_775FB00633BC4F66BF87D39CCDE5CF30.c
> /usr/bin/g++ -o /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.b /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.o -m64 -lcurlpp
> checking for c links(curlpp)
> checking for c snippet(find_package/curlpp)
checking for curlpp ... system::curlpp
configure
{
    clean = true
    plat = linux
    kind = static
    arch = x86_64
    buildir = build
    host = linux
    ndk_stdcxx = true
    ccache = true
    mode = release
}

然后

homodeluna@lunadomo:~/src/test-curlpp$ xmake -rvD
checking for gcc ... /usr/bin/gcc
checking for the c++ compiler (cxx) ... gcc
checking for flags (-fPIC) ... ok
> gcc "-fPIC" "-m64"
checking for flags (-fvisibility-inlines-hidden) ... ok
> gcc "-fvisibility-inlines-hidden" "-m64"
checking for flags (-O3) ... ok
> gcc "-O3" "-m64"
checking for flags (-DNDEBUG) ... ok
> gcc "-DNDEBUG" "-m64"
[ 25%]: cache compiling.release src/test-ftp-list-files.cpp
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -isystem /usr/include/x86_64-linux-gnu -DNDEBUG -o build/.objs/test-curlpp/linux/x86_64/release/src/test-ftp-list-files.cpp.o src/test-ftp-list-files.cpp
checking for flags (-MMD -MF) ... ok
> gcc "-MMD" "-MF" "/dev/null" "-m64"
checking for flags (-fdiagnostics-color=always) ... ok
> gcc "-fdiagnostics-color=always" "-m64"
error: @programdir/core/main.lua:306: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:320: @programdir/modules/private/action/build/object.lua:91: @programdir/modules/core/tools/gcc.lua:842: src/test-ftp-list-files.cpp:1:10: fatal error: curlpp/Easy.hpp: 没有那个文件或目录
    1 | #include <curlpp/Easy.hpp>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:957]:
    [@programdir/modules/core/tools/gcc.lua:842]: in function 'catch'
    [@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
    [@programdir/modules/core/tools/gcc.lua:783]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]:
    [@programdir/core/tool/compiler.lua:278]: in function 'compile'
    [@programdir/modules/private/action/build/object.lua:91]: in function 'script'
    [@programdir/modules/private/action/build/object.lua:122]: in function 'build_object'
    [@programdir/modules/private/action/build/object.lua:147]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:237]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/async/runjobs.lua:220]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:404]:

stack traceback:
        [C]: in function 'error'
        @programdir/core/base/os.lua:957: in function 'os.raiselevel'
        (...tail calls...)
        @programdir/core/main.lua:306: in upvalue 'cotask'
        @programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>

我系统里没装curlpp,它显示"找到system::curlpp"

@waruqi
Copy link
Member

waruqi commented Dec 13, 2024

finding curlpp from system ..
/usr/bin/gcc -c -m64 -o /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.o /tmp/.xmake1002/241213/_775FB00633BC4F66BF87D39CCDE5CF30.c
/usr/bin/g++ -o /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.b /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.o -m64 -lcurlpp
checking for c links(curlpp)
checking for c snippet(find_package/curlpp)
checking for curlpp ... system::curlpp

但是目前看 就是找到系统了,有可能是你系统里有库,但是没头文件。你可以 add_requires("curlpp", {system = false}) 强制走远程安装。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


find curlpp from system ..
/usr/bin/gcc -c -m64 -o /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.o /tmp/.xmake1002/241213/_775FB00633BC4F66BF87D39CCDE5CF30.c
/usr/bin/g++ -o /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.b /tmp/.xmake1002/241213/_DBB1969A7F774C308FC698E10FB09C60.o -m64 -lcurlpp
checking for c links(curlpp)
checking for c snippet(find_package/curlpp)
checking for curlpp ... system::curlpp

But currently, the system is found. It may be that there are libraries in your system, but no header files. You can force remote installation with add_requires("curlpp", {system = false}).

@HOMODELUNA
Copy link
Author

添加system=false之后它确实从远程安装包了,然后可以编译+运行

homodeluna@lunadomo:~/src/test-curlpp$ xmake r
0806.mp4
08061220.mp4
08061226.mp4
....... # 这是从ftp服务器拉来的文件

顺带问一下,我怎么设置让每个工程使用单独的包安装路径,以免它们都用全局的安装路径(~/.xmake/packages)

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


After adding system=false, it does install the package remotely, and then it can be compiled and run.

homodeluna@lunadomo:~/src/test-curlpp$ xmake r
0806.mp4
08061220.mp4
08061226.mp4
....... # This is a file pulled from the ftp server

By the way, how can I set each project to use a separate package installation path so that they all use the global installation path (~/.xmake/packages)

@waruqi
Copy link
Member

waruqi commented Dec 13, 2024

设置 package.install_locally policy

@HOMODELUNA
Copy link
Author

(o゚v゚)ノ

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