程序的编译和安装

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
syfnet
帖子: 213
注册时间: 2009-07-13 16:23

程序的编译和安装

#1

帖子 syfnet » 2009-08-11 16:16

几个程序在cygwin下都可以编译安装,但是在ubuntu下却告失败,我的ubuntu是9.04版,且已经全部升级,不知道缺了什么。

我能不能直接把在cygwin下编译的程序拷贝到ubuntu的目录中使用?
头像
lerosua
论坛版主
帖子: 8455
注册时间: 2007-11-29 9:41
联系:

Re: 程序的编译和安装

#2

帖子 lerosua » 2009-08-11 16:48

大哥,编译出错提示总打印出来吧,你光说,谁知道你啥问题啊
syfnet
帖子: 213
注册时间: 2009-07-13 16:23

Re: 程序的编译和安装

#3

帖子 syfnet » 2009-08-11 18:01

两个程序编译的错误信息如下:

1. 用fortran77 编写的程序,make 之后:
root@songyf-desktop:~/program/legacy_accessories/database# make
f77 -u -O2 -NC200 -c -o sdf2mol2.o sdf2mol2.f
MAIN sdf2mol2:
Error on line 82: impossible conversion
Error on line 82: incompatible types in initialization
Error on line 83: impossible conversion
Error on line 83: incompatible types in initialization
Warning on line 940: local variable isprotein never used
Warning on line 940: local variable bb never used
Warning on line 940: local variable islcletter never used
Warning on line 940: local variable ishydrogen never used
Warning on line 940: local variable isucletter never used
Warning on line 940: local variable bbb never used
Warning on line 940: local variable bond never used
Warning on line 940: local variable line never used
Warning on line 940: local variable iargc never used
Warning on line 940: local variable choice never used
Warning on line 940: local variable hostname_chars never used
Warning on line 940: local variable findeos never used
Warning on line 940: local variable isdigit never used
Warning on line 940: local variable isether never used
Warning on line 940: local variable num2char never used
Warning on line 940: local variable elmnts never used
insamering:
Warning on line 961: inconsistent calling sequences for inthisring:
here 3, previously 4 args and string lengths.
inthisring:
ringsep:
isaromaticatom:
border:
print_help:
/usr/bin/f77: aborting compilation
make: *** [sdf2mol2.o] 错误 25


2. 第二个程序,出错信息:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking auto silent in maintainer mode... auto-sleep-9
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
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 style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for a BSD-compatible install... /usr/bin/install -c
checking for doxygen... no
checking for swig... no
checking for perl... /usr/bin/perl
checking for python... /usr/bin/python
configure: WARNING: Cannot find doxygen to build documentation.
Have a look at http://www.doxygen.org/
checking for a sed that does not truncate output... /bin/sed
checking for egrep... grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -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 dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... f77
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether f77 accepts -g... yes
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking for shl_load... (cached) no
checking for shl_load in -ldld... (cached) no
checking for dlopen... (cached) no
checking for dlopen in -ldl... (cached) yes
checking whether a program can dlopen itself... (cached) yes
checking whether a statically linked program can dlopen itself... (cached) yes
appending configuration tag "F77" to libtool
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for f77 option to produce PIC... -fPIC
checking if f77 PIC flag -fPIC works... yes
checking if f77 supports -c -o file.o... yes
checking whether the f77 linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... /usr/bin/f77: Illegal option: -print-search-dirs
GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking for asin in -lm... yes
checking for dlopen in -lc... no
checking for dlopen in -ldl... (cached) yes
checking for xml2-config... no
checking for libxml - version >= 2.6.5... no
*** The xml2-config script installed by LIBXML could not be found
*** If libxml was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the XML2_CONFIG environment variable to the
*** full path to xml2-config.
checking for GetINCHI in -linchi... no
checking if zlib is wanted... checking for inflateEnd in -lz... no
checking zlib.h usability... no
checking zlib.h presence... no
checking for zlib.h... no
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for stdlib.h... (cached) yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking conio.h usability... no
checking conio.h presence... no
checking for conio.h... no
checking for string.h... (cached) yes
checking strstream.h usability... no
checking strstream.h presence... no
checking for strstream.h... no
checking iostream.h usability... no
checking iostream.h presence... no
checking for iostream.h... no
checking fstream.h usability... no
checking fstream.h presence... no
checking for fstream.h... no
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking iostream usability... yes
checking iostream presence... yes
checking for iostream... yes
checking fstream usability... yes
checking fstream presence... yes
checking for fstream... yes
checking sstream usability... yes
checking sstream presence... yes
checking for sstream... yes
checking strstream usability... yes
checking strstream presence... yes
checking for strstream... yes
checking whether time.h and sys/time.h may both be included... yes
checking for clock_t... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for rint... yes
checking for sranddev... no
checking for snprintf... yes
checking for strncasecmp... yes
checking whether scandir needs a const cast... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating data/Makefile
config.status: creating src/Makefile
config.status: creating src/math/Makefile
config.status: creating src/formats/Makefile
config.status: creating src/fingerprints/Makefile
config.status: creating src/formats/xml/Makefile
config.status: creating src/formats/inchi/Makefile
config.status: creating test/Makefile
config.status: creating test/cmltest/Makefile
config.status: creating tools/Makefile
config.status: creating doc/Makefile
config.status: creating scripts/Makefile
config.status: creating openbabel-2.0.pc
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.status: executing depfiles commands
config.status: executing src/babelconfig.h commands
Making all in data
make[1]: 正在进入目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/data'
make all-am
make[2]: 正在进入目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/data'
make[2]: 没有什么可以做的为 `all-am'。
make[2]:正在离开目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/data'
make[1]:正在离开目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/data'
Making all in src
make[1]: 正在进入目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/src'
make all-recursive
make[2]: 正在进入目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/src'
Making all in math
make[3]: 正在进入目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/src/math'
if /bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../src -I../../src -g -O2 -MT matrix3x3.lo -MD -MP -MF ".deps/matrix3x3.Tpo" -c -o matrix3x3.lo matrix3x3.cpp; \
then mv -f ".deps/matrix3x3.Tpo" ".deps/matrix3x3.Plo"; else rm -f ".deps/matrix3x3.Tpo"; exit 1; fi
g++ -DHAVE_CONFIG_H -I. -I. -I../../src -I../../src -g -O2 -MT matrix3x3.lo -MD -MP -MF .deps/matrix3x3.Tpo -c matrix3x3.cpp -fPIC -DPIC -o .libs/matrix3x3.o
In file included from ../../src/mol.h:51,
from matrix3x3.cpp:22:
../../src/data.h: In constructor 'OpenBabel::OBElement::OBElement(int, const char*, double, double, int, double, double, double, double, double, double, double, std::string)':
../../src/data.h:113: error: 'strncpy' was not declared in this scope
make[3]: *** [matrix3x3.lo] 错误 1
make[3]:正在离开目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/src/math'
make[2]: *** [all-recursive] 错误 1
make[2]:正在离开目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/src'
make[1]: *** [all] 错误 2
make[1]:正在离开目录 `/root/program/DOVIS-2.0.1-installer/openbabel-2.0.2/src'
make: *** [all-recursive] 错误 1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gawk... (cached) mawk
checking for g++... g++
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 g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gcc... gcc
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 dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /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 for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for gethostname... yes
checking for pow... no
checking for sqrt... no
checking for strncasecmp... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
make: 没有什么可以做的为 `all'。
make[1]: 正在进入目录 `/root/program/DOVIS-2.0.1-installer/autodocksuite-4.0.1/src/autodock-4.0.1'
test -z "/usr/local/dovis/bin" || /bin/mkdir -p "/usr/local/dovis/bin"
/usr/bin/install -c 'autodock4' '/usr/local/dovis/bin/autodock4'
make[1]: 没有什么可以做的为 `install-data-am'。
make[1]:正在离开目录 `/root/program/DOVIS-2.0.1-installer/autodocksuite-4.0.1/src/autodock-4.0.1'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
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 g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
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 dependency style of gcc... gcc3
checking for sqrt in -lm... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /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 for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for an ANSI C-conforming const... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for gethostname... yes
checking for pow... yes
checking for round... yes
checking for sqrt... yes
checking for strncasecmp... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
g++ -DPACKAGE_NAME=\"autogrid\" -DPACKAGE_TARNAME=\"autogrid\" -DPACKAGE_VERSION=\"4.0.0\" -DPACKAGE_STRING=\"autogrid\ 4.0.0\" -DPACKAGE_BUGREPORT=\"autodock@scripps.edu\" -DPACKAGE=\"autogrid\" -DVERSION=\"4.0.0\" -DHAVE_LIBM=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_GETHOSTNAME=1 -DHAVE_POW=1 -DHAVE_ROUND=1 -DHAVE_SQRT=1 -DHAVE_STRNCASECMP=1 -I. -I./../autodock-4.0.1 -Wall -O3 -g -O2 -MT autogrid4-check_size.o -MD -MP -MF .deps/autogrid4-check_size.Tpo -c -o autogrid4-check_size.o `test -f 'check_size.cpp' || echo './'`check_size.cpp
check_size.cpp: In function ‘int check_size(int, char)’:
check_size.cpp:64: 错误: ‘exit’在此作用域中尚未声明
make: *** [autogrid4-check_size.o] 错误 1
root@songyf-desktop:~/program/DOVIS-2.0.1-installer# g++ -DPACKAGE_NAME=\"autogrid\" -DPACKAGE_TARNAME=\"autogrid\" -DPACKAGE_VERSION=\"4.0.0\" -DPACKAGE_STRING=\"autogrid\ 4.0.0\" -DPACKAGE_BUGREPORT=\"autodock@scripps.edu\" -DPACKAGE=\"autogrid\" -DVERSION=\"4.0.0\" -DHAVE_LIBM=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_GETHOSTNAME=1 -DHAVE_POW=1 -DHAVE_ROUND=1 -DHAVE_SQRT=1 -DHAVE_STRNCASECMP=1 -I. -I./../autodock-4.0.1 -Wall -O3 -g -O2 -MT autogrid4-check_size.o -MD -MP -MF .deps/autogrid4-check_size.Tpo -c -o autogrid4-check_size.o `test -f 'check_size.cpp' || echo './'`check_size.cpp
g++: ./check_size.cpp:没有该文件或目录
g++: 没有输入文件
root@songyf-desktop:~/program/DOVIS-2.0.1-installer# check_size.cpp: In function ‘int check_size(int, char)’:
bash: 在未预料的“(”附近出现语法错误
root@songyf-desktop:~/program/DOVIS-2.0.1-installer# check_size.cpp:64: 错误: exit’在此作用域中尚未声明
bash: check_size.cpp:64::找不到命令
root@songyf-desktop:~/program/DOVIS-2.0.1-installer# make: *** [autogrid4-check_size.o] 错误 1
bash: make::找不到命令

我可以将我的源程序提供给您,在您的系统试一下.
delectate
帖子: 18311
注册时间: 2008-01-09 22:41

Re: 程序的编译和安装

#4

帖子 delectate » 2009-08-11 18:14

这么多错误……

看的头痛

想来再cygwin也未必能通过吧……

貌似代码本身就有错误?
syfnet
帖子: 213
注册时间: 2009-07-13 16:23

Re: 程序的编译和安装

#5

帖子 syfnet » 2009-08-11 18:20

刚试的对第一个程序,在cygwin没有通过,可能没有安装fortran,第二个程序确实在cgywin成功安装了。
liangliang
帖子: 410
注册时间: 2008-10-01 19:49

Re: 程序的编译和安装

#6

帖子 liangliang » 2009-08-11 19:15

syfnet, 兄弟用fortran?这年头用fortran的人可不多了。包括好多做数值计算的,都改用C++甚至python。
我也用fortran。只是用的是95版的。
还不仅用fortran,还有C++?你在编译一个大程序包?
不是有好些错误提示呢吗?
‘exit’在此作用域中尚未声明
按提示去看看吧。
syfnet
帖子: 213
注册时间: 2009-07-13 16:23

Re: 程序的编译和安装

#7

帖子 syfnet » 2009-08-11 21:15

liangliang 写了:syfnet, 兄弟用fortran?这年头用fortran的人可不多了。包括好多做数值计算的,都改用C++甚至python。
我也用fortran。只是用的是95版的。
还不仅用fortran,还有C++?你在编译一个大程序包?
不是有好些错误提示呢吗?
‘exit’在此作用域中尚未声明
按提示去看看吧。
不是我在用fortran,是我需要的一个必要重要的程序是用fortran写的,而且是fortran77。第二个就是。

有没有高手帮忙看一下问题。
头像
chinesejerry
帖子: 510
注册时间: 2007-10-06 3:48
来自: 霍格沃茨魔法学校葛莱芬多学院
联系:

Re: 程序的编译和安装

#8

帖子 chinesejerry » 2009-08-11 21:26

程序代码有错吧,没报依赖之类的错误。
要不你就到编程区去贴代码吧,我也不是程序高手,只看的是代码写错了。
你的编译器是g77吧
Because...nobody really uses an operating system,
people use...programs...on their computer.
And the only mission in life of an operating system is to helps those programs run.
----Linus
回复