SeanNaren / warp-ctc

Pytorch Bindings for warp-ctc
Apache License 2.0
756 stars 271 forks source link

undefined symbol: _ZN3c105ErrorC1ENS_14SourceLocationERKSs #103

Closed HawkAaron closed 5 years ago

HawkAaron commented 5 years ago

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 commented 5 years ago

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

HawkAaron commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@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 commented 4 years ago

@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 commented 4 years ago

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

PMAngel commented 4 years ago

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

YanxianChen commented 4 years ago

@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 commented 4 years ago

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.

MountainsRivers commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

你好,是把这个参数的值设置为 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.

3139725181 commented 3 years ago

你好,是把这个参数的值设置为 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 commented 2 years ago

你好,是把这个参数的值设置为 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也不行