Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 21st, 2008, 7:32 PM   #1
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
Shared Objects in Linux

This is what I have to do:
gcc -o SPEThreadTest spu_hello_cef.o SPEThreadTest.cpp -lSPEException -lSPEThread -lThread -lpthread -lspe2

This is what I want:
gcc -o SPEThreadTest spu_hello_cef.o SPEThreadTest.cpp -lSPEThread

However, the only reason I have to link pthread, SPEException, spe2, and Thread are because I am linking to SPEThread.

Since I made the SPEThread library (and some of the other libraries), is there a way to make it automatically link in those other libraries, so the command line doesn't start getting terribly long?
Harakim is offline   Reply With Quote
Old Feb 21st, 2008, 9:58 PM   #2
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
Re: Shared Objects in Linux

I am not sure on this but if you are only using functions from SPEThread and they are all shared libraries, you should just be able to link SPEThread in. If they are static libraries there is no way around it.

Also you should consider a build system like SCons or CMake and don't worry about the length of the command line.
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote
Old Feb 22nd, 2008, 8:37 AM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,464
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Re: Shared Objects in Linux

if the length of the compile parameters is a problem... then write an alias for it.... or as Game_Ender suggests, use a make file.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Feb 22nd, 2008, 2:58 PM   #4
Seif
Hobbyist Programmer
 
Seif's Avatar
 
Join Date: Jan 2006
Location: UK
Posts: 213
Rep Power: 3 Seif is on a distinguished road
Re: Shared Objects in Linux

If the shared objects in SPEException, lSPEThread, lThread, lpthread, spe2 libraries should all belong together then use the gnu program ar to merge em all together into one static library.
Seif is offline   Reply With Quote
Old Feb 22nd, 2008, 3:29 PM   #5
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
Re: Shared Objects in Linux

The reason I want to shrink this command is many people will be using this library in the future and I don't want to make it any more confusing than it has to be.

Is there a tool that you know that I could use to merge them into one library or can I use gcc?
Harakim is offline   Reply With Quote
Old Feb 22nd, 2008, 4:12 PM   #6
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,198
Rep Power: 5 grumpy is on a distinguished road
Re: Shared Objects in Linux

It's not usually a good idea to merge third-party libraries into one library: there are often all sorts of copyright constraints making it illegal.

It would be easier to simply supply a sample makefile that executes the required commands to link. Then all the people using your library need to edit that makefile and then type "make". If you really want to make it easier, provide a script that automates creating the makefile

Any developer with any competence will be able to accept the need to add libraries to the command line when linking, or the need to edit a sample build script.
grumpy is offline   Reply With Quote
Old Feb 23rd, 2008, 4:04 AM   #7
Seif
Hobbyist Programmer
 
Seif's Avatar
 
Join Date: Jan 2006
Location: UK
Posts: 213
Rep Power: 3 Seif is on a distinguished road
Re: Shared Objects in Linux

For the record... I wasn't saying it was a good idea. I was just making it known that library editting is possible using the ar, which should be part of the gnu toolchain.
Seif is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware installation guide for Linux beginners coldDeath Coder's Corner Lounge 104 Jul 29th, 2007 4:40 AM
My views on Linux Marvin Coder's Corner Lounge 70 Dec 19th, 2006 11:13 AM
Linux is Annoying (Ubuntu) Baphomet Coder's Corner Lounge 6 Dec 1st, 2006 8:42 AM
Just want to introduce !and Shared our Experience with U all JodoHost Community Introductions 4 Feb 8th, 2006 2:14 PM
windows memset and Linux memset (difference?) Dr.Backtick` C++ 0 Feb 5th, 2005 7:59 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:10 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC