我正在尝试在OS X上编译TuxGuitar(吉他指法编辑器)。我已经从TuxGuitar存储库中签出了代码:
svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code
现在,当我运行make
进而使用 ant
时,似乎javac
在项目源代码树中找不到 Java 包。我已经把make
的完整输出放在 http://people.kth.se/~albertwi/tuxg-make-error;它很大,所以我不能把它们都放在一个代码块中。
我假设这是一个半平凡的类路径问题,但我无法判断如何修改构建配置。在第 307 行及以后的 make
输出中,有"some_file.java添加为不存在some_file.class"形式的错误/警告,我不知道这意味着什么:
[javac] org/herac/tuxguitar/app/TGMain.java added as org/herac/tuxguitar/app/TGMain.class doesn't exist.
[javac] org/herac/tuxguitar/app/TuxGuitar.java added as org/herac/tuxguitar/app/TuxGuitar.class doesn't exist.
[javac] org/herac/tuxguitar/app/action/TGActionAccessInterceptor.java added as org/herac/tuxguitar/app/action/TGActionAccessInterceptor.class doesn't exist.
...
在第 715 行及以后,包含了一些类路径,但似乎并非所有必要的文件夹都附加到此处(TuxGuitar 源代码树包含 TuxGuitar-some 程序组件/src/org/herac/tuxguitar 形式的文件夹,例如 TuxGuitar-ascii/src/org 和 TuxGuitar-fluidsynth/src/org,我认为应该包含在这里,但它们没有):
[javac] Compilation arguments:
[javac] '-d'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build'
[javac] '-classpath'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build:/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar:/opt/local/share/java/apache-ant/lib/ant-launcher.jar:/opt/local/share/java/apache-ant/lib/ant-antlr.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bcel.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bsf.jar:/opt/local/share/java/apache-ant/lib/ant-apache-log4j.jar:/opt/local/share/java/apache-ant/lib/ant-apache-oro.jar:/opt/local/share/java/apache-ant/lib/ant-apache-regexp.jar:/opt/local/share/java/apache-ant/lib/ant-apache-resolver.jar:/opt/local/share/java/apache-ant/lib/ant-apache-xalan2.jar:/opt/local/share/java/apache-ant/lib/ant-commons-logging.jar:/opt/local/share/java/apache-ant/lib/ant-commons-net.jar:/opt/local/share/java/apache-ant/lib/ant-jai.jar:/opt/local/share/java/apache-ant/lib/ant-javamail.jar:/opt/local/share/java/apache-ant/lib/ant-jdepend.jar:/opt/local/share/java/apache-ant/lib/ant-jmf.jar:/opt/local/share/java/apache-ant/lib/ant-jsch.jar:/opt/local/share/java/apache-ant/lib/ant-junit.jar:/opt/local/share/java/apache-ant/lib/ant-junit4.jar:/opt/local/share/java/apache-ant/lib/ant-netrexx.jar:/opt/local/share/java/apache-ant/lib/ant-swing.jar:/opt/local/share/java/apache-ant/lib/ant-testutil.jar:/opt/local/share/java/apache-ant/lib/ant.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/tools.jar'
[javac] '-sourcepath'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src'
...
然后在第 1143 行及以后,我得到"package org.herac.tuxguitar。某些包不存在"错误:
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:27: error: package org.herac.tuxguitar.action does not exist
[javac] import org.herac.tuxguitar.action.TGActionManager;
[javac] ^
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:68: error: package org.herac.tuxguitar.document does not exist
[javac] import org.herac.tuxguitar.document.TGDocumentManager;
[javac] ^
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:69: error: package org.herac.tuxguitar.event does not exist
[javac] import org.herac.tuxguitar.event.TGEvent;
[javac] ^
...
我不精通make
和ant
.如何以及在何处进行配置更改,以便javac
可以找到软件包?
这个问题是否如此复杂,以至于我应该向TuxGuitar开发人员询问这个问题?
更新:我尝试按照 https://sourceforge.net/p/tuxguitar/discussion/522984/thread/3843b30b/#1ce9 的建议使用另一种编译方式,所以我转到文件夹build-scripts/tuxguitar-macosx-cocoa-64并运行mvn clean package -Dnative-modules=true
但随后我收到与SWT相关的错误...这基本上(http://people.kth.se/~albertwi/tuxg-mvn-error 时的完整输出):
[INFO] Scanning for projects...
[ERROR] The build could not read 18 projects -> [Help 1]
[ERROR]
[ERROR] The project org.herac.tuxguitar:tuxguitar:1.3-SNAPSHOT (/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for org.eclipse.swt:org.eclipse.swt:jar is missing. @ org.herac.tuxguitar:tuxguitar:[unknown-version], /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/pom.xml, line 26, column 15
[ERROR]
[ERROR] The project org.herac.tuxguitar:tuxguitar-browser-ftp:1.3-SNAPSHOT (/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar-browser-ftp/pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for org.eclipse.swt:org.eclipse.swt:jar is missing. @ org.herac.tuxguitar:tuxguitar-browser-ftp:[unknown-version], /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar-browser-ftp/pom.xml, line 35, column 15
[ERROR]
...
我在/Library/Java/Extensions 中有最新版本的 swt.jar,所以它应该在类路径上。
我遇到了同样的麻烦,看起来 Makefile 坏了,因为它使用 ant 而不是 maven。以下是我所做的步骤(感谢我的同事 Clément,当我使用打孔卡时,它天生就有 java):
$svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code
$sudo apt-get install maven
$cd tuxguitar-code
$uname -a
Linux acacia 3.16-3-amd64 #1 SMP Debian 3.16.5-1 (2014-10-10) x86_64 GNU/Linux
$cd build-scripts/tuxguitar-linux-x86_64
$rehash
$mvn clean package
$cd target
$cd tuxguitar-1.3-SNAPSHOT-linux-x86_64
$./tuxguitar.sh
这确实在 3 台不同的计算机上对我有用,尽管都是基于 debian 的。希望这有帮助