我能够按照指令成功地构建avahi,但是运行"ant test-browse"的快速入门的下一步导致符号查找错误,我很困惑如何继续对这个问题进行故障排除。我确实发现下面的帖子显示了一个类似的问题,但没有取得任何进展(似乎这个线程从来没有公开解决)。下面是我看到的错误输出:
myUser@ubuntu:~/Downloads/avahi4j-0.1$ ant test-browse
Buildfile: /home/myUser/Downloads/avahi4j-0.1/build.xml
init:
compile:
[javac] /home/myUser/Downloads/avahi4j-0.1/build.xml:109: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
jar:
jnilib:
[exec] make: Entering directory `/home/myUser/Downloads/avahi4j-0.1/src'
[exec] make: Nothing to be done for `all'.
[exec] make: Leaving directory `/home/myUser/Downloads/avahi4j-0.1/src'
test-browse:
[java] Avahi4J v0.1-0
[java] /usr/lib/jvm/java-7-oracle/jre/bin/java: symbol lookup error: /home/myUser/Downloads/avahi4j-0.1/libavahi4j.so: undefined symbol: avahi_malloc
BUILD FAILED
/home/myUser/Downloads/avahi4j-0.1/build.xml:185: Java returned: 127
Total time: 0 seconds
终于找到了解决办法:export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libavahi-common.so:/usr/lib/x86_64-linux-gnu/libavahi-client.so
如果有人能说明为什么需要手工修改,我很乐意建议为什么标准的构建过程对我不起作用(这是在Ubuntu上)。