-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Unefined reference to C10::Error::Error when linking against libTorch #13541
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
Comments
You probably have a C++ ABI problem; maybe your compiler is too old. What version of gcc are you using? |
c++ (GCC) 8.2.1 20181011 (Red Hat 8.2.1-4) |
I think you're missing Please let me know if that fixes the issue. |
@goldsborough |
@goldsborough what should i do if i need to use libtorch in my project which must set "-D_GLIBCXX_USE_CXX11_ABI=1" ? anything suggestion? |
@sky-fun compile PyTorch from source |
@goldsborough How can i use the flag in msbuild? Do you have any suggestion |
@goldsborough
On one of the platforms I tested the error appeared at runtime, on another platform at compile-time. (Which is also kind of weird) Is there a flag that I am missing? It seems that c10 is not build with the new ABI, whilst the rest is? Since |
We are getting this problem too. It is not an abi issue. The cxx11 namespace only applies to std:: eg. std:: basic_string. Looking at libc10.so it seems this constructor is missing altogether |
OK, I am to young to simple, sometimes naive. I tried add a flag to override like this:
It has no effect...... When I comment out this in libtorch Torch.cmake:
It can link libtorch..........
|
on cmake u can use |
I met similar error. I looked up the file "TorchConf.cmake", it said " When we build libtorch with the old GCC ABI, dependent libraries must too.if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") Could anyone help me ? Thanks a lot. |
I am trying to build custom torch functions with cuda dynamic parallelism support.As per this suggestion, I am compiling my CUDA code with the cpp code.
I am able to perform the first two commands(the
where geo_query.h has
The utils.h has
So to build this I am needed to use libtorch and libc10. I have set the My torch is installed from pip directly. Despite that, having the ABI issue is very counterproductive :( |
It works, thank you soooo much!!! @goldsborough |
Uh oh!
There was an error while loading. Please reload this page.
🐛 Bug
Hi
I just dowloaded libTorch to work with the C++ API of pytorch. I tried to link against it in qt creator and include <torch/torch.h> but ran into an error. Here it is:
error: undefined reference to `c10::Error::Error(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, void const*)'
I thought that the problem was that I didn't link against c10 but after I did that the error still remained.
here is how I link against libTorch in my .pro file:
INCLUDEPATH += $$PWD/include
INCLUDEPATH += $$PWD/include/torch/csrc/api/include
LIBS += -L$$PWD/lib
LIBS += -ltorch -lnvrtc -lc10
LIBS += -lcudnn -lcuda -lcudart -lcublas -lcurand -lcusolver
Here $$PWD/ is the path to libTorch directory.
I know that i can use cmake but I didn't try that. I want to be able to use pytorch with qmake system because it is easier and more clean to work with.
My OS is Fedora 28 and I have CUDA 9.2 installed on my system
cc @jbschlosser
The text was updated successfully, but these errors were encountered: