无法在 linux ubuntu 20.04 中安装 libgraph

Posted

技术标签:

【中文标题】无法在 linux ubuntu 20.04 中安装 libgraph【英文标题】:Unable to install libgraph in linux ubuntu 20.04 【发布时间】:2021-08-10 15:11:59 【问题描述】:

我正在尝试在 ubuntu 20.04 中安装 libgraph,但是每当我在 ./configure 命令之后运行 ma​​ke 命令时,我都会收到此错误:

Makefile:409: warning: ignoring old recipe for target 'libgraph.pc'
make  all-recursive
make[1]: Entering directory '/home/james/Desktop/C++ programs/libgraph-1.0.2'
Makefile:934: warning: overriding recipe for target 'libgraph.pc'
Makefile:409: warning: ignoring old recipe for target 'libgraph.pc'
Making all in doc
make[2]: Entering directory '/home/james/Desktop/C++ programs/libgraph-1.0.2/doc'
Making all in man
make[3]: Entering directory '/home/james/Desktop/C++ programs/libgraph-1.0.2/doc/man'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/james/Desktop/C++ programs/libgraph-1.0.2/doc/man'
make[3]: Entering directory '/home/james/Desktop/C++ programs/libgraph-1.0.2/doc'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/james/Desktop/C++ programs/libgraph-1.0.2/doc'
make[2]: Leaving directory '/home/james/Desktop/C++ programs/libgraph-1.0.2/doc'
make[2]: Entering directory '/home/james/Desktop/C++ programs/libgraph-1.0.2'
Makefile:934: warning: overriding recipe for target 'libgraph.pc'
Makefile:409: warning: ignoring old recipe for target 'libgraph.pc'
/bin/bash ./libtool --mode=link gcc -pthread -pthread -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DFONTDIR=\""/usr/local/share/libgraph/Font/"\" -pthread -pthread -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -lguile-2.0 -lgc -lguile-2.0 -lgc -o libgraph.la -rpath /usr/local/lib -version-info 1:2:0 -export-dynamic libgraph.lo text.lo shapes.lo polygon.lo  -lm -lSDL_image -L/usr/lib/x86_64-linux-gnu -lSDL 
gcc -shared  .libs/libgraph.o .libs/text.o .libs/shapes.o .libs/polygon.o  -pthread -lguile-2.0 -lgc -lm -lSDL_image -L/usr/lib/x86_64-linux-gnu -lSDL  -Wl,-soname -Wl,libgraph.so.1 -o .libs/libgraph.so.1.0.2
/usr/bin/ld: .libs/text.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/grtext.h:77: multiple definition of `InternalFont'; .libs/libgraph.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/grtext.h:77: first defined here
/usr/bin/ld: .libs/text.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/grtext.h:87: multiple definition of `TP'; .libs/libgraph.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/grtext.h:87: first defined here
/usr/bin/ld: .libs/shapes.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/shapes.h:121: multiple definition of `_internal_linestyle'; .libs/libgraph.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/shapes.h:121: first defined here
/usr/bin/ld: .libs/shapes.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/shapes.h:115: multiple definition of `_last_arc'; .libs/libgraph.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/shapes.h:115: first defined here
/usr/bin/ld: .libs/polygon.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/polygon.h:42: multiple definition of `_scanlist'; .libs/libgraph.o:/home/james/Desktop/C++ programs/libgraph-1.0.2/polygon.h:42: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:377: libgraph.la] Error 1
make[2]: Leaving directory '/home/james/Desktop/C++ programs/libgraph-1.0.2'
make[1]: *** [Makefile:552: all-recursive] Error 1
make[1]: Leaving directory '/home/james/Desktop/C++ programs/libgraph-1.0.2'
make: *** [Makefile:268: all] Error 2

我最初按照this 链接中给出的说明安装库。 ./configure 命令后的结果是这样的:

checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/bin/bash: /home/james/Desktop/C++: No such file or directory
configure: WARNING: `missing' script is too old or missing
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 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 how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for a sed that does not truncate output... /usr/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 how to recognise dependent libraries... pass_all
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 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 g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
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 -m elf_x86_64) 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 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 -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) 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 -m elf_x86_64) 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
appending configuration tag "F77" to libtool
checking for gawk... (cached) mawk
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.0... yes
checking SDL  ==>  SDL_image library... SDL_image = yes
checking for Guile... yes
checking for rint in -lm... yes
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pid_t... yes
checking for unistd.h... (cached) yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking return type of signal handlers... void
checking for vprintf... yes
checking for _doprnt... no
checking for atexit... yes
checking for putenv... yes
checking for rint... yes
checking for strdup... yes
configure: creating ./config.status
config.status: creating doc/Makefile
config.status: creating doc/man/Makefile
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

我尝试了一些网站上提供的一些解决方案,但似乎没有任何效果。你能告诉我如何摆脱这些错误并安装 libgraph。

【问题讨论】:

2005 年的 libgraph-1.0.2 可以用 gcc-3.4.6 .. .. gcc-5.4 像这个例子一样编译:cd libgraph-1.0.2/ && export CC=gcc-5 && ./configure 【参考方案1】:

似乎解决方案可在:https://www.reddit.com/r/archlinux/comments/hyo94z/error_while_installing_libgraph/

从 AUR 克隆它并编辑 PKGBUILD:

build() 
    cd "$pkgname-$pkgver"
    export CFLAGS="$CFLAGS -fcommon"
    ./configure --prefix=/usr
    make

您可以检查以上是否适合您。

【讨论】:

嘿,伙计,在实施您提到的解决方案时,我需要您的帮助。我实际上不知道什么是 AUR,什么是 PKGBUILD 等等。所以我不知道该怎么做。如果您能提及一种方法,一种关于如何做到这一点的教程,那将非常有帮助。 你可以看看wiki.archlinux.org/title/Arch_User_Repository【参考方案2】:

见上面的评论,我解决了这个问题。 我的发布版本是 Ubuntu 21.04,只有 guile2.2 和 3.0

$ sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-2.2 guile-2.2-dev 
$ wget http://download.savannah.gnu.org/releases/libgraph/libgraph-1.0.2.tar.gz
$ tar -xzvf libgraph-1.0.2.tar.gz
$ cd libgraph-1.0.2
$ CPPFLAGS="$CPPFLAGS $(pkg-config --cflags-only-I guile-2.2) -fcommon" \
CFLAGS="$CFLAGS $(pkg-config --cflags-only-other guile-2.2) -fcommon" \
LDFLAGS="$LDFLAGS $(pkg-config --libs guile-2.2)" \
./configure
$ make && sudo make install
$ sudo cp /usr/local/lib/libgraph.* /usr/lib 

【讨论】:

正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center。

以上是关于无法在 linux ubuntu 20.04 中安装 libgraph的主要内容,如果未能解决你的问题,请参考以下文章

如何在 ubuntu 20.04 中安装编译器 g++-4.8.5

在 python 3.8 Ubuntu 20.04 LTS 中安装 RDKit 的问题

在Ubuntu20.04中安装中文输入法

在Ubuntu20.04中安装中文输入法

在Ubuntu20.04中安装中文输入法

Ubuntu20.04 创建新的用户