-
请大家看一下我的问题,谢谢! 报错信息> Executing task: xmake r main <
terminate called after throwing an instance of 'c10::Error'
what(): Could not find schema for aten::ones.
Exception raised from findSchemaOrThrow at /home/rolfma/.xmake/cache/packages/2204/l/libtorch/v1.11.0/source/libtorch/aten/src/ATen/core/dispatch/Dispatcher.cpp:81 (most recent call first):
frame #0: <unknown function> + 0x647afc (0x55679d73eafc in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
frame #1: <unknown function> + 0x8277c (0x55679d17977c in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
frame #2: <unknown function> + 0x60c49d (0x55679d70349d in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
frame #3: <unknown function> + 0x220c62 (0x55679d317c62 in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
frame #4: <unknown function> + 0x2a25fc (0x55679d3995fc in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
frame #5: <unknown function> + 0x86ad5 (0x55679d17dad5 in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
frame #6: <unknown function> + 0x882e6 (0x55679d17f2e6 in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
frame #7: <unknown function> + 0x84f54 (0x55679d17bf54 in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
frame #8: __libc_start_main + 0xf3 (0x7f14d12450b3 in /lib/x86_64-linux-gnu/libc.so.6)
frame #9: <unknown function> + 0x84d4e (0x55679d17bd4e in /home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main)
error: execv(/home/rolfma/CppProject/TorchTest/build/linux/x86_64/debug/main) failed(-1)
The terminal process "/usr/bin/bash '-c', 'xmake r main '" failed to launch (exit code: 255). xmake.luaadd_rules("mode.debug", "mode.release")
add_requires("libtorch")
target("main")
set_kind("binary")
add_packages("libtorch")
add_files("src/*.cpp") main.cpp#include <iostream>
#include <torch/torch.h>
int main(int argc, char** argv)
{
torch::Tensor tensor=torch::ones({2,3});
std::cout<<tensor<<std::endl;
return 0;
} |
Beta Was this translation helpful? Give feedback.
Answered by
xq114
Apr 20, 2022
Replies: 2 comments 8 replies
-
这种问题,你只能自己调下包了。。https://github.com/xmake-io/xmake-repo/blob/master/packages/l/libtorch/xmake.lua 要么是包脚本缺某些 macros 开关,那就提 pr 改进包 如果是 libtorch 自身bug导致,那就自己调下 libtorch 源码,或者到 libtorch issues 里面去反馈问题 如果是 main 里面使用代码不对导致,自己 debug 调下 |
Beta Was this translation helpful? Give feedback.
3 replies
-
这是因为之前默认安装的static libtorch,而static libtorch的dispatch有问题。我在这个pr里切到默认shared了, xmake-io/xmake-repo#1169 你可以等这个patch merge之后再试试,或者手动加{configs={shared=true}} |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
rolfma19
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
这是因为之前默认安装的static libtorch,而static libtorch的dispatch有问题。我在这个pr里切到默认shared了, xmake-io/xmake-repo#1169 你可以等这个patch merge之后再试试,或者手动加{configs={shared=true}}