首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在comand行成功构建之后,我得到Eclipse错误JVM终止。退出code=1

在comand行成功构建之后,我得到Eclipse错误JVM终止。退出code=1
EN

Stack Overflow用户
提问于 2021-05-06 21:55:06
回答 1查看 107关注 0票数 0

我正在为C/C++开发人员(包括孵化组件)使用eclipse IDE版本: 2021-03 (4.19.0) Build id: 20210312-0638

我在lubuntu 20.10 64位上使用它。

为了解决这个问题,我还安装了java11 : openjdk 11.0.11 2021-04-20 OpenJDK运行时环境(内部版本11.0.11+9-Ubuntu-0ubuntu2.20.10) OpenJDK 64位服务器虚拟机(内部版本11.0.11+9-Ubuntu-0ubuntu2.20.10,混合模式,共享)

eclipse GUI运行良好,我可以编译我的代码了。我对通过命令行编译eclipse项目很感兴趣(这样我就可以将其作为CI管道的一部分运行)。

当我通过命令行编译它时,我的构建是成功的,并且我得到了一个二进制文件。问题是我得到了"JVM终止。退出code=1“,这使得我的流水线失败。

这是我用来编译的命令

代码语言:javascript
复制
./eclipse -nosplash --launcher.suppressErrors  -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import /<path_to_project>/ -data /<eclipse_work_space> -build <project_name>/Debug

这是编译完成后我得到的完整错误消息:

代码语言:javascript
复制
Eclipse:
JVM terminated. Exit code=1
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-jar /home/drone/eclipse/cpp-2021-03/eclipse//plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar
-os linux
-ws gtk
-arch x86_64
-launcher /home/drone/eclipse/cpp-2021-03/eclipse/eclipse
-name Eclipse
--launcher.library /home/drone/.p2/pool/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.100.v20210209-1541/eclipse_11301.so
-startup /home/drone/eclipse/cpp-2021-03/eclipse//plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar
--launcher.appendVmargs
-exitdata 20
-product org.eclipse.epp.package.cpp.product
-application org.eclipse.cdt.managedbuilder.core.headlessbuild
-import /home/drone/azure_agent/_work/1/s/projects/RT-Linux/
-data /var/tmp/ee
-build linux_sim/Debug
-vm /usr/lib/jvm/java-11-openjdk-amd64/bin/java
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-jar /home/drone/eclipse/cpp-2021-03/eclipse//plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar 

这是eclipse.ini文件:

代码语言:javascript
复制
-startup
plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar
--launcher.library
/home/drone/.p2/pool/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.100.v20210209-1541
-product
org.eclipse.epp.package.cpp.product
-showsplash
/home/drone/.p2/pool/plugins/org.eclipse.epp.package.common_4.19.0.20210311-1200
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/

我在发帖前进行了搜索,但在通过命令行编译时没有发现这个问题。

编辑:如果在构建过程中不抑制编译错误,我将完全有办法抑制这个错误(这样我的管道就不会因为它而失败)。

EN

回答 1

Stack Overflow用户

发布于 2021-05-11 02:31:21

我已经解决了我的问题,所以我将为后人解释我的具体问题,但最主要的是我努力提供一个更一般的解释,可能是什么原因“JVM终止。通过命令行界面以无心模式使用eclipse时,“Exit code=1”。这是可能的原因之一(大多数处理此错误的线程将其归因于在eclipse.ini文件中设置的内存值不足)。

所有邪恶的根源是eclipse传达错误的方式。在最好的情况下,eclipse将中止构建,并明确说明发生了什么(感谢eclipse论坛的David Vavra提供的示例):

代码语言:javascript
复制
Project: file:<whatever> can't be found!
 Warning: Nashorn engine is planned to be removed from a future JDK release
 Saving workspace.
 Eclipse:
 JVM terminated. Exit code=1
代码语言:javascript
复制
Workspace already in use!
 Eclipse:
 JVM terminated. Exit code=1

在最坏的情况下,eclipse不仅没有说明哪里出了问题,它还会说明一切都很好。在我的例子中,eclipse被发送到stdout:

代码语言:javascript
复制
Finished building target: linux_sim
 
15:20:20 Build Finished. 0 errors, 11 warnings. (took 9m:18s.202ms)

Eclipse:
JVM terminated. Exit code=1

因此,在我的特定案例中,作为eclipse项目的一部分,我有一个调试构建和一个发布构建。我使用工具链进行交叉编译,我的所有构建都是使用Debug设置编译的,而Release则没有维护。很长一段时间以来,我一直从工具链X移动到Y,但没有更新发布设置的“路径”和“前缀”,也没有从我的机器中删除不推荐使用的工具链。当我使用GUI时,它工作得很好。

一旦我在一种随意的模式下使用了eclipse,我就明确表示我只想通过声明Debug -build / Debug 来编译调试设置,而eclipse确实只编译了调试设置。

从命令行执行以下操作:

代码语言:javascript
复制
15:11:02 **** Build of configuration Debug for project linux_sim ****

没有提到:

代码语言:javascript
复制
**** Build of configuration Release for project linux_sim **** 

在我的构建过程中,项目linux_sim anywhere。

尽管我明确表示我只想编译Debug配置,尽管eclipse遵从了我的请求,但它确实尝试加载发布的设置,并且当一直滚动到构建过程的开始时,我注意到了这两行:

代码语言:javascript
复制
Unable to find full path for "arm-poky-linux-gnueabi-gcc"
Unable to find full path for "arm-poky-linux-gnueabi-g++"

一旦我从废弃工具的“前缀”和“路径”中清除了发布配置,“JVM终止。Exit code=1“*问题消失。

这个问题的真正好处(除了eclipse加载设置它不应该加载)是,尽管“找不到完整的路径为”arm-poky-linux-gnueabi-gcc“合格的理由发送一个”的JVM终止。Exit code=1“JVM消息eclipse没有中止构建过程,并允许它以”成功“消息结束,然后才发送” terminated“。“Exit code=1”消息发送到标准输出,但没有提供任何原因。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67419601

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档