Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-13-2012, 09:32 AM   #1
LQ Newbie
Registered: Oct 2004
Posts: 4

Rep: Reputation: 0
Crosstool usage and shared library linking


I'm an user of an embedded computer running the EmDebian linux OS. My goal is to build my application using the supplied crosstool on the board support site (arm-2008q3). I installed it and managed to get a "hello world" working right away.

My problem actually relies on shared libraries such as BOOST, SDL and TSLIB.
Boost built with no problem since it don't require external dependencies. I
then went on the board itself and used apt-get to download the rest, and copied
the entire /usr/lib and /usr/include folders to a USB key to re-copy to the
crosstool directory.

That's where I'm mixed up.
First, where should I copy my shared libs/include files to be referenced?
There's a lot of already created /lib and /include folders:

I used the second one but that's just a wild guess.

Then, what is the difference between the 2 versions of GCC binaries in the
crosstool paths? I use arm-none-linux-gnueabi-gcc, but is the other any use?:

So when creating the makefile for my application, I reference the complete path
for everything (note that [...] is my base path omitted to make it easier to

For the include files I use
CFLAGS=-c -O2 [...] -I[...]/arm-2008q3/arm-none-linux-gnueabi/include

When I create some static link files (I need to) I use directly
[...]/arm-2008q3/bin/arm-none-linux-gnueabi-ar rcs $(OUTLIB) $(SOURCES)

Up to now every works and I get usable .a and .o files. Problem arise when I
create the executable with all those libs at the end and try to link with SDL
shared library:

LDFLAGS=-L[...]/arm-2008q3/arm-none-linux-gnueabi/lib -pthread -lcrypt -lSDL-1.2
-lSDL_image-1.2 -Wl,-rpath-link [...]/arm-2008q3/arm-none-linux-gnueabi/lib

That's the output I get:
-L[...]/arm-2008q3/arm-none-linux-gnueabi/lib -pthread -lcrypt -lSDL-1.2
-lSDL_image-1.2 -Wl,-rpath-link [...]/arm-2008q3/arm-none-linux-gnueabi/lib
main.o [...].a -o tmg-arm
e-linux-gnueabi/bin/ld: cannot find -lSDL-1.2

Note here that it seems to use simply "ld" instead of
"arm-none-linux-gnueabi-ld", but at least it's the cross-compiler one, not the
base system one. I tried to simply write -lSDL instead of -lSDL-1.2, no help. I
tried to copy the / files to every /lib
paths in the crosstool directory structure, it can never find it.

What am I understanding wrong?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Linking an executable to a shared library (C++) lennyk Programming 4 06-25-2009 05:45 AM
Need help linking shared library g++ 4.1.2 x86_64 UlamTheLucky Programming 5 09-23-2007 05:55 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-05-2007 12:11 AM
Linking a platform independent shared library rozeboom Programming 3 11-18-2003 03:10 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:55 PM.

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