-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
禁止链接 boost_python313失败 #6136
Comments
Title: Forbidden link boost_numpy313 failed |
再补充一些报错信息: error: @programdir/core/main.lua:329: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:325: @programdir/actions/build/kinds/binary.lua:53: @programdir/core/sandbox/modules/os.lua:378: execv(/usr/bin/g++ -o build/linux/x86_64/debug/clean build/.objs/clean/linux/x86_64/debug/tools/src/clean/src/main.cpp.o -m64 -Lbuild/linux/x86_64/debug -L/usr/lib -llib -lcommon -lboost_wave -lboost_url -lboost_type_erasure -lboost_timer -lboost_prg_exec_monitor -lboost_unit_test_framework -lboost_test_exec_monitor -lboost_stacktrace_noop -lboost_stacktrace_addr2line -lboost_stacktrace_basic -lboost_program_options -lboost_process -lboost_nowide -lboost_log -lboost_log_setup -lboost_locale -lboost_json -lboost_iostreams -lboost_graph_parallel -lboost_mpi -lboost_python313 -lboost_numpy313 -lboost_graph -lboost_wserialization -lboost_serialization -lboost_regex -lboost_random -lboost_fiber -lboost_filesystem -lboost_coroutine -lboost_contract -lboost_thread -lboost_date_time -lboost_exception -lboost_cobalt -lboost_context -lboost_container -lboost_chrono -lboost_system -lboost_charconv -lboost_atomic -lbz2 -lz -lpthread) failed(1) stack traceback: |
Title: Forbidden link boost_python313 failed |
add_requires("boost", {
system = false,
configs = {
shared = false,
cmake = false,
}}) |
这确实不需要使用 /usr/lib/ 目录下面的 boost 库了,但我发现要使用某个库也不行了。 add_requires("boost", { system=false, configs = {shared = false, cmake = false, filesystem = true}}) 查询 /usr/bin/g++ -o build/linux/x86_64/debug/test build/.objs/test/linux/x86_64/debug/test/src/de.cpp.o build/.objs/test/linux/x86_64/debug/test/src/eg.cpp.o build/.objs/test/linux/x86_64/debug/test/src/main.cpp.o build/.objs/test/linux/x86_64/debug/test/src/builder.cpp.o -m64 -L/usr/lib -Lbuild/linux/x86_64/debug -llib -lcommon -lpthread
/usr/bin/ld: build/.objs/test/linux/x86_64/debug/test/src/builder.cpp.o: in function `boost::filesystem::exists(boost::filesystem::path const&)':
/usr/include/boost/filesystem/operations.hpp:181:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x2f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/usr/bin/ld: build/.objs/test/linux/x86_64/debug/test/src/builder.cpp.o: in function `boost::filesystem::create_directory(boost::filesystem::path const&)':
/usr/include/boost/filesystem/operations.hpp:398:(.text._ZN5boost10filesystem16create_directoryERKNS0_4pathE[_ZN5boost10filesystem16create_directoryERKNS0_4pathE]+0x1e): undefined reference to `boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::filesystem::path const*, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
create ok!
compile_commands.json updated!
error: @programdir/core/main.lua:329: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:325: @programdir/actions/build/kinds/binary.lua:53: @programdir/core/sandbox/modules/os.lua:378: execv(/usr/bin/g++ -o build/linux/x86_64/debug/test build/.objs/test/linux/x86_64/debug/test/src/de.cpp.o build/.objs/test/linux/x86_64/debug/test/src/eg.cpp.o build/.objs/test/linux/x86_64/debug/test/src/main.cpp.o build/.objs/test/linux/x86_64/debug/test/src/builder.cpp.o -m64 -L/usr/lib -Lbuild/linux/x86_64/debug -llib -lcommon -lpthread) failed(1)
stack traceback:
[C]: in function 'error'
[@programdir/core/base/os.lua:1004]:
[@programdir/core/sandbox/modules/os.lua:378]: in function 'execv'
[@programdir/modules/core/tools/gcc.lua:599]:
[C]: in function 'xpcall'
[@programdir/core/base/utils.lua:244]:
[@programdir/core/tool/linker.lua:232]: in function 'link'
[@programdir/actions/build/kinds/binary.lua:53]: in function 'callback'
[@programdir/modules/core/project/depend.lua:217]: in function 'on_changed'
[@programdir/actions/build/kinds/binary.lua:41]: in function '_do_link_target'
[@programdir/actions/build/kinds/binary.lua:83]:
[@programdir/actions/build/kinds/binary.lua:110]: in function '_link_target'
[@programdir/actions/build/kinds/binary.lua:138]: in function 'jobfunc'
[@programdir/modules/async/runjobs.lua:241]:
[C]: in function 'xpcall'
[@programdir/core/base/utils.lua:244]: in function 'trycall'
[@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
[@programdir/modules/async/runjobs.lua:224]: in function 'cotask'
[@programdir/core/base/scheduler.lua:406]:
stack traceback:
[C]: in function 'error'
@programdir/core/base/os.lua:1004: in function '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> 本来应该给出链接参数 |
执行过 |
Have you executed |
执行 /usr/bin/g++ -o build/linux/x86_64/debug/test build/.objs/test/linux/x86_64/debug/test/src/de.cpp.o build/.objs/test/linux/x86_64/debug/test/src/named_param.cpp.o build/.objs/test/linux/x86_64/debug/test/src/eg.cpp.o build/.objs/test/linux/x86_64/debug/test/src/main.cpp.o build/.objs/test/linux/x86_64/debug/test/src/boost_so.cpp.o build/.objs/test/linux/x86_64/debug/test/src/builder.cpp.o -m64 -L/usr/lib -Lbuild/linux/x86_64/debug -llib -lcommon -lpthread
/usr/bin/ld: build/.objs/test/linux/x86_64/debug/test/src/boost_so.cpp.o: in function `boost::filesystem::exists(boost::filesystem::path const&)':
/usr/include/boost/filesystem/operations.hpp:181:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x2f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/usr/bin/ld: build/.objs/test/linux/x86_64/debug/test/src/boost_so.cpp.o: in function `boost::filesystem::create_directory(boost::filesystem::path const&)':
/usr/include/boost/filesystem/operations.hpp:398:(.text._ZN5boost10filesystem16create_directoryERKNS0_4pathE[_ZN5boost10filesystem16create_directoryERKNS0_4pathE]+0x1e): undefined reference to `boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::filesystem::path const*, boost::system::error_code*)'
collect2: error: ld returned 1 exit status 上述报错表明只链接了 add_links("boost_system", "boost_filesystem") 才能链接 boost 库。 我当前的构建脚本中的配置依旧是: add_requires("boost", { system=false, configs = {shared = false, cmake = false, filesystem = true}}) 自从把 |
After executing /usr/bin/g++ -o build/linux/x86_64/debug/test build/.objs/test/linux/x86_64/debug/test/src/de.cpp.o build/.objs/test/linux/x86_64/ debug/test/src/named_param.cpp.o build/.objs/test/linux/x86_64/debug/test/src/eg.cpp.o build/.objs/test/linux/x86_64/debug/test/src/main.cpp.o build/.objs/test /linux/x86_64/debug/test/src/boost_so.cpp.o build/.objs/test/linux/x86_64/debug/test/src/builder.cpp.o -m64 -L/usr/lib -Lbuild/linux/x86_64/debug -llib -lcommon -lpthread
/usr/bin/ld: build/.objs/test/linux/x86_64/debug/test/src/boost_so.cpp.o: in function `boost::filesystem::exists(boost::filesystem::path const&) ':
/usr/include/boost/filesystem/operations.hpp:181:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x2f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const& , boost::system::error_code*)'
/usr/bin/ld: build/.objs/test/linux/x86_64/debug/test/src/boost_so.cpp.o: in function `boost::filesystem::create_directory(boost::filesystem::path const&) ':
/usr/include/boost/filesystem/operations.hpp:398:(.text._ZN5boost10filesystem16create_directoryERKNS0_4pathE[_ZN5boost10filesystem16create_directoryERKNS0_4pathE]+0x1e): undefined reference to `boost::filesystem::detail::create_directory(boost::filesystem::path const&, boost::filesystem::path const*, boost::system::error_code*)'
collect2: error: ld returned 1 exit status The above error report indicates that only the libraries add_links("boost_system", "boost_filesystem") To link the boost library. The configuration in my current build script is still: add_requires("boost", { system=false, configs = {shared = false, cmake = false, filesystem = true}}) It has been unchanged since taking |
安装没问题,那只能是你 xmake.lua 写错了,反正我这边无法复现。 add_requires("boost", {
system = false,
configs = {shared = false,
cmake = false,
}
})
target("test")
set_kind("shared")
add_files("src/main.cpp")
add_packages("boost") $ xmake f -c -v
...
checking for xmake::boost ... boost 1.87.0
{
license = "BSL-1.0",
libfiles = {
"/home/star/.xmake/packages/b/boost/1.87.0/0ea5408c29014b249b186ec7a0b93264/lib/libboost_filesystem-mt.a",
"/home/star/.xmake/packages/b/boost/1.87.0/0ea5408c29014b249b186ec7a0b93264/lib/libboost_system-mt.a",
"/home/star/.xmake/packages/b/boost/1.87.0/0ea5408c29014b249b186ec7a0b93264/lib/libboost_atomic-mt.a"
},
static = true,
links = {
"boost_filesystem-mt",
"boost_system-mt",
"boost_atomic-mt"
},
version = "1.87.0",
syslinks = {
"pthread",
"dl"
},
linkdirs = {
"/home/star/.xmake/packages/b/boost/1.87.0/0ea5408c29014b249b186ec7a0b93264/lib"
},
sysincludedirs = {
"/home/star/.xmake/packages/b/boost/1.87.0/0ea5408c29014b249b186ec7a0b93264/include"
}
}
$ xmake -rv
[ 50%]: cache compiling.release src/main.cpp
/usr/bin/gcc -c -m64 -fPIC -isystem /home/star/.xmake/packages/b/boost/1.87.0/0ea5408c29014b249b186ec7a0b93264/include -isystem /home/star/.xmake/packages/b/bzip2/1.0.8/8db6bd46210f4711a452b7767b44748c/include -isystem /home/star/.xmake/packages/z/zlib/v1.3.1/994fafa590ed48ac9f71516cc846d155/include -o build/.objs/test/linux/x86_64/release/src/main.cpp.o src/main.cpp
[ 75%]: linking.release libtest.so
/usr/bin/g++ -o build/linux/x86_64/release/libtest.so build/.objs/test/linux/x86_64/release/src/main.cpp.o -shared -m64 -fPIC -L/home/star/.xmake/packages/b/boost/1.87.0/0ea5408c29014b249b186ec7a0b93264/lib -L/home/star/.xmake/packages/b/bzip2/1.0.8/8db6bd46210f4711a452b7767b44748c/lib -L/home/star/.xmake/packages/z/zlib/v1.3.1/994fafa590ed48ac9f71516cc846d155/lib -lboost_filesystem-mt -lboost_system-mt -lboost_atomic-mt -lbz2 -lz -lpthread -ldl |
Xmake Version
2.9.7
Operating System Version and Architecture
archlinux
Describe Bug
添加 boost 库:
我这里令 python=false,也就是禁止链接 Boost.Python 库。
但显示执行过程的详细信息表明,它还是链接了 python 库:
它这里链接了 -lboost_python313,我在配置中禁止从系统找库,但它还是到 /usr/lib/ 下找到了 libboost_python313 这个库。然后这个库好像依赖于 python 虚拟机中的一些库,导致缺少一堆符号。
我在配置中给出的几个配置项基本都是不好使的。
system=false,结果还是从系统路径找库。
all=false,结果还是链接了一堆 boost库。
shared=false,结果还是链接了 so 文件。
python=false,结果还是链接了 boost_python313 这个库。
通过命令
xmake require --info boost
查看 boost 库的配置信息,有:倒数第二行,明确说 add_requires 中 configs 子项目 python 用于控制是否链接 python 库,默认是 false,但默认还是链接 python 库,我手动给 false,结果还是链接 python 库。
Expected Behavior
add_requires("boost", { configs = { system = false, all = false, shared = false, cmake = false, python=false } })
我希望不要链接 boost_numpy313 这个库,我只使用 boost 中的部分子库,不需要链接全部,也希望上述几个配置项能起作用。
Project Configuration
add_requires("spdlog", "cli11")
add_requires("boost", { configs = { system = false, all = false, shared = false, cmake = false, python=false } })
add_packages("spdlog", "boost", "cli11")
Additional Information and Error Logs
[ 88%]: linking.debug test
/usr/bin/g++ -o build/linux/x86_64/debug/test build/.objs/test/linux/x86_64/debug/test/src/de.cpp.o build/.objs/test/linux/x86_64/debug/test/src/eg.cpp.o build/.objs/test/linux/x86_64/debug/test/src/main.cpp.o -m64 -Lbuild/linux/x86_64/debug -L/usr/lib -llib -lcommon -lboost_wave -lboost_url -lboost_type_erasure -lboost_timer -lboost_prg_exec_monitor -lboost_unit_test_framework -lboost_test_exec_monitor -lboost_stacktrace_noop -lboost_stacktrace_addr2line -lboost_stacktrace_basic -lboost_program_options -lboost_process -lboost_nowide -lboost_log -lboost_log_setup -lboost_locale -lboost_json -lboost_iostreams -lboost_graph_parallel -lboost_mpi -lboost_python313 -lboost_numpy313 -lboost_graph -lboost_wserialization -lboost_serialization -lboost_regex -lboost_random -lboost_fiber -lboost_filesystem -lboost_coroutine -lboost_contract -lboost_thread -lboost_date_time -lboost_exception -lboost_cobalt -lboost_context -lboost_container -lboost_chrono -lboost_system -lboost_charconv -lboost_atomic -lbz2 -lz -lpthread
/usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to
PyNumber_InPlaceRemainder' /usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to
_Py_Dealloc'/usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to
PyLong_FromLong' /usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to
PyUnicode_AsUTF8String'/usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to
PyUnicode_FromFormat' /usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to
PyExc_ValueError'/usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to
PyModule_Create2' /usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to
PyNumber_And'/usr/bin/ld: /usr/lib/libboost_python313.so: undefined reference to `PySlice_New'
The text was updated successfully, but these errors were encountered: