【问题标题】:Cross compile for ARM using Maven NAR Plugin使用 Maven NAR 插件为 ARM 进行交叉编译
【发布时间】:2015-04-14 08:15:22
【问题描述】:

我正在尝试使用 Debian/Ubuntu 上的 Maven NAR 插件为 x86/amd64 和 ARM 构建 C++ 应用程序。我很难使用 arm-linux-gnueabi-gcc 为 ARM 交叉编译构建设置正确的配置文件。

我的 pom.xml 中的配置文件 sn-p 如下所示:

        <profile>
        <id>arm-linux-cross</id>
        <properties>
            <debug.option>true</debug.option>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.github.maven-nar</groupId>
                    <artifactId>nar-maven-plugin</artifactId>
                    <configuration>
                        <arch>arm</arch>
                        <cpp>
                            <name>arm-linux-gnueabi-g++</name>
                            <options>
                                <option>-march=armv5</option>
                            </options>
                        </cpp>
                        <linker>
                            <name>arm-linux-gnueabi-gcc</name>
                            <sysLibs>
                                <sysLib>
                                    <name>stdc++</name>
                                </sysLib>
                                ...
                            </sysLibs>
                        </linker>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

使用 `mvn compile -P arm-linux-cross' 构建该配置文件不起作用:

[INFO] Using AOL: amd64-Linux-arm-linux-gnueabi-gcc
[INFO] ------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------
[INFO] Total time: 1.464s
[INFO] Finished at: Fri Feb 13 11:00:05 CET 2015
[INFO] Final Memory: 10M/147M
[INFO] -----------------------------------------------------------
[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.0.0:nar-validate (default-nar-validate) on project sirka-model: Cannot find version number for linker 'arm-linux-gnueabi-gcc' -> [Help 1]

显然这里使用的 AOL 不可用,因此 Maven 无法识别编译器/链接器。 但是如何添加所需的 AOL? 还是有另一种方法可以用 Maven 为 ARM 进行交叉编译?

【问题讨论】:

  • 您查看过nar-maven-plugin 的最新版本吗?
  • 关于这个问题没有公认的答案——你最终是如何解决的?
  • @mbroshi 我没有 ;-) 我只是停止尝试......

标签: c++ maven arm cross-compiling maven-nar-plugin


【解决方案1】:

最近有人added basic ARM support to the NAR plugin。但是美国在线只是arm-Linux-gcc——我不知道你上面的gnueabi是从哪里来的。

如果 NAR 插件的 standard ARM settings 不适合您,您可以尝试使用自己的变体。 Here is an example project 定义了自己的自定义 AOL 属性。

【讨论】:

    猜你喜欢
    • 2013-02-20
    • 1970-01-01
    • 2014-05-31
    • 1970-01-01
    • 2023-04-02
    • 2019-05-21
    • 2011-07-24
    • 2014-12-05
    • 2012-08-04
    相关资源
    最近更新 更多