首页 > 解决方案 > 如何运行本教程 gluonfx:build 命令的结果?

问题描述

已成功遵循用于在 Linux 上构建 JavaFX 可运行的 Gluon教程。

最后一行如下:

结果,hellofx.hellofx.o 被创建并且可以在 target/gluonfx/x86_64-linux/gvm/tmp/SVM-*/hellofx.hellofx.o 下找到。

一切都很好。我的目的是了解文档的另一部分(构建一个 Android 应用程序),但我认为检查该文件是否可以运行是值得的。但是,我是一个几乎没有 c 经验的 Java 程序员,并且需要一个编译步骤。是否有可能获得有关编译所需命令的帮助?

文件夹包含以下文件。

../x86_64-linux/gvm/tmp/SVM-1631648892069$ ls -al
total 62704
drwxrwxr-x 2 phil phil     4096 Sep 14 12:52 .
drwxrwxr-x 4 phil phil     4096 Sep 14 12:48 ..
-rwxrwxr-x 1 phil phil    20968 Sep 14 12:48 AArch64LibCHelperDirectives
-rw-rw-r-- 1 phil phil    10003 Sep 14 12:48 AArch64LibCHelperDirectives.c
-rwxrwxr-x 1 phil phil    33248 Sep 14 12:48 AMD64LibCHelperDirectives
-rw-rw-r-- 1 phil phil    28019 Sep 14 12:48 AMD64LibCHelperDirectives.c
-rwxrwxr-x 1 phil phil    20944 Sep 14 12:48 BuiltinDirectives
-rw-rw-r-- 1 phil phil    10859 Sep 14 12:48 BuiltinDirectives.c
-rw-rw-r-- 1 phil phil 63682702 Sep 14 12:52 hellofx.hellofx.o
-rwxrwxr-x 1 phil phil   102872 Sep 14 12:48 JNIHeaderDirectives
-rw-rw-r-- 1 phil phil   129695 Sep 14 12:48 JNIHeaderDirectives.c
-rwxrwxr-x 1 phil phil    61904 Sep 14 12:48 PosixDirectives
-rw-rw-r-- 1 phil phil    66720 Sep 14 12:48 PosixDirectives.c

这个StackOverflow 帖子有一个回复,将编译作为一般形式

gcc my_test.c -o my_test

hellofx.hellofx.o有一个.o而不是.c扩展名。当在gcc hellofx.hellofx.o -o hellofxcli 上运行时会产生大量错误,从以下开始:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: hellofx.hellofx.o:(.data+0x0): undefined reference to `Java_com_sun_javafx_font_freetype_OSPango_pango_1font_1description_1get_1family'
/usr/bin/ld: hellofx.hellofx.o:(.data+0x8): undefined reference to `Java_com_sun_glass_ui_gtk_GtkSystemClipboard_popFromSystem'

geeksforgeeks 给出的教程同样只有带有 .c 扩展名的源代码文件的示例。

我通常不会问这个问题,因为它似乎接近于要求其他人为我编写代码,但也许这是可以原谅的,因为在为 Gluon 标记这个时,支持成员可能愿意用所需的步骤来补充教程?

标签: clinuxjavafxgluon-mobile

解决方案


推荐阅读