LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 05-01-2015, 03:44 AM   #1
engmeshmesh1
LQ Newbie
 
Registered: Oct 2009
Posts: 13

Rep: Reputation: 0
How to cross compile and link any library?


Hello,

I have a question regarding cross compiling the libraries. In my case, I'm trying to cross compile a library for Raspberry Pi2 model B from my host (Lubuntu x64). Therefore, I followed that tutorial successfully: cross compiling for raspberry. Also, I did remote debugging successfully.

However, when I tried to cross compile a simple application that is tried already running on raspberry, it is NOT successful. The application uses the "pigpio" library and "pthread". The given error indicates (as I think) is related to linking the pigpio. The error is: recipe for target 'CC_threading_mod_m3' failed makefile.

By revising a lab of Free-Electrons Free-Electrons lab for cross-compiling libraries that give libraries cross-compilation examples, I believe that I need to cross-compile the pigpio first, then link the generated binary to Eclipse project. However, because I am new to such an environment (cross compilation & raspberry & Eclipse & external library); I don't know HOW-TO DO ?

Further, the Free-Electrons lab mentions compiler flags & options... which brings up another question: HOW can I apply similar options for my cross-compiler which will be called by Eclipse?


Thank you.
 
Old 05-07-2015, 09:19 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Those are pretty extensive instructions. I do wonder if there's a good intermediate point where you can not do all the Eclipse stuff and just compile at the command line and get something successfully working.

The ideas here are:
  1. You install a compiler which is capable of creating binaries which match the target "other" machine
  2. You also have local libraries suitable for the target which you can link with to satisfy your needs for linking, but ultimately these libraries need to be installed on the target in a known location for libraries as the toolkit specifies and/or assists you doing
  3. As I've said earlier, you should be able after proper install to just do a command line compilation which works. If you can't do that, then there's something wrong, either the cross compilation tools are wrong or not properly installed, or the configuration about where to look for libraries on the target is wrong
Can you just do a simple command line compilation and then see what it shows on the target when you try to run it?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cross Compile a library tzippy Linux - Embedded & Single-board computer 0 04-09-2014 10:44 AM
Eglibc cannot compile suffix of object files while trying to cross compile Bry6n Linux From Scratch 0 08-21-2012 06:14 PM
GNU based c++ cross compiler unable to link c library k_taid Programming 1 06-29-2005 09:38 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 04:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration