将静态lib(potracelib)与另一个lib链接起来,在Makefile.am中写什么?(Linking static lib (potracelib) with another lib, wh

编程入门 行业动态 更新时间:2024-10-28 16:18:13
静态lib(potracelib)与另一个lib链接起来,在Makefile.am中写什么?(Linking static lib (potracelib) with another lib, what to write in Makefile.am?)

我需要链接libpotrace并将其编译成libgerbv。 我应该在Makefile.am中写什么? 我尝试了各种各样的东西,比如LDADD,LIBDIR,LDFLAGS等,但我没有成功。

我的结构如何:

gerbv / gerbv-test - >来自git,master brach的文件 gerbv / libs / potrace / potrace-test - > potrace - >来自sourceforge.com的文件,最新版本

我使用Debian Jessie,我可以单独编译这两个程序,我都没想到,我怎样才能将potrace链接到gerbv并编译它。 头文件(.h)已正确包含,但我没有成功链接.so或.a / la lib。 即使在/ usr / local / lib或/ usr / lib中安装了potrace也没有成功。

任何人都能指导我吗? 如果您可以下载这两个程序,编译它没有错误然后将您输入的内容写入gerbv / src / makefile.Am,那将是最好的。 更新 我下载了干净的版本,只做这个修改:

/root/NBP/gerbv/gerbv-test/src/Makefile.am

添加

libgerbv_la_LIBADD = libpotrace.la # src/Makefile.am:84: error: use 'libgerbv_la_LIBADD', not 'libgerbv_la_LDADD' libgerbv_la_LIBDIR = /root/NBP/gerbv/libs/potrace/potrace-old/src/.libs #libgerbv_la_DEPENDENCIES = libpotrace.la

/root/NBP/gerbv/gerbv-test/src/exportimage.c

添加在顶部

#include "../../libs/potrace/potrace-test/src/potracelib.h"

添加到void exportimage_render_to_surface_and_destroy(...)中,如果共享库已正确链接,这将测试。 exportimage.c是libgerbv的一部分,我需要包含libpotrace。

char *v = potrace_version();

做完这个修改后,我通过以下方式构建它

libpotrace root:~/NBP/gerbv/libs/potrace/potrace-test# autoreconf && ./configure --with-libpotrace && make

运行没有问题......

gerbv检察/ libgerbv root:~/NBP/gerbv/gerbv-test# autoreconf && ./configure && make

结果如下:

... make[3]: Entering directory '/root/NBP/gerbv/gerbv-test/src' make[3]: *** No rule to make target 'libpotrace.la', needed by 'libgerbv.la'. Stop. make[3]: Leaving directory '/root/NBP/gerbv/gerbv-test/src' Makefile:498: recipe for target 'all' failed make[2]: *** [all] Error 2 make[2]: Leaving directory '/root/NBP/gerbv/gerbv-test/src' Makefile:472: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/root/NBP/gerbv/gerbv-test' Makefile:401: recipe for target 'all' failed make: *** [all] Error 2

I need to link libpotrace and compile it into libgerbv. What should I write in Makefile.am? I tried various things like LDADD, LIBDIR, LDFLAGS etc., but I was not successful.

How my structure look like:

gerbv/gerbv-test -> files from git, master brach gerbv/libs/potrace/potrace-test -> potrace -> files from sourceforge.com, latest release

I use Debian Jessie, I can compile both programs separately, both I did not figured out, how can I link potrace to gerbv and compile it. The header file (.h) is included properly, but I haven't had any success with linking .so or .a/la lib. Even no success with installed potrace in /usr/local/lib or /usr/lib.

Can anyone direct me? The best will be if you can download both programs, compile it without error and then write what you put into the gerbv/src/makefile.Am. UPDATED I dowloaded clean releases and did this ONLY this modifies:

/root/NBP/gerbv/gerbv-test/src/Makefile.am

added

libgerbv_la_LIBADD = libpotrace.la # src/Makefile.am:84: error: use 'libgerbv_la_LIBADD', not 'libgerbv_la_LDADD' libgerbv_la_LIBDIR = /root/NBP/gerbv/libs/potrace/potrace-old/src/.libs #libgerbv_la_DEPENDENCIES = libpotrace.la

/root/NBP/gerbv/gerbv-test/src/exportimage.c

added at the top

#include "../../libs/potrace/potrace-test/src/potracelib.h"

added into void exportimage_render_to_surface_and_destroy(...), this will test, if the shared lib is properly linked. exportimage.c is part of libgerbv where I need to include libpotrace.

char *v = potrace_version();

After doing this modifications I build it via:

libpotrace root:~/NBP/gerbv/libs/potrace/potrace-test# autoreconf && ./configure --with-libpotrace && make

runs without a problem...

gerbv/libgerbv root:~/NBP/gerbv/gerbv-test# autoreconf && ./configure && make

This results with:

... make[3]: Entering directory '/root/NBP/gerbv/gerbv-test/src' make[3]: *** No rule to make target 'libpotrace.la', needed by 'libgerbv.la'. Stop. make[3]: Leaving directory '/root/NBP/gerbv/gerbv-test/src' Makefile:498: recipe for target 'all' failed make[2]: *** [all] Error 2 make[2]: Leaving directory '/root/NBP/gerbv/gerbv-test/src' Makefile:472: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/root/NBP/gerbv/gerbv-test' Makefile:401: recipe for target 'all' failed make: *** [all] Error 2

最满意答案

解决了这个Makefile.am的补充:

libgerbv_la_LIBADD = ../../libs/potrace/potrace/src/libpotrace.la libgerbv_la_DEPENDENCIES = ../../libs/potrace/potrace/src/libpotrace.la

Solved with this Makefile.am addition:

libgerbv_la_LIBADD = ../../libs/potrace/potrace/src/libpotrace.la libgerbv_la_DEPENDENCIES = ../../libs/potrace/potrace/src/libpotrace.la

更多推荐

本文发布于:2023-08-03 21:52:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1401083.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:静态   链接   potracelib   lib   write

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!