Discussion:
[PyCUDA] undefined symbol error
Chris
2017-01-05 04:07:48 UTC
Permalink
Hey Andreas,
I am having a similar issue that Kambiz Tavabi was having. Here is the error
(I have pycuda on anaconda2 just like Kambiz)

File "main_class.py", line 17, in <module>
import pycuda.gl as cuda_gl
File
"/home/uchytilc/anaconda2/lib/python2.7/site-packages/pycuda-2016.1.2-py2.7-linux-x86_64.egg/pycuda/gl/__init__.py",
line 2, in <module>
import pycuda._driver as _drv
ImportError:
/home/uchytilc/anaconda2/lib/python2.7/site-packages/pycuda-2016.1.2-py2.7-linux-x86_64.egg/pycuda/_driver.so:
undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev

The weird thing is that I have some files that are having this problem and
some that are not, with identical import statements.

import sys

from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL.ARB.vertex_buffer_object import *
from OpenGL.GL.ARB.pixel_buffer_object import *

import pycuda.gl as cuda_gl
import pycuda.driver as cuda_driver

The files that are experiencing this issue are all files that run this
import statement right at the top in the main.py file, the one I initialize
from. The one that doesn't hit this error has the import statements in a
second file that is being imported with an __init__.py file. Not sure if
this is pure coincidence or not but I figured it was worth bringing up.



--
View this message in context: http://pycuda.2962900.n2.nabble.com/undefined-symbol-error-tp7575758.html
Sent from the PyCuda mailing list archive at Nabble.com.
Andreas Kloeckner
2017-01-30 01:36:21 UTC
Permalink
Post by Chris
Hey Andreas,
I am having a similar issue that Kambiz Tavabi was having. Here is the error
(I have pycuda on anaconda2 just like Kambiz)
File "main_class.py", line 17, in <module>
import pycuda.gl as cuda_gl
File
"/home/uchytilc/anaconda2/lib/python2.7/site-packages/pycuda-2016.1.2-py2.7-linux-x86_64.egg/pycuda/gl/__init__.py",
line 2, in <module>
import pycuda._driver as _drv
undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev
The weird thing is that I have some files that are having this problem and
some that are not, with identical import statements.
import sys
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL.ARB.vertex_buffer_object import *
from OpenGL.GL.ARB.pixel_buffer_object import *
import pycuda.gl as cuda_gl
import pycuda.driver as cuda_driver
The files that are experiencing this issue are all files that run this
import statement right at the top in the main.py file, the one I initialize
from. The one that doesn't hit this error has the import statements in a
second file that is being imported with an __init__.py file. Not sure if
this is pure coincidence or not but I figured it was worth bringing up.
Sorry for the delay in responding. GCC 5.1 switched its C++ ABI with version
5. I suspect some of the binary packages you have installed are using
the old ABI (Anaconda is built on CentOS 6 I believe and would be using
the old ABI), while C++ software you built on your machine (PyCUDA) will
use the new ABI. See here for more info:

https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

Try adding (in PyCUDA's siteconf.py)

-D_GLIBCXX_USE_CXX11_ABI=0

to CXXFLAGS.

Hope that helps,
Andreas
jredwards
2017-03-30 14:15:48 UTC
Permalink
Hi,

I have been getting the same error message:

Traceback (most recent call last):
File "test/test_driver.py", line 6, in <module>
from pycuda.tools import mark_cuda_test, dtype_to_ctype
File
"/home/jedwards/anaconda3/envs/py36/lib/python3.6/site-packages/pycuda-2016.1.2-py3.6-linux-x86_64.egg/pycuda/tools.py",
line 34, in <module>
import pycuda.driver as cuda
File
"/home/jedwards/anaconda3/envs/py36/lib/python3.6/site-packages/pycuda-2016.1.2-py3.6-linux-x86_64.egg/pycuda/driver.py",
line 5, in <module>
from pycuda._driver import * # noqa
ImportError:
/home/jedwards/anaconda3/envs/py36/lib/python3.6/site-packages/pycuda-2016.1.2-py3.6-linux-x86_64.egg/pycuda/_driver.cpython-36m-x86_64-linux-gnu.so:
undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev

I added -D_GLIBCXX_USE_CXX11_ABI=0 to the CXXFLAGS when remaking, but the
error continues to crop up.

Any ideas?

thanks

James



--
View this message in context: http://pycuda.2962900.n2.nabble.com/undefined-symbol-error-tp7575758p7575783.html
Sent from the PyCuda mailing list archive at Nabble.com.
Peter Walsh
2017-03-30 14:21:19 UTC
Permalink
Andreas' suggested fix (build pycuda yourself with CXX11_ABI option) worked
fine for me.

Are you sure you are running the newly built pycuda? The logs show you
using a virtual env etc, sure you installed newly built pycuda to that one
etc?
Post by jredwards
Hi,
File "test/test_driver.py", line 6, in <module>
from pycuda.tools import mark_cuda_test, dtype_to_ctype
File
"/home/jedwards/anaconda3/envs/py36/lib/python3.6/site-
packages/pycuda-2016.1.2-py3.6-linux-x86_64.egg/pycuda/tools.py",
line 34, in <module>
import pycuda.driver as cuda
File
"/home/jedwards/anaconda3/envs/py36/lib/python3.6/site-
packages/pycuda-2016.1.2-py3.6-linux-x86_64.egg/pycuda/driver.py",
line 5, in <module>
from pycuda._driver import * # noqa
/home/jedwards/anaconda3/envs/py36/lib/python3.6/site-
packages/pycuda-2016.1.2-py3.6-linux-x86_64.egg/pycuda/_dri
undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_
traitsIcESaIcEED1Ev
I added -D_GLIBCXX_USE_CXX11_ABI=0 to the CXXFLAGS when remaking, but the
error continues to crop up.
Any ideas?
thanks
James
--
View this message in context: http://pycuda.2962900.n2.
nabble.com/undefined-symbol-error-tp7575758p7575783.html
Sent from the PyCuda mailing list archive at Nabble.com.
_______________________________________________
PyCUDA mailing list
https://lists.tiker.net/listinfo/pycuda
jredwards
2017-03-30 14:43:57 UTC
Permalink
Thanks, yes it's definitely installed in that env. I have uninstalled pycuda,
performed a su -c "make clean" for the pycuda download and then re-run su -c
"make install" with the CXXFLAGS. Still getting the same error.



--
View this message in context: http://pycuda.2962900.n2.nabble.com/undefined-symbol-error-tp7575758p7575785.html
Sent from the PyCuda mailing list archive at Nabble.com.
Hanan
2017-11-29 09:08:35 UTC
Permalink
*** After suffering for a day I found I had a misspelled the CUDA_ROOT
environment variable! The setup scripts do not verify it is correct.... Be
ware! ***




--
Sent from: http://pycuda.2962900.n2.nabble.com/

Loading...