![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
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? |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
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 |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: UK
Posts: 215
Rep Power: 3
![]() |
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.
|
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
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? |
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: UK
Posts: 215
Rep Power: 3
![]() |
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.
![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |