I am trying to cross compile Apache Portable Run-time library APR-1.5.2 lib for ARM platform. I am following below steps.
./configure --host=aarch64-unknown-linux-gnu CC=aarch64-unknown-linux-gnu-gcc
make
I am not getting any error in configure and make but when i try to link it to my code i am getting linking error.
#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;
}
When i am compiling the code using cross compiler getting error.
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)**
Code compiles fine with 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
Why APR lib didn't built for arm (cross compiler) even though i have used CC=aarch64-unknown-linux-gnu-gcc
Can anyone help me with correct way to build APR for cross compilation?