发布针对ARM的交叉编译apr-1.5.2

时间:2017-06-22 00:23:55

标签: c linux cross-compiling autotools apr

我正在尝试为ARM平台交叉编译Apache Portable Run-time library APR-1.5.2 lib。我正在遵循以下步骤。

./configure --host=aarch64-unknown-linux-gnu CC=aarch64-unknown-linux-gnu-gcc
make 

我在配置和make中没有收到任何错误但是当我尝试将它链接到我的代码时,我收到链接错误。

#include <iostream>
#include <stdio.h>
using namespace std;

#include "apr_general.h"
#include "apr_network_io.h"
#include "apr_strings.h"

int main(){
    apr_initialize();
    std::cout<<"Welcome Program compiling  "<<std::endl;
    return 0;
}

当我使用交叉编译器获取错误编译代码时。

aarch64-unknown-linux-gnu-g++ -o Test -I ../../../../Static_APR/apr-1.5.2/include DAS.cpp ../../../../Static_APR/apr-1.5.2/.libs/libapr-1.a -lpthread

**apr-1.5.2/.libs/libapr-1.a(start.o): Relocations in generic ELF (EM: 62)**

使用g ++编译代码很好。

g++ -o Test -I ../../../../Static_APR/apr-1.5.2/include DAS.cpp ../../../../Static_APR/apr-1.5.2/.libs/libapr-1.a -lpthread

为什么APR lib没有为arm(交叉编译器)构建,即使我使用过CC = aarch64-unknown-linux-gnu-gcc

任何人都可以帮助我以正确的方式构建APR以进行交叉编译吗?

1 个答案:

答案 0 :(得分:1)

  

我正在遵循以下步骤。

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(getActivity(), getTheme()) {
        @Override
        public void onBackPressed() {
            //your code
        }
    };

    return dialog;
}

您的 score = 0 loops = 0 again = 1 while (again != 0): import random real = random.randint(1,9) fake1 = random.randint(1,9) fake2 = random.randint(1,9) comb = random.randint(1,9) rep = 0 guess = 0 if (comb == 1 or comb == 2 or comb == 3): print(real, fake1, fake2) loops += 1 guess = int(input("Choose between these numbers")) if (guess == real): score += 1 print ("Congrats!") else: print ("Wrong, better luck next time!") if (comb == 4 or comb == 5 or comb == 6): print (fake1, fake2, real) loops += 1 guess = int(input("Choose between these numbers")) if (guess == real): score += 1 print ("Congrats!") else: print ("Wrong, better luck next time!") if (comb == 7 or comb == 8 or comb == 9): print (fake2, real, fake1) loops += 1 guess = int(input("Choose between these numbers")) if (guess == real): score += 1 print ("Congrats!") else: print ("Wrong, better luck next time!") again == int(input("Do you wanna go again?")) print(again) 应该包含./configure --host=aarch64-unknown-linux-gnu CC=aarch64-unknown-linux-gnu-gcc make ./configure是您正在编译的计算机。另请参阅Autoconf邮件列表中的How To Configure for Android?。也许是这样的:

--build

上面的代码段应该确保所有工具都可用。您可能需要添加--hostexport CPP=aarch64-unknown-linux-gnu-cpp export CC=aarch64-unknown-linux-gnu-gcc export CXX=aarch64-unknown-linux-gnu-g++ export LD=aarch64-unknown-linux-gnu-ld export AR=aarch64-unknown-linux-gnu-ar export AS=aarch64-unknown-linux-gnu-as export RANLIB=aarch64-unknown-linux-gnu-ranlib export CFLAGS="..." export CXXFLAGS="..." ./configure --build=`config.guess` --host=aarch64-unknown-linux-gnu 以及相应的标头位置;以及具有相应库位置的CFLAGS

您应该验证CXXFLAGS的程序。它可能不是你的想法。例如,在一个版本的Ubuntu for ARM上,它是:

LDFLAGS

您可能需要找到RANLIB

export RANLIB=aarch64-unknown-linux-gcc-ranlib-4.7

最后,您可能会发现这些脚本很有用。他们通过设置路径和设置工具来帮助构建另一个库:setenv-android.shsetenv-embedded.sh