您尚未登录。

#1 2014-01-14 23:26:07

chenzhen2181
会员
注册时间: 2013-12-12
帖子: 52

makefile的一些疑问

需要编译一个程序。
makefile里面有几句是这么写的

SRCDIR  = .
PREFIX  = /usr
COMPILE = gfortran
FLAGS = -g -fdefault-real-8 -ffixed-form -O2 -fPIC
LIB  =  $(shell $(NC_CONFIG) --flibs)
INCLUDE = -I$(INCDIR)
F2PY = f2py
F2PY_LIB = -L${LIBDIR} -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl
F2PY_INCLUDE = -I${INCDIR}
F2PY_F90_FLAG= '-g -fdefault-real-8 -ffixed-form -O2 -fPIC'

f2py: $(SRCDIR)/scrip.so
$(SRCDIR)/scrip.so: $(SRCDIR)/pyscrip.f90 $(OBJF2PY)
    $(F2PY) --fcompiler=gnu95 --f90flags=$(F2PY_F90_FLAG) \                # line 148
    $(F2PY_LIB) $(F2PY_INCLUDE) -m scrip \
    -c $(OBJF2PY) pyscrip.f90

我在终端里
#make f2py
出现如下错误
make : f2py: Command not found
makefile : 148: recipe for target 'scrip.so' failed
请教各位,为什么会有这样的错误,谢谢!

最近编辑记录 chenzhen2181 (2014-01-14 23:27:43)

离线

#2 2014-01-15 00:08:26

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,384
个人网站

Re: makefile的一些疑问

因为你没有一个叫 f2py 的可执行文件在 $PATH 的路径里边。

离线

#3 2014-01-15 13:18:09

lainme
论坛版主
注册时间: 2011-08-19
帖子: 131

Re: makefile的一些疑问

pacman -S python-numpy

这样就有f2py了

离线

#4 2014-01-16 09:53:40

chenzhen2181
会员
注册时间: 2013-12-12
帖子: 52

Re: makefile的一些疑问

谢谢,你们的回复
我的确没有f2py命令,这个命令在我的系统里被替换为f2py2
我安装的是python2-numpy
我将修改F2PY = f2py2
再make 时 出现
collect2: error: ld returned 1 exit status
请问下这个是什么意思啊?

离线

#5 2014-01-16 11:31:03

lainme
论坛版主
注册时间: 2011-08-19
帖子: 131

Re: makefile的一些疑问

完整的信息呢?你是编译什么程序,网上能找到?

离线

#6 2014-01-16 12:45:22

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,384
个人网站

Re: makefile的一些疑问

chenzhen2181 说:

谢谢,你们的回复
我的确没有f2py命令,这个命令在我的系统里被替换为f2py2
我安装的是python2-numpy
我将修改F2PY = f2py2
再make 时 出现
collect2: error: ld returned 1 exit status
请问下这个是什么意思啊?

是链接出错的意思。
先看看 http://lilydjwg.vim-cn.com/articles/sma … tions.html

离线

#7 2014-01-16 15:40:58

chenzhen2181
会员
注册时间: 2013-12-12
帖子: 52

Re: makefile的一些疑问

谢谢各位的回复,我需要编译的软件是  https://github.com/kshedstrom/pyroms
yaourt没有搜索到,需要自己编译。
由于上述网站提示只能用<3.0 版本的python ,所以我安装的numpy scipy matplotlib basemap from matplotlib 等 都是python2 的版本
通过yaourt可以很好安装上面的软件,通过
  cd pyroms_toolbox; python setup.py build --fcompiler=gnu95;
                     python setup.py install --prefix=xxx;
  cd bathy_smoother; python setup.py build;
                     python setup.py install --prefix=xxx;
我也能成功安装pyroms_toolbox和bathy_smoother,但问题出现在/pyroms/install_pyroms.sh
首先我修改了install_pyroms.sh,
DESTDIR=/usr
python替换为python2
在pyroms/pyroms/external/scrip/source/makefile中,修改
F2PY = f2py2

cd 到pyroms 文件夹
输入# sh install_pyroms.sh > install.log
接下来屏幕显示:

[root@chenzhen pyroms]# sh install_pyroms.sh > install.log
rmbadname1: Replacing "string" with "string_bn".
rmbadname1: Replacing "string" with "string_bn".
error: Command "/usr/bin/gfortran -Wall -L$DESTDIR/lib build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/_isomodule.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/fortranobject.o build/temp.linux-x86_64-2.7/pyroms/src/iso.o -L/usr/lib -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/_iso.so" failed with exit status 1
error: Command "/usr/bin/gfortran -Wall -L$DESTDIR/lib build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/_isomodule.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/fortranobject.o build/temp.linux-x86_64-2.7/pyroms/src/iso.o -L/usr/lib -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/_iso.so" failed with exit status 1
make: Warning: File 'makefile' has modification time 1.9 s in the future
make: warning: Clock skew detected. Your build may be incomplete.
make: Warning: File 'makefile' has modification time 1.9 s in the future
make: warning: Clock skew detected. Your build may be incomplete.
make: Warning: File 'makefile' has modification time 1.9 s in the future
make: warning: Clock skew detected. Your build may be incomplete.
make: Warning: File 'makefile' has modification time 1.9 s in the future
make: warning: Clock skew detected. Your build may be incomplete.
make: Warning: File 'triangle.o' has modification time 0.92 s in the future
make: warning: Clock skew detected. Your build may be incomplete.
install_pyroms.sh: line 34: python: command not found
cp: missing destination file operand after ‘libgridgen.so’
Try 'cp --help' for more information.
make: Warning: File 'makefile2' has modification time 2 s in the future
make: warning: Clock skew detected. Your build may be incomplete.
make: Warning: File 'remap_read.o' has modification time 0.18 s in the future
error: Command "/usr/bin/gfortran -Wall -L$DESTDIR/lib /tmp/tmpDF6Nrn/tmp/tmpDF6Nrn/src.linux-x86_64-2.7/scripmodule.o /tmp/tmpDF6Nrn/tmp/tmpDF6Nrn/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpDF6Nrn/pyscrip.o kinds_mod.o constants.o iounits.o netcdf.o grids.o remap_vars.o remap_distwgt.o remap_conserv.o remap_bilinear.o remap_bicubic.o remap_read.o remap.o timers.o remap_write.o -L/usr/lib -L/usr/lib -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl -lpython2.7 -lgfortran -o ./scrip.so" failed with exit status 1
make: *** [scrip.so] Error 1
/bin/cp: cannot stat ‘./scrip.so’: No such file or directory
make: *** [install] Error 1
cp: missing destination file operand after ‘scrip.so’
Try 'cp --help' for more information.

不知道论坛怎么上传附件,但是可以在下面网址下载到,最后一个回复的install.log文件
https://www.myroms.org/forum/viewtopic.php?f=14&t=3199

最近编辑记录 依云 (2014-01-16 21:37:57)

离线

#8 2014-01-16 17:24:58

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,384
个人网站

Re: makefile的一些疑问

我没法把 install.log 和 stderr 的输出对上。你再试试  sh install_pyroms.sh &> install.log 将 stdout 和 stderr 收集到一起?

install_pyroms.sh: line 34: python: command not found 这行挺奇怪的。

你可以试试新建一个目录,其中放个链接到 /usr/bin/python2 的 python 链接,然后加到 $PATH 最开头,再试试。

离线

#9 2014-01-16 20:23:42

lainme
论坛版主
注册时间: 2011-08-19
帖子: 131

Re: makefile的一些疑问

我试了一下,安装脚本和源码都有不少问题。你试着参考一下这里的

http://houstonthereisaproblem.blogspot. … -1072.html

离线

#10 2014-01-16 21:27:11

chenzhen2181
会员
注册时间: 2013-12-12
帖子: 52

Re: makefile的一些疑问

非常感谢你们的回复
感谢lainme热心的尝试,但是你给的链接,我不知为什么打不开。
install_pyroms.sh: line 34: python: command not found 可能是我的python版本是2.7的 不是3.0 所以
PYROMS_PATH=`python -c 'import pyroms ; print pyroms.__path__[0]'`   # line 34
python 可能应该改为python2 ,之前没有改。
按照仙子sh install_pyroms.sh &> install.log 命令,现将install.log内容显示如下:

installing pyroms...

running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "_iso" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
building extension "_interp" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
building extension "_obs_interp" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
  adding 'build/src.linux-x86_64-2.7/_obs_interp-f2pywrappers.f' to sources.
building extension "_remapping" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
building extension "_remapping_fast" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
building extension "_remapping_fast_weighted" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
build_src: building npy-pkg config files
running build_py
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize Gnu95FCompiler
Found executable /usr/bin/gfortran
customize Gnu95FCompiler using build_ext
building '_iso' extension
compiling C sources
C compiler: gcc -pthread -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -I/usr/include -I/usr/include -fPIC

compile options: '-Ibuild/src.linux-x86_64-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
gcc: build/src.linux-x86_64-2.7/fortranobject.c
In file included from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:0,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from build/src.linux-x86_64-2.7/fortranobject.h:13,
                 from build/src.linux-x86_64-2.7/fortranobject.c:2:
/usr/lib/python2.7/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 " \
  ^
gcc: build/src.linux-x86_64-2.7/_isomodule.c
In file included from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:0,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from build/src.linux-x86_64-2.7/fortranobject.h:13,
                 from build/src.linux-x86_64-2.7/_isomodule.c:18:
/usr/lib/python2.7/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 " \
  ^
compiling Fortran sources
Fortran f77 compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran f90 compiler: /usr/bin/gfortran -Wall -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran fix compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -Wall -fno-second-underscore -fPIC -O3 -funroll-loops
compile options: '-Ibuild/src.linux-x86_64-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
gfortran:f77: pyroms/src/iso.f
pyroms/src/iso.f:119.59:

              call splint (zk,fk,wk,N,depths(j,i),f2d(j,i),dfdz)        
                                                           1
Warning: Rank mismatch in argument 'dydx' at (1) (scalar and rank-1)
pyroms/src/iso.f: In function ‘lintrp’:
pyroms/src/iso.f:151:0: warning: ‘ii’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       integer i, ii, j, n, ni
 ^
/usr/bin/gfortran -Wall -L$DESTDIR/lib build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/_isomodule.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/fortranobject.o build/temp.linux-x86_64-2.7/pyroms/src/iso.o -L/usr/lib -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/_iso.so
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -L$DESTDIR/lib build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/_isomodule.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/fortranobject.o build/temp.linux-x86_64-2.7/pyroms/src/iso.o -L/usr/lib -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/_iso.so" failed with exit status 1
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "_iso" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
building extension "_interp" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
building extension "_obs_interp" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
  adding 'build/src.linux-x86_64-2.7/_obs_interp-f2pywrappers.f' to sources.
building extension "_remapping" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
building extension "_remapping_fast" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
building extension "_remapping_fast_weighted" sources
f2py options: []
  adding 'build/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding 'build/src.linux-x86_64-2.7' to include_dirs.
build_src: building npy-pkg config files
running build_py
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize Gnu95FCompiler
Found executable /usr/bin/gfortran
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building '_iso' extension
compiling C sources
C compiler: gcc -pthread -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -I/usr/include -I/usr/include -fPIC

compile options: '-Ibuild/src.linux-x86_64-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
gcc: build/src.linux-x86_64-2.7/fortranobject.c
In file included from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:0,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from build/src.linux-x86_64-2.7/fortranobject.h:13,
                 from build/src.linux-x86_64-2.7/fortranobject.c:2:
/usr/lib/python2.7/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 " \
  ^
gcc: build/src.linux-x86_64-2.7/_isomodule.c
In file included from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:0,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from build/src.linux-x86_64-2.7/fortranobject.h:13,
                 from build/src.linux-x86_64-2.7/_isomodule.c:18:
/usr/lib/python2.7/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 " \
  ^
compiling Fortran sources
Fortran f77 compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran f90 compiler: /usr/bin/gfortran -Wall -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran fix compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -Wall -fno-second-underscore -fPIC -O3 -funroll-loops
compile options: '-Ibuild/src.linux-x86_64-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
gfortran:f77: pyroms/src/iso.f
pyroms/src/iso.f:119.59:

              call splint (zk,fk,wk,N,depths(j,i),f2d(j,i),dfdz)        
                                                           1
Warning: Rank mismatch in argument 'dydx' at (1) (scalar and rank-1)
pyroms/src/iso.f: In function ‘lintrp’:
pyroms/src/iso.f:151:0: warning: ‘ii’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       integer i, ii, j, n, ni
 ^
/usr/bin/gfortran -Wall -L$DESTDIR/lib build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/_isomodule.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/fortranobject.o build/temp.linux-x86_64-2.7/pyroms/src/iso.o -L/usr/lib -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/_iso.so
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -L$DESTDIR/lib build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/_isomodule.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/fortranobject.o build/temp.linux-x86_64-2.7/pyroms/src/iso.o -L/usr/lib -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/_iso.so" failed with exit status 1
installing external libraries...
installing gridgen...
Using prefix /usr
Using libdir /usr/lib
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for ar... ar
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking for main in -lm... yes
checking for realloc... yes
checking for strtod... yes
checking for strtok... yes
checking for hypot... yes
checking for -fno-force-mem option... no
configure: creating ./config.status
config.status: creating makefile
config.status: creating config.h
config.status: config.h is unchanged
make: Warning: File 'makefile' has modification time 0.72 s in the future
/bin/sh mkinstalldirs /usr/bin /usr/lib /usr/include
for i in libnn.a; do \
   /usr/bin/install -c -m 644 $i /usr/lib/$i; \
done
for i in nn.h; do \
   /usr/bin/install -c -m 644 $i /usr/include; \
done
for i in minell nnbathy; do \
   fname=`basename $i`; \
   /usr/bin/install -c $i /usr/bin; \
done
make: warning:  Clock skew detected.  Your build may be incomplete.
Using prefix /usr
Using libdir /usr/lib
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for ar... ar
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking for main in -lm... yes
checking for realloc... yes
checking for hypot... yes
checking for copysign... yes
configure: creating ./config.status
config.status: creating makefile
config.status: creating config.h
config.status: config.h is unchanged
make: Warning: File 'makefile' has modification time 0.7 s in the future
/bin/sh mkinstalldirs /usr/bin /usr/lib /usr/include
for i in libcsa.a; do \
   /usr/bin/install -c -m 644 $i /usr/lib/$i; \
done
for i in csa.h; do \
   /usr/bin/install -c -m 644 $i /usr/include; \
done
for i in csabathy; do \
   fname=`basename $i`; \
   /usr/bin/install -c $i /usr/bin; \
done
make: warning:  Clock skew detected.  Your build may be incomplete.
Using prefix /usr
Using libdir /usr/lib
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for ar... ar
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking nn.h usability... yes
checking nn.h presence... yes
checking for nn.h... yes
checking csa.h usability... yes
checking csa.h presence... yes
checking for csa.h... yes
checking for main in -lm... yes
checking for main in -lnn... yes
checking for main in -lcsa... yes
checking for ANSI C header files... (cached) yes
checking for strcasecmp... yes
checking for strerror... yes
checking for isnan... yes
configure: creating ./config.status
config.status: creating makefile
config.status: creating gridutilsconfig.h
config.status: gridutilsconfig.h is unchanged
make: Warning: File 'makefile' has modification time 0.7 s in the future
  installing libgu.a
  installing libgu.so
  installing gridmap.h
  installing gucommon.h
  installing gridnodes.h
  installing getbound
  installing getnodes
  installing insertgrid
  installing setbathy
  installing subgrid
  installing xy2ij
  installing gridbathy
make: warning:  Clock skew detected.  Your build may be incomplete.
Using prefix /usr
Using libdir /usr/lib
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for ar... ar
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking for main in -lm... yes
checking for tgamma... yes
checking complex.h usability... yes
checking complex.h presence... yes
checking for complex.h... yes
checking for clog... yes
checking for cexp... yes
checking for keyword _Complex... yes
checking gridnodes.h usability... yes
checking gridnodes.h presence... yes
checking for gridnodes.h... yes
checking for gridnodes_readnextpoint in -lgu... yes
configure: creating ./config.status
config.status: creating makefile
config.status: creating config.h
config.status: config.h is unchanged
make: Warning: File 'makefile' has modification time 0.72 s in the future
make: warning:  Clock skew detected.  Your build may be incomplete.
make: Warning: File 'makefile' has modification time 0.71 s in the future
make: Nothing to be done for 'lib'.
make: warning:  Clock skew detected.  Your build may be incomplete.
make: Warning: File 'makefile' has modification time 0.7 s in the future
make: Nothing to be done for 'shlib'.
make: warning:  Clock skew detected.  Your build may be incomplete.
make: Warning: File 'makefile' has modification time 0.69 s in the future
  installing gridgen
  installing gridgen.h
  installing libgridgen.a
  installing libgridgen.so
make: warning:  Clock skew detected.  Your build may be incomplete.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named pyroms
cp: missing destination file operand after ‘libgridgen.so’
Try 'cp --help' for more information.
installing scrip...
make: Warning: File 'makefile2' has modification time 0.77 s in the future
make: Nothing to be done for 'all'.
make: warning:  Clock skew detected.  Your build may be incomplete.
make: Warning: File 'makefile2' has modification time 0.76 s in the future
f2py2 --fcompiler=gnu95 --f90flags='-g -fdefault-real-8 -ffixed-form -O2 -fPIC' \
-L/usr/lib -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl -I/usr/include -m scrip \
-c kinds_mod.o constants.o iounits.o netcdf.o grids.o remap_vars.o remap_distwgt.o remap_conserv.o remap_bilinear.o remap_bicubic.o remap_read.o remap.o timers.o remap_write.o  pyscrip.f90
Reading .f2py_f2cmap ...
	Mapping "real(kind=dbl_kind)" to "double"
	Mapping "integer(kind=int_kind)" to "int"
	Mapping "logical(kind=log_kind)" to "char"
Succesfully applied user defined changes from .f2py_f2cmap
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "scrip" sources
f2py options: []
f2py:> /tmp/tmpIMJyZX/src.linux-x86_64-2.7/scripmodule.c
creating /tmp/tmpIMJyZX
creating /tmp/tmpIMJyZX/src.linux-x86_64-2.7
Reading fortran codes...
	Reading file 'pyscrip.f90' (format:fix)
Post-processing...
	Block: scrip
			Block: compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module kinds_mod info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module grids info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module remap_distance_weight info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module remap_bicubic info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module remap_bilinear info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module remap_write info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module remap_vars info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module remap_conservative info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module timers info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module iounits info used by compute_remap_weights
In: :scrip:pyscrip.f90:compute_remap_weights
get_useparameters: no module constants info used by compute_remap_weights
			Block: test_remap_weights
In: :scrip:pyscrip.f90:test_remap_weights
get_useparameters: no module kinds_mod info used by test_remap_weights
In: :scrip:pyscrip.f90:test_remap_weights
get_useparameters: no module grids info used by test_remap_weights
In: :scrip:pyscrip.f90:test_remap_weights
get_useparameters: no module remap_read info used by test_remap_weights
In: :scrip:pyscrip.f90:test_remap_weights
get_useparameters: no module netcdf_mod info used by test_remap_weights
In: :scrip:pyscrip.f90:test_remap_weights
get_useparameters: no module remap_mod info used by test_remap_weights
In: :scrip:pyscrip.f90:test_remap_weights
get_useparameters: no module remap_vars info used by test_remap_weights
In: :scrip:pyscrip.f90:test_remap_weights
get_useparameters: no module iounits info used by test_remap_weights
In: :scrip:pyscrip.f90:test_remap_weights
get_useparameters: no module constants info used by test_remap_weights
			Block: remap
In: :scrip:pyscrip.f90:remap
get_useparameters: no module kinds_mod info used by remap
In: :scrip:pyscrip.f90:remap
get_useparameters: no module constants info used by remap
Post-processing (stage 2)...
Building modules...
	Building module "scrip"...
		Constructing wrapper function "compute_remap_weights"...
		  compute_remap_weights(namelist_file)
		Constructing wrapper function "test_remap_weights"...
		  test_remap_weights(namelist_file)
		Constructing wrapper function "remap"...
		  remap(dst_array,map_wts,dst_add,src_add,src_array,[num_links,src_grid_size,dst_grid_size,src_grad1,src_grad2,src_grad3])
	Wrote C/API module "scrip" to file "/tmp/tmpIMJyZX/src.linux-x86_64-2.7/scripmodule.c"
  adding '/tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.c' to sources.
  adding '/tmp/tmpIMJyZX/src.linux-x86_64-2.7' to include_dirs.
copying /usr/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmpIMJyZX/src.linux-x86_64-2.7
copying /usr/lib/python2.7/site-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmpIMJyZX/src.linux-x86_64-2.7
build_src: building npy-pkg config files
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize Gnu95FCompiler
Found executable /usr/bin/gfortran
customize Gnu95FCompiler using build_ext
building 'scrip' extension
compiling C sources
C compiler: gcc -pthread -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -I/usr/include -I/usr/include -fPIC

creating /tmp/tmpIMJyZX/tmp
creating /tmp/tmpIMJyZX/tmp/tmpIMJyZX
creating /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7
compile options: '-I/usr/include -I/tmp/tmpIMJyZX/src.linux-x86_64-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
gcc: /tmp/tmpIMJyZX/src.linux-x86_64-2.7/scripmodule.c
In file included from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:0,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from /tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.h:13,
                 from /tmp/tmpIMJyZX/src.linux-x86_64-2.7/scripmodule.c:18:
/usr/lib/python2.7/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 " \
  ^
gcc: /tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.c
In file included from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:0,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from /tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.h:13,
                 from /tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.c:2:
/usr/lib/python2.7/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 " \
  ^
compiling Fortran sources
Fortran f77 compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops
Fortran f90 compiler: /usr/bin/gfortran -g -fdefault-real-8 -ffixed-form -O2 -fPIC -fPIC -O3 -funroll-loops
Fortran fix compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -g -fdefault-real-8 -ffixed-form -O2 -fPIC -fPIC -O3 -funroll-loops
compile options: '-I/usr/include -I/tmp/tmpIMJyZX/src.linux-x86_64-2.7 -I/usr/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
gfortran:fix: pyscrip.f90
pyscrip.f90:1191.20:

      grid2_count = zero                                                
                    1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1)
/usr/bin/gfortran -Wall -L$DESTDIR/lib /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7/scripmodule.o /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpIMJyZX/pyscrip.o kinds_mod.o constants.o iounits.o netcdf.o grids.o remap_vars.o remap_distwgt.o remap_conserv.o remap_bilinear.o remap_bicubic.o remap_read.o remap.o timers.o remap_write.o -L/usr/lib -L/usr/lib -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl -lpython2.7 -lgfortran -o ./scrip.so
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -L$DESTDIR/lib /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7/scripmodule.o /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpIMJyZX/pyscrip.o kinds_mod.o constants.o iounits.o netcdf.o grids.o remap_vars.o remap_distwgt.o remap_conserv.o remap_bilinear.o remap_bicubic.o remap_read.o remap.o timers.o remap_write.o -L/usr/lib -L/usr/lib -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl -lpython2.7 -lgfortran -o ./scrip.so" failed with exit status 1
makefile2:148: recipe for target 'scrip.so' failed
make: *** [scrip.so] Error 1
/bin/cp ./scrip /usr/bin
/bin/cp ./scrip_test /usr/bin
/bin/cp ./scrip.so /usr/lib
/bin/cp: cannot stat ‘./scrip.so’: No such file or directory
makefile2:153: recipe for target 'install' failed
make: *** [install] Error 1
cp: missing destination file operand after ‘scrip.so’
Try 'cp --help' for more information.

Done installing pyroms...
pyroms make use of the so-called gridid file to store
grid information like the path to the grid file, the
number of vertical level, the vertical transformation
use, ...
Please set the environment variable PYROMS_GRIDID_FILE
to point to your gridid file. A gridid file template
is available here:
/python/pyroms/pyroms/gridid.txt
Press any key to continue or Ctrl+C to quit this install

最近编辑记录 依云 (2014-01-16 21:37:28)

离线

#11 2014-01-16 21:42:06

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,384
个人网站

Re: makefile的一些疑问

/usr/bin/gfortran -Wall -L$DESTDIR/lib /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7/scripmodule.o /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpIMJyZX/pyscrip.o kinds_mod.o constants.o iounits.o netcdf.o grids.o remap_vars.o remap_distwgt.o remap_conserv.o remap_bilinear.o remap_bicubic.o remap_read.o remap.o timers.o remap_write.o -L/usr/lib -L/usr/lib -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl -lpython2.7 -lgfortran -o ./scrip.so
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -L$DESTDIR/lib /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7/scripmodule.o /tmp/tmpIMJyZX/tmp/tmpIMJyZX/src.linux-x86_64-2.7/fortranobject.o /tmp/tmpIMJyZX/pyscrip.o kinds_mod.o constants.o iounits.o netcdf.o grids.o remap_vars.o remap_distwgt.o remap_conserv.o remap_bilinear.o remap_bicubic.o remap_read.o remap.o timers.o remap_write.o -L/usr/lib -L/usr/lib -lnetcdf -lnetcdff -lhdf5 -lhdf5_hl -lpython2.7 -lgfortran -o ./scrip.so" failed with exit status 1
makefile2:148: recipe for target 'scrip.so' failed

目测是编译的参数不过,少了告诉编译器要编译成动态链接库的参数(gcc 是 -shared,不知道 gfortran 是不是一样)。你可以加上试试。

另外,贴长代码时注意要使用 code 标签。

离线

#12 2014-01-16 21:45:03

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,384
个人网站

Re: makefile的一些疑问

PS: 链接打不开请使用百度搜索「如何使用 goagent 科学上网」。该软件 Arch 官方源里有,可直接使用 pacman 安装。

离线

#13 2014-01-16 21:50:01

lainme
论坛版主
注册时间: 2011-08-19
帖子: 131

Re: makefile的一些疑问

好吧。我似乎编译成功了。等会贴需要修正的地方
--------------------------------------------------------------------------------------------
差不多就是按blogspot上那个文章的方法,你找个在线代理应该就能看了。

1. bathy_smoother里的lpsolver55.so需要自己另行编译,具体方法看那文章

2. pyroms编译部分基本也按那个文章走,不要用install.pyroms.sh这个脚本。不同的地方主要在于编译scrip时先执行

export LDFLAGS="-L$LIBDIR -shared" #把$LIBDIR换成自己的安装路径的lib目录,比如 ~/.local/lib 或者 /usr/local/lib

同时makefile不必改那么多,只需把PREFIX改成自己的安装路径,以及把F2PY=f2py改成F2PY=f2py2就行了。

它里面有些改动只是为了编译成i386的,这些忽略掉就是。最后设置环境变量那里,不是每个都必须的,看你的安装路径,自己判断下。

如果还有其他问题,可能是依赖没装全。看出错信息就大概知道需要哪个包了

离线

#14 2014-01-16 23:07:11

chenzhen2181
会员
注册时间: 2013-12-12
帖子: 52

Re: makefile的一些疑问

谢谢仙子的建议和lainme的链接,我明天在学校在试着编译。
我会在以后的帖子中采用BBCode规范编辑代码。
期待 lainme 的编译     感谢!

离线

#15 2014-01-17 16:46:02

chenzhen2181
会员
注册时间: 2013-12-12
帖子: 52

Re: makefile的一些疑问

非常感谢lainme,按照blogspot上的文章和你的建议(特别是

export LDFLAGS="-L$LIBDIR -shared"

,非常有用),我似乎已经编译成功了。
运行

python2  make_YELLOW_grd_v1.py

时,  make_YELLOW_grd_v1.py 为pyroms里面的一个例子,我想测试下安装是否成功。
出现

lpsolve55.so not found 

我可以找到

 /usr/lib/liblpsolve55.so  /usr/lib/python2.7/site-packages/bathy_smoother/lpsolve55.so 

我觉得是python 模块路径没添加进去.
在网络搜索了下,尝试了如下方法:

nano /usr/lib/python2.7/site-packages/mymodule.pth
/usr/lib/python2.7/site-packages/bathy_smoother
/usr/lib

但还是会出现

lpsolve55.so not found 

在网上也搜索了相关解决方案,可能关键词不对,没有得到有效解决。
希望能得到大家的指导

离线

页脚