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

undefined symbol: _ZN3c105ErrorC1ENS_14SourceLocationERKSs #103

Closed
HawkAaron opened this issue Dec 20, 2018 · 15 comments
Closed

undefined symbol: _ZN3c105ErrorC1ENS_14SourceLocationERKSs #103

HawkAaron opened this issue Dec 20, 2018 · 15 comments

Comments

@HawkAaron
Copy link

After cloned this repo, and following the build steps, run python setup.py install, then change to another dir and import warpctc_pytorch throw the following error:

warpctc_pytorch/_warp_ctc.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN3c105ErrorC1ENS_14SourceLocationERKSs

System info:
CUDA: 9.0
CUDNN: 7.1.4
PyTorch: 1.0.0
miniconda Python: 3.6.4
GCC: 5.4.0
Linux: 3.10.0-514.21.1.el7.x86_64

@liudatutu
Copy link

@HawkAaron i have the problem too, do you solve it?

@HawkAaron
Copy link
Author

It's PyTorch problem, when build pytorch 1.0 from source, the _glibcxx_use_cxx11_abi=1, they force it to 1.
But you know what, the pip package's _glibcxx_use_cxx11_abi=0.
So, the best solution is to load gcc 5, then install the cpp extension.

Remember that: always use gcc 5 to build pytorch or install extension.

@alfredcs
Copy link

Build torchauduio with -D_GLIBCXX_USE_CXX11_ABI=1 will do as well.

%gcc -pthread -B /home/aarc/alfred/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/aarc/alfred/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/aarc/alfred/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/aarc/alfred/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/aarc/alfred/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/home/aarc/alfred/anaconda3/include/python3.7m -c torchaudio/torch_sox.cpp -o build/temp.linux-x86_64-3.7/torchaudio/torch_sox.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_torch_sox -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11

% g++ -pthread -shared -B /home/aarc/alfred/anaconda3/compiler_compat -L/home/aarc/alfred/anaconda3/lib -Wl,-rpath=/home/aarc/alfred/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/torchaudio/torch_sox.o -lsox -o build/lib.linux-x86_64-3.7/_torch_sox.cpython-37m-x86_64-linux-gnu.so

Move the _torch_sox.cpython-37m-x86_64-linux-gnu.so to the destination location should do.

@LewX
Copy link

LewX commented Jun 14, 2019

Build torchauduio with -D_GLIBCXX_USE_CXX11_ABI=1 will do as well.

%gcc -pthread -B /home/aarc/alfred/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/aarc/alfred/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/aarc/alfred/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/aarc/alfred/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/aarc/alfred/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/home/aarc/alfred/anaconda3/include/python3.7m -c torchaudio/torch_sox.cpp -o build/temp.linux-x86_64-3.7/torchaudio/torch_sox.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_torch_sox -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11

% g++ -pthread -shared -B /home/aarc/alfred/anaconda3/compiler_compat -L/home/aarc/alfred/anaconda3/lib -Wl,-rpath=/home/aarc/alfred/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/torchaudio/torch_sox.o -lsox -o build/lib.linux-x86_64-3.7/_torch_sox.cpython-37m-x86_64-linux-gnu.so

Move the _torch_sox.cpython-37m-x86_64-linux-gnu.so to the destination location should do.

How to set -D_GLIBCXX_USE_CXX11_ABI=1 ? Thanks.

@YanxianChen
Copy link

YanxianChen commented Jul 1, 2019

@LewX I have the same problem,and I solve it by modifying my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py. You can locate -D_GLIBCXX_USE_CXX11_ABI in cpp_extension.py, and set it to 1. Reference: https://github.com/NVIDIA/apex/issues/212

@GewelsJI
Copy link

@LewX I have the same problem,and I solve it by modifying my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py. You can locate -D_GLIBCXX_USE_CXX11_ABI in cpp_extension.py, and set it to 1. Reference: https://github.com/NVIDIA/apex/issues/212

I don't know how to set it to 1? please help me, thank you

@czy341181
Copy link

@GewelsJI i also met this question,do you solve this? how to set it to 1? thank you very much!

@PMAngel
Copy link

PMAngel commented Jul 5, 2020

@GewelsJI sir, hava you solve it? can you tell me how to set it to 1?

@YanxianChen
Copy link

@GewelsJI sir, hava you solve it? can you tell me how to set it to 1?

I have received your email, but I am sorry that I may have forgotten the specific details of this bug.

This bug seems to be caused by pytorch v0.4 when compiling the c++ extension, which is caused by different versions of g++. So we need to set the correct g++ version when compiling the c++ extension.

As my original answer, you need to first find the directory of the python or anaconda environment on your computer. Here I use my_conda_env to represent my environment directory, and then through this path "my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py " to find the cpp_extension.py file. Then you need to use an editor (such as vim or vscode) to open the cpp_extension.py file, find -D_GLIBCXX_USE_CXX11_ABI inside, set its corresponding value to 1 and save it.

After going through the above steps, re-run the "python setup.py install" command, it should be able to solve this problem.

I hope my answer can help you.

@PMAngel
Copy link

PMAngel commented Jul 5, 2020 via email

@MountainsRivers
Copy link

@GewelsJI sir, hava you solve it? can you tell me how to set it to 1?

I have received your email, but I am sorry that I may have forgotten the specific details of this bug.

This bug seems to be caused by pytorch v0.4 when compiling the c++ extension, which is caused by different versions of g++. So we need to set the correct g++ version when compiling the c++ extension.

As my original answer, you need to first find the directory of the python or anaconda environment on your computer. Here I use my_conda_env to represent my environment directory, and then through this path "my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py " to find the cpp_extension.py file. Then you need to use an editor (such as vim or vscode) to open the cpp_extension.py file, find -D_GLIBCXX_USE_CXX11_ABI inside, set its corresponding value to 1 and save it.

After going through the above steps, re-run the "python setup.py install" command, it should be able to solve

@GewelsJI sir, hava you solve it? can you tell me how to set it to 1?

I have received your email, but I am sorry that I may have forgotten the specific details of this bug.

This bug seems to be caused by pytorch v0.4 when compiling the c++ extension, which is caused by different versions of g++. So we need to set the correct g++ version when compiling the c++ extension.

As my original answer, you need to first find the directory of the python or anaconda environment on your computer. Here I use my_conda_env to represent my environment directory, and then through this path "my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py " to find the cpp_extension.py file. Then you need to use an editor (such as vim or vscode) to open the cpp_extension.py file, find -D_GLIBCXX_USE_CXX11_ABI inside, set its corresponding value to 1 and save it.

After going through the above steps, re-run the "python setup.py install" command, it should be able to solve this problem.

I hope my answer can help you.

请问是直接用1替换掉cpp_extension.py中所有的-D_GLIBCXX_USE_CXX11_ABI吗?

@MountainsRivers
Copy link

Thank you for your answer! You're very nice! I will try your suggestion later!

------------------ 原始邮件 ------------------ 发件人: "ChenYanxian"<notifications@github.com>; 发送时间: 2020年7月5日(星期天) 晚上9:27 收件人: "SeanNaren/warp-ctc"<warp-ctc@noreply.github.com>; 抄送: "釛~鑌"<2429533853@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [SeanNaren/warp-ctc] undefined symbol: _ZN3c105ErrorC1ENS_14SourceLocationERKSs (#103) @GewelsJI sir, hava you solve it? can you tell me how to set it to 1? I have received your email, but I am sorry that I may have forgotten the specific details of this bug. This bug seems to be caused by pytorch v0.4 when compiling the c++ extension, which is caused by different versions of g++. So we need to set the correct g++ version when compiling the c++ extension. As my original answer, you need to first find the directory of the python or anaconda environment on your computer. Here I use my_conda_env to represent my environment directory, and then through this path "my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py " to find the cpp_extension.py file. Then you need to use an editor (such as vim or vscode) to open the cpp_extension.py file, find -D_GLIBCXX_USE_CXX11_ABI inside, set its corresponding value to 1 and save it. After going through the above steps, re-run the "python setup.py install" command, it should be able to solve this problem. I hope my answer can help you. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Hi!! have you solved the problem? can you help me with it please?
my System info:
CUDA: 9.2
CUDNN: 7.6.5
PyTorch: 1.2.0
miniconda Python: 3.7.7
GCC: 5.3.1
Linux: Ubuntu 20.04 LTS

@YanxianChen
Copy link

YanxianChen commented Jul 20, 2020 via email

@3139725181
Copy link

你好,是把这个参数的值设置为 1,'-D_GLIBCXX_USE_CXX11_ABI' 是 c++ 编译时的参数。 At 2020-07-19 16:51:27, "LPF" notifications@github.com wrote: @GewelsJI sir, hava you solve it? can you tell me how to set it to 1? I have received your email, but I am sorry that I may have forgotten the specific details of this bug. This bug seems to be caused by pytorch v0.4 when compiling the c++ extension, which is caused by different versions of g++. So we need to set the correct g++ version when compiling the c++ extension. As my original answer, you need to first find the directory of the python or anaconda environment on your computer. Here I use my_conda_env to represent my environment directory, and then through this path "my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py " to find the cpp_extension.py file. Then you need to use an editor (such as vim or vscode) to open the cpp_extension.py file, find -D_GLIBCXX_USE_CXX11_ABI inside, set its corresponding value to 1 and save it. After going through the above steps, re-run the "python setup.py install" command, it should be able to solve @GewelsJI sir, hava you solve it? can you tell me how to set it to 1? I have received your email, but I am sorry that I may have forgotten the specific details of this bug. This bug seems to be caused by pytorch v0.4 when compiling the c++ extension, which is caused by different versions of g++. So we need to set the correct g++ version when compiling the c++ extension. As my original answer, you need to first find the directory of the python or anaconda environment on your computer. Here I use my_conda_env to represent my environment directory, and then through this path "my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py " to find the cpp_extension.py file. Then you need to use an editor (such as vim or vscode) to open the cpp_extension.py file, find -D_GLIBCXX_USE_CXX11_ABI inside, set its corresponding value to 1 and save it. After going through the above steps, re-run the "python setup.py install" command, it should be able to solve this problem. I hope my answer can help you. 请问是直接用1替换掉cpp_extension.py中所有的-D_GLIBCXX_USE_CXX11_ABI吗? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

我把那个值设为1还是有这个问题...

@ilove-Moretz
Copy link

你好,是把这个参数的值设置为 1,'-D_GLIBCXX_USE_CXX11_ABI' 是 c++ 编译时的参数。 At 2020-07-19 16:51:27, "LPF" notifications@github.com wrote: @GewelsJI sir, hava you solve it? can you tell me how to set it to 1? I have received your email, but I am sorry that I may have forgotten the specific details of this bug. This bug seems to be caused by pytorch v0.4 when compiling the c++ extension, which is caused by different versions of g++. So we need to set the correct g++ version when compiling the c++ extension. As my original answer, you need to first find the directory of the python or anaconda environment on your computer. Here I use my_conda_env to represent my environment directory, and then through this path "my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py " to find the cpp_extension.py file. Then you need to use an editor (such as vim or vscode) to open the cpp_extension.py file, find -D_GLIBCXX_USE_CXX11_ABI inside, set its corresponding value to 1 and save it. After going through the above steps, re-run the "python setup.py install" command, it should be able to solve @GewelsJI sir, hava you solve it? can you tell me how to set it to 1? I have received your email, but I am sorry that I may have forgotten the specific details of this bug. This bug seems to be caused by pytorch v0.4 when compiling the c++ extension, which is caused by different versions of g++. So we need to set the correct g++ version when compiling the c++ extension. As my original answer, you need to first find the directory of the python or anaconda environment on your computer. Here I use my_conda_env to represent my environment directory, and then through this path "my_conda_env/lib/python3.7/site-packages/torch/utils/cpp_extension.py " to find the cpp_extension.py file. Then you need to use an editor (such as vim or vscode) to open the cpp_extension.py file, find -D_GLIBCXX_USE_CXX11_ABI inside, set its corresponding value to 1 and save it. After going through the above steps, re-run the "python setup.py install" command, it should be able to solve this problem. I hope my answer can help you. 请问是直接用1替换掉cpp_extension.py中所有的-D_GLIBCXX_USE_CXX11_ABI吗? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

我把那个值设为1还是有这个问题...

嘿,请问你解决这个问题了吗,我设置为1也不行

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

No branches or pull requests