SWIG не поддерживает директиву include_next GNU - PullRequest
0 голосов
/ 26 марта 2020

Я пытаюсь создать привязки python, используя swig, для библиотеки, написанной на C ++.

Когда я работаю в Debian GNU / Linux 10

swig -I/usr/include \
    -I/usr/include/c++/8 \
    -I/usr/include/c++/8/tr1 \
    -I/usr/include/linux \
    -I/usr/include/x86_64-linux-gnu \
    -I/usr/include/x86_64-linux-gnu/c++/8 \
    -I/usr/share/swig3.0/python \
    -I$(KALDI_ROOT)/tools/openfst/src/include \
    -I$(KALDI_ROOT)/src \
    -includeall -c++ -python ConstArpaLmRescoring.i

, получается

/usr/include/c++/8/cstdlib:75: Error: Unknown SWIG preprocessor directive: include_next (if this is a block of target language code, delimit it with %{ and %})
/usr/include/c++/8/bits/std_abs.h:38: Error: Unknown SWIG preprocessor directive: include_next (if this is a block of target language code, delimit it with %{ and %})
/usr/include/c++/8/bits/c++0x_warning.h:32: Error: CPP #error "This file requires compiler and library support \
for the ISO C++ 2011 standard. This support must be enabled \
with the -std=c++11 or -std=gnu++11 compiler options.". Use the -cpperraswarn option to continue swig processing.
/usr/include/c++/8/cmath:45: Error: Unknown SWIG preprocessor directive: include_next (if this is a block of target language code, delimit it with %{ and %})
make: *** [Makefile:38: all] Error 1

Файлы, включающие директиву include_next, cmath complex.h cstdlib stdlib.h tgmath.h fenv.h math.h bits/std_abs.h

Какое решение вы порекомендуете для решения этой проблемы?

1 Ответ

2 голосов
/ 26 марта 2020

Удалить -includeall. Это попытка сделать обертки Swig для каждой функции в каждом включенном заголовочном файле, рекурсивно. Обычно вам нужны только функции в ваших пользовательских заголовках API.

...