Sto cercando di collegare un mio codice scritto in c++ con python utilizzando cython.
Durante la compilazione ho già una serie d'errori:
codice:tomas@tomas-tobefilledbyoem:~/Desktop/Projects/MonteCarlo$ python setup.py build_ext --inplace running build_ext skipping 'online_no_mem.cpp' Cython extension (up-to-date) building 'online_no_mem' extension gcc -pthread -B /home/tomas/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../Deck -I/home/tomas/Desktop/Projects/thirdparty/HandEvaluator-master/cpp/include -I/home/tomas/Desktop/Projects/MonteCarlo -I/home/tomas/anaconda3/include/python3.7m -c online_no_mem.cpp -o build/temp.linux-x86_64-cpython-37/online_no_mem.o libpheval.a -O3 -std=c++17 -fopenmp cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc: warning: libpheval.a: linker input file unused because linking not done g++ -pthread -B /home/tomas/anaconda3/compiler_compat -Wl,--sysroot=/ -pthread -shared -B /home/tomas/anaconda3/compiler_compat -L/home/tomas/anaconda3/lib -Wl,-rpath=/home/tomas/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-37/online_no_mem.o -o /home/tomas/Desktop/Projects/MonteCarlo/online_no_mem.cpython-37m-x86_64-linux-gnu.so
Il setup per l'installazione è:
codice:#cython: language_level=3 from setuptools import setup, find_packages, Extension from Cython.Distutils import build_ext from Cython.Build import cythonize setup( name="online_no_mem", packages=find_packages(include=['.', '.*']), zip_safe=False, ext_modules=[ Extension( "online_no_mem", sources=["online_no_mem.pyx"], extra_compile_args=[ "libpheval.a", "-O3", "-std=c++17", "-fopenmp"], include_dirs=['../Nodes', '/home/tomas/Desktop/Projects/thirdparty/HandEvaluator-master/cpp/include', '/home/tomas/Desktop/Projects/MC'], language="c++", )], cmdclass = {'build_ext': build_ext} )
L'errore invece:
Il problema sta nella libreria che provo a linkare "libpheval.a", perchè disabilitando OpenMP mi da un errore che riporta a quella libreria:codice:>>> import online_no_mem Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: /home/tomas/Desktop/Projects/MC/online_no_mem.cpython-37m-x86_64-linux-gnu.so: undefined symbol: GOMP_critical_end
undefined symbol: _ZN11phevaluator13EvaluateERKNS_4ES2_S2_S2_S2_S2_S 2_

 
			
			 
					
					
					
						 Rispondi quotando
  Rispondi quotando