简体   繁体   中英

compiling library for arm architecture

I want to know how i can cross compile a library for ARM architecture. Suppose i have libcurl library for Intel architecture and now i want to run the application in ARM architecture using this library. What are the steps i need to perform for this cross compilation. I am using Ubuntu 32-bit machine. I have gone through the basic steps like

./configure --host= ...
make 
make install 

but could not get the complete idea. Please provide some useful link or if anybody can explain the things. Any help would be greatly appreciated.

I know there is a post in SO for this already "http://stackoverflow.com/questions/5832734/cross-compiling-a-library-from-intel-to-arm" , but i did not get the things clarified by this.

Platform : linux , gcc compiler

You need to give toolchain for your architecture the host parameter, for example for arm-1808 which basically has an arm architecture, the host parameter would be arm-none-linux. I used the following configure command for my architecture, and it compiled successfully, and I am able to run the application on my arm board.

0.

If tool chain is not in your PATH, then you can include it with a command like this:

 export PATH=/home/user/CodeSourcery/Sourcery_G++_Lite/bin/:$PATH

1.

./configure --host=arm-none-linux-gnueabi --build=i686-linux CFLAGS='-Os' --with-ssl=/usr/bin/openssl --enable-smtp

2.

make

3.

sudo make install  

4. Now its time to build your application.

  arm-none-linux-gnueabi-gcc -o email smtp-multi.c -I/usr/local/include -L/usr/local/lib -lcurl

Basically you need to give CPP and CF flags while compiling your application, to find out the CF and CPP flags you can use the following commands respectively:

curl-config --cflags  

curl-config --libs

If above commands do not work then try:

arm-none-linux-gnueabi-gcc -o email smtp-multi.c -lcurl

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