首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >libtool: install: error: relink `libmyprog.la‘在安装之前使用上面的命令

libtool: install: error: relink `libmyprog.la‘在安装之前使用上面的命令
EN

Stack Overflow用户
提问于 2012-08-03 09:01:03
回答 1查看 9.4K关注 0票数 1

我在我正在创作的项目中运行make distcheck时遇到标题链接错误:

代码语言:javascript
运行
复制
$ uname -a
Linux vbox 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/issue
Ubuntu 12.04 LTS \n \l

$ libtool --version
libtool (GNU libtool) 2.4.2
Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996

Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ --version
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ automake --version
automake (GNU automake) 1.11.3
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.

正如你所看到的,它在Ubuntu12.04上使用了g++ 4.6和libtool 2.4.2。在使用g++ 4.2.1和libtool 2.4.2 (都是通过自制软件安装)的OS X 10.7.4上,该错误不会出现。它也不会出现在make check中。

下面是Makefile.am的相关代码片段

代码语言:javascript
运行
复制
# -- myprog --
#

lib_LTLIBRARIES += myproj/myprog/libmyprog.la
myproj_myprog_libmyprog_la_SOURCES = # ...
myproj_myprog_libmyprog_la_LIBADD = myproj/mylib/libmylib.la

sbin_PROGRAMS += myproj/myprog/myprog
myproj_myprog_myprog_SOURCES = myproj/myprog/main.cc
myproj_myprog_myprog_LDADD = myproj/myprog/libmyprog.la

# -- mylib --
#

lib_LTLIBRARIES += myprog/mylib/libmylib.la
myproj_mylib_libmylib_la_SOURCES = # ...

和错误本身:

代码语言:javascript
运行
复制
/usr/bin/ld: cannot find -lmylib
collect2: ld returned 1 exit status
libtool: install: error: relink `myproj/myprog/libmyprog.la' with the above command before installing it

我该如何解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-03 09:01:03

简而言之,秩序(显然)很重要:

代码语言:javascript
运行
复制
# -- mylib --
#

lib_LTLIBRARIES += myprog/mylib/libmylib.la
myproj_mylib_libmylib_la_SOURCES = # ...

# -- myprog --
#

lib_LTLIBRARIES += myproj/myprog/libmyprog.la
myproj_myprog_libmyprog_la_SOURCES = # ...
myproj_myprog_libmyprog_la_LIBADD = myproj/mylib/libmylib.la

sbin_PROGRAMS += myproj/myprog/myprog
myproj_myprog_myprog_SOURCES = myproj/myprog/main.cc
myproj_myprog_myprog_LDADD = myproj/myprog/libmyprog.la

现在我的项目构建在所有提到的平台上(checkdistcheck)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11787917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档