Python — компиляция Cython работает на компьютере, но не на сервере

Когда я компилирую программу на своем домашнем компьютере, она работает нормально, но не работает на моем сервере, что странно, потому что оба файла идентичны, и я использую conda управлять средой на обоих. Вот сообщение об ошибке, которое я получаю на моем сервере:

running build_ext
building 'LDFMap' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/rpandit2/miniconda3/envs/LDFMap/lib/python3.4/site-packages/numpy/core/include -I/home/rpandit2/LDFMap/src/include -I/home/rpandit2/miniconda3/envs/LDFMap/include/python3.4m -c LDFMap.cpp -o build/temp.linux-x86_64-3.4/LDFMap.o -I /home/rpandit2/LDFMap/src/include -I /usr/local/include
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /home/rpandit2/miniconda3/envs/LDFMap/lib/python3.4/site-packages/numpy/core/include/numpy/ndarraytypes.h:1804:0,
from /home/rpandit2/miniconda3/envs/LDFMap/lib/python3.4/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /home/rpandit2/miniconda3/envs/LDFMap/lib/python3.4/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from LDFMap.cpp:284:
/home/rpandit2/miniconda3/envs/LDFMap/lib/python3.4/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^
In file included from /usr/include/stdio.h:929:0,
from /home/rpandit2/miniconda3/envs/LDFMap/include/python3.4m/Python.h:25,
from LDFMap.cpp:43:
/usr/include/bits/stdio.h: In function ‘__ssize_t getline(char**, size_t*, FILE*)’:
/usr/include/bits/stdio.h:118:52: error: ‘__getdelim’ was not declared in this scope
return __getdelim (__lineptr, __n, '\n', __stream);
^
In file included from /home/rpandit2/miniconda3/envs/LDFMap/include/python3.4m/Python.h:30:0,
from LDFMap.cpp:43:
/usr/include/string.h: At global scope:
/usr/include/string.h:548:5: error: ‘__locale_t’ has not been declared
__locale_t __loc)
^
In file included from /home/rpandit2/miniconda3/envs/LDFMap/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed/features.h:338:0,
from /usr/include/limits.h:27,
from /home/rpandit2/miniconda3/envs/LDFMap/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed/limits.h:168,
from /home/rpandit2/miniconda3/envs/LDFMap/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed/syslimits.h:7,
from /home/rpandit2/miniconda3/envs/LDFMap/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed/limits.h:34,
from /home/rpandit2/miniconda3/envs/LDFMap/include/python3.4m/Python.h:11,
from LDFMap.cpp:43:
/usr/include/string.h:549:33: error: nonnull argument references non-pointer operand (argument 1, operand 3)
__THROW __attribute_pure__ __nonnull ((1, 2, 3));
^
In file included from /home/rpandit2/miniconda3/envs/LDFMap/include/python3.4m/Python.h:30:0,
from LDFMap.cpp:43:
/usr/include/string.h:552:18: error: ‘__locale_t’ has not been declared
size_t __n, __locale_t __loc)
^
In file included from /home/rpandit2/miniconda3/envs/LDFMap/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed/features.h:338:0,
from /usr/include/limits.h:27,
from /home/rpandit2/miniconda3/envs/LDFMap/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed/limits.h:168,
from /home/rpandit2/miniconda3/envs/LDFMap/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed/syslimits.h:7,
from /home/rpandit2/miniconda3/envs/LDFMap/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include-fixed/limits.h:34,
from /home/rpandit2/miniconda3/envs/LDFMap/include/python3.4m/Python.h:11,
from LDFMap.cpp:43:
/usr/include/string.h:553:33: error: nonnull argument references non-pointer operand (argument 1, operand 4)
__THROW __attribute_pure__ __nonnull ((1, 2, 4));
^
/home/rpandit2/LDFMap/src/include/rmsd.h:46:93: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
In file included from /home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/bits/localefwd.h:40:0,
from /home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/ios:41,
from /home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/istream:38,
from /home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/sstream:38,
from /home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/complex:45,
from LDFMap.cpp:488:
/home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/c++locale.h: At global scope:
/home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/c++locale.h:52:23: error: ‘uselocale’ was not declared in this scope
extern "C" __typeof(uselocale) __uselocale;
^
/home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/c++locale.h:52:45: error: invalid type in declaration before ‘;’ token
extern "C" __typeof(uselocale) __uselocale;
^
/home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
/home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/c++locale.h:75:53: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
^
/home/rpandit2/miniconda3/envs/LDFMap/include/c++/4.8.2/x86_64-unknown-linux-gnu/bits/c++locale.h:100:33: error: ‘__gnu_cxx::__uselocale’ cannot be used as a function
__gnu_cxx::__uselocale(__old);
^
^

Команда gcc, запущенная на моем компьютере (работает), идентична команде на сервере.

 gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/ubuntu/miniconda3/envs/LDFMap/lib/python3.4/site-packages/numpy/core/include -I/home/ubuntu/LDFMap/src/include -I/home/ubuntu/miniconda3/envs/LDFMap/include/python3.4m -c LDFMap.cpp -o build/temp.linux-x86_64-3.4/LDFMap.o -I /home/ubuntu/LDFMap/src/include -I /usr/local/include

и, наконец, вот мой setup.py (на сервере):

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
from Cython.Build import cythonize
import numpy as np
import os

# usage: python setup.py build_ext --inplace
# you will have to change include_dirs, library_dirs, and extra_compile_args
# to the absolute path of the Include directory in your system

#os.environ["CC"] = "g++"#os.environ["CXX"] = "g++"
setup(
author = "Rohan Pandit",
url='https://www.github.com/rohanp/LDFMap',
ext_modules = cythonize([Extension( name = "LDFMap",
sources = ["LDFMap.pyx"],
include_dirs = [np.get_include(), "/home/rpandit2/LDFMap/src/include"],
language="c++",
libraries = ["lapack", "blas"],
extra_compile_args = ["-I /home/rpandit2/LDFMap/src/include", "-I /usr/local/include"],
)])

)

0

Решение

Задача ещё не решена.

Другие решения


По вопросам рекламы [email protected]