我能够按照instructions成功构建avahi,但是快速开始运行“ ant test-browse”的下一步会导致符号查找错误,并且我对如何继续解决此问题感到困惑。我确实发现以下post出现了类似的问题,但没有取得任何进展(看来该线程从未公开公开解决过)。这是我看到的错误输出:

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上)。

09-04 11:23