简体   繁体   中英

Cross compile for ARM using Maven NAR Plugin

I am trying to build an C++ application for both x86/amd64 and ARM with the Maven NAR plugin on Debian/Ubuntu. I've troubles to set up a correct profile for the ARM cross-compile build with arm-linux-gnueabi-gcc.

The profile snippet from my pom.xml looks like this:

        <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>

Building that profile with `mvn compile -P arm-linux-cross' does not work:

[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]

Obviously the AOL used here is not available so Maven does not recognize the compiler/linker. But how can I add the required AOL? Or is there another way to cross-compile for ARM with Maven?

Someone recently added basic ARM support to the NAR plugin . But the AOL is just arm-Linux-gcc —I don't know where your gnueabi above is coming from.

If the NAR plugin's standard ARM settings do not work for you, you can try using your own variation. Here is an example project that defines its own custom AOL properties.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM