LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

Rep: Reputation: 0
Crosstool usage and shared library linking


Hello,

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:
arm-2008q3/
arm-2008q3/arm-none-linux-gnueabi/
arm-2008q3/arm-none-linux-gnueabi/libc/
arm-2008q3/arm-none-linux-gnueabi/libc/usr/
arm-2008q3/arm-none-linux-gnueabi/libc/armv4t
arm-2008q3/arm-none-linux-gnueabi/libc/armv4t/usr
arm-2008q3/arm-none-linux-gnueabi/libc/thumb2
arm-2008q3/arm-none-linux-gnueabi/libc/thumb2/usr

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?:
arm-2008q3/bin/arm-none-linux-gnueabi-gcc
arm-2008q3/arm-none-linux-gnueabi/bin/gcc





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
read):
CC=[...]/arm-2008q3/bin/arm-none-linux-gnueabi-g++

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:
[...]/arm-2008q3/bin/arm-none-linux-gnueabi-g++
-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
[...]/arm-2008q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-non\
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 libSDL-1.2.so.0 / libSDL-1.2.so.0.11.3 files to every /lib
paths in the crosstool directory structure, it can never find it.

What am I understanding wrong?
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:54 PM.

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