나는이 사이 썬의 설치 패키지화와 데비안 8을 실행하고 정의되지 않은 기호 "__gmpq_equal"(apt-get을 사이 썬 설치).CGAL 빌드 오류와 pyximport :
내가 CGAL 내 .pyx 파일 (www.cgal.org)를 컴파일 있지만 오류 반환하고 다음 파일과
import pyximport; pyximport.install()
from spaces import spaces_rectangle
ImportError: Building module spaces failed: ['ImportError: /home/scootie/.pyxbld/lib.linux-x86_64-2.7/spaces.so: undefined symbol: __gmpq_equal\n']
:
spaces.pyx을
from libcpp.vector cimport vector
cdef extern from "cgal_spaces.hpp":
cdef vector[vector[vector[double]]] wrap_spaces(vector[vector[double]])
def spaces_rectangle(vector[vector[double]] rect):
return wrap_spaces(rect)
spaces.pyxbld :
def make_ext(modname, pyxfilename):
from distutils.extension import Extension
return Extension(name=modname,
sources=[pyxfilename],
include_dirs=['.'],
libraries=['CGAL'],
language='c++',
extra_compile_args=['-std=c++11'])
및 cgal_spaces.hpp :
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Partition_traits_2.h>
#include <CGAL/Partition_is_valid_traits_2.h>
#include <CGAL/polygon_function_objects.h>
#include <CGAL/partition_2.h>
#include <cassert>
#include <list>
#include <vector>
{
*CODE HERE*
}
내가 잘못 연결하거나 뭔가를 분명 실종?
편집 : pyximport 외부 스크립트를 컴파일 할 경우 , 그것은 문제없이 컴파일합니다.
cython -a spaces.pyx
g++ -std=c++11 -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/usr/include/python2.7 -o spaces.so spaces.c
pyximport에는 gmp 라이브러리의 링크 오류가있는 것 같습니다. 모든 외부 라이브러리에 연결하는 적절한 방법은 무엇입니까?
가능한 중복 [왜 라이브러리가 가끔 연결되는 순서는 GCC에서 오류가 발생합니까?] (http://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries- - 연결되어 때로는 원인-오류 -에 - GCC이 정확히) –
했다! 솔루션을 설명하기 위해 메인 포스트에 추가 편집을 추가했습니다. 파이처럼 쉽게, 감사합니다 :) – scootie