我需要链接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 2I 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 releaseI 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.amadded
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.cadded 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 && makeruns without a problem...
gerbv/libgerbv root:~/NBP/gerbv/gerbv-test# autoreconf && ./configure && makeThis 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.laSolved with this Makefile.am addition:
libgerbv_la_LIBADD = ../../libs/potrace/potrace/src/libpotrace.la libgerbv_la_DEPENDENCIES = ../../libs/potrace/potrace/src/libpotrace.la更多推荐
发布评论