from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
import os
from distutils.sysconfig import get_config_vars
(opt,) = get_config_vars('OPT')
os.environ['OPT'] = " ".join(
flag for flag in opt.split() if flag != '-Wstrict-prototypes'
)
setup(
name = 'helloworld',
ext_modules = cythonize(
Extension(
"helloworld",
["helloworld.pyx"],
language = "c++",
libraries = ["v8", "stdc++"],
library_dirs = ["v8"],
include_dirs = ["v8/include"],
runtime_library_dirs = ["v8"],
extra_compile_args = ["-std=c++11"],
extra_link_args = ["-std=c++11"],
#cmdclass = {'build_ext': build_ext}
)
)
)
from libcpp cimport bool
cdef extern from "v8.h" namespace "v8":
cdef cppclass V8:
@staticmethod
bool InitializeICU(const char *icu_data_file)
#@staticmethod
#void InitializeExternalStartupData(const char* directory_path)
cdef class Script:
def ini(self):
cdef char* xyz = 'bla'
return V8.InitializeICU(xyz)
def test(self):
self.init()
return "wow"
Traceback (most recent call last):
File "test.py", line 1, in <module>
import helloworld
ImportError: /opt/cython/helloworld.so: undefined symbol: _ZN2v82V813InitializeICUEPKc
Hi,
I try to run v8 in python and i can't run it... :(
icui18n
" to libraries?Shot in the dark, have you tried adding "icui18n
" to libraries?
$ pkg-config --libs icu-i18n
-licui18n -licuuc -licudata
pkg-config --libs icu-i18n
Package icu-i18n was not found in the pkg-config search path.
Perhaps you should add the directory containing `icu-i18n.pc'
to the PKG_CONFIG_PATH environment variable
No package 'icu-i18n' found