MMA9 Pythonika 在 Ubuntu 14.04 上编译错误

MMA9 Pythonika 在 Ubuntu 14.04 上编译错误

我正在 Ubuntu 14.04 上安装 Pythonika。我从以下网址下载了 Pythonika 的文件。 https://github.com/szhorvat/Pythonika

我能够使用 Makefile.linux 在 Ubuntu 12.04 上编译 Pythonika。但是,在升级到 Ubuntu 14.04 后,我收到以下错误。如能得到任何帮助,我将不胜感激。

Regrads,佐藤义博

我的系统是 Ubuntu 14.04 64 位和 Mathematica 9.0 for Linux x86 (64 位)(2013 年 2 月 18 日)。

$ python --version
Python 2.7.7 :: Anaconda 2.0.1 (64-bit)
$ which python
/home/satouy/anaconda/bin/python

$ make -f Makefile.linux
cc -I/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86- 
64/CompilerAdditions -I/usr/include/python2.7/ Pythonika.o Pythonikatm.o - 
L/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-
64/CompilerAdditions  
/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-
64/CompilerAdditions/libML64i3.a -lstdc++ -lrt -lpython2.7 -o Pythonika

/usr/bin/ld: /usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/
Linux-x86-64/CompilerAdditions/libML64i3.a(mlnumenv.c.o): undefined reference to symbol 
'fmod@@GLIBC_2.2.5' 

/lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Pythonika] error 1

我使用了以下 Makefile.linux。

$ cat Makefile.linux

# Set the paths according to your MathLink Developer Kit location.
# (The paths should not contain whitespaces)

MATHEMATICA_INSTALL_DIR = /usr/local/Wolfram/Mathematica/9.0
MLINKDIR = ${MATHEMATICA_INSTALL_DIR}/SystemFiles/Links/MathLink/DeveloperKit

##SYS = Linux
SYS = Linux-x86-64
CADDSDIR = ${MLINKDIR}/${SYS}/CompilerAdditions

INCDIR = ${CADDSDIR}
LIBDIR = ${CADDSDIR}

MPREP = "${CADDSDIR}/mprep"
MCC = "${CADDSDIR}/mcc"

# Modify the following for Python versions other than 2.6
PYTHON_VERSION_MAJOR = 2
##PYTHON_VERSION_MINOR = 6
PYTHON_VERSION_MINOR = 7

# Path to the Python includes (modify according to Python version)
#
PYTHONINC = /usr/include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/

PYTHONIKA = Pythonika
INCLUDES = -I${INCDIR} -I${PYTHONINC}

# libstdc++ and librt are, apparently, needed for correct compilation under Linux
# with libMLi3 statically linked
#
##LIBS = -L${LIBDIR} ${LIBDIR}/libML32i3.a -lstdc++ -lrt - 
lpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
##  64-bit system
LIBS = -L${LIBDIR} ${LIBDIR}/libML64i3.a -lstdc++ -lrt - 
lpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}

all : Pythonika

Pythonika: ${PYTHONIKA}.o ${PYTHONIKA}tm.o
    ${CC} ${INCLUDES} ${PYTHONIKA}.o ${PYTHONIKA}tm.o ${LIBS} -o ${PYTHONIKA}

${PYTHONIKA}tm.o: ${PYTHONIKA}.tm
    ${MPREP} ${PYTHONIKA}.tm -o ${PYTHONIKA}tm.c
    ${CC} -c ${PYTHONIKA}tm.c ${INCLUDES}

${PYTHONIKA}.o: ${PYTHONIKA}.c
    ${CC} -c ${PYTHONIKA}.c ${INCLUDES}

clean :
    rm -f ${PYTHONIKA}tm.* ${PYTHONIKA}.o ${PYTHONIKA}

更改我的 Python 环境后,我尝试编译它。我收到几乎相同的错误消息。你能告诉我如何解决这个问题吗?

$ python --version
Python 2.7.6
$ which python
/usr/bin/python

$ make -f Makefile.linux
cc -I/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-
64/CompilerAdditions -I/usr/include/python2.7/ Pythonika.o Pythonikatm.o 
-L/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions 
/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/libML64i3.a
-lstdc++ -lrt -lpython2.7 -o Pythonika

/usr/bin/ld: /usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/
Linux-x86-64/CompilerAdditions/libML64i3.a(mlnumenv.c.o): undefined reference to symbol  'fmod@@GLIBC_2.2.5' 
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Pythonika] error 1

答案1

我已经成功在Ubuntu 14.04上编译了pythonika。我需要在命令行中添加-lpthread -lm。

##     Ununtu 14.04 
LIBS = -L${LIBDIR} ${LIBDIR}/libML64i3.a -lstdc++ -lpthread -lm -lrt -lpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}

谢谢,佐藤义弘

答案2

我认为这可能是下载文件的软件问题,可能会删除下载的文件并找到另一个网站?如果这不起作用,那么很可能是 Linux 端的问题,如果您使用终端,也请尝试仔细检查您的命令。如果这没有太大帮助,请原谅,我仍然是 Linux 新手

相关内容