Linux: (.text+0x20): undefined reference to `main'
gfortran -Wall -g build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/fortranobject.o -L/opt/intel/ext_tools/lib -Lbuild/temp.linux-x86_64-2.7 -ldfftpack -lfftpack -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so
/usr/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: エラー: ld はステータス 1 で終了しました
error: Command "gfortran -Wall -g build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/fortranobject.o -L/opt/intel/ext_tools/lib -Lbuild/temp.linux-x86_64-2.7 -ldfftpack -lfftpack -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so" failed with exit status 1
shared_bash.sh
while :
do
make>&temp
python shared.py
if [ $? = 1 ]; then
break
fi
done
コマンドラインからshared.py
import os
import subprocess
path="hoge/scipy/"
with open("temp") as f:
strs = f.read().split('\n')
if "undefined reference to `main" in strs[-11]:
a = strs[-13].split("gfortran")
cmd = a[0]+"gfortran"+" -shared"+a[1]
for aa in a[2:]:
cmd=cmd+"gfortran"+aa
os.chdir(path)
print "---------------------------"
print cmd
print "---------------------------"
print subprocess.call(cmd.split(" "))
exit(0)
else:
print "No share library."
exit(1)
bash shared_bash.shの力技でどうにか通った。
コメント
コメントを投稿