Share your knowledge at the LQ Wiki.
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 07-20-2005, 08:19 AM   #1
LQ Newbie
Registered: Jul 2005
Location: Cambridgeshire, UK
Distribution: SuSE
Posts: 1

Rep: Reputation: 0
Commandline legth problem linking a shared library

I'm trying to get some development scripts, currently running on Solaris, working on Linux (RH9 to be specific), and I can't work out how to build my main shared library. The basic command is

% g++ -shared -o lib${lib}.so ${objList}
/usr/bin/g++: Argument list too long.

but because of the nature of the beast $objList is thousands of objects and the variable ends up being over 200k long [I've heard 40k is the limit on linux.]

I've worked round this quite happily using xargs when building the static archive libraries, but I can't work out how to either

A) Increase the commandline length limit; or
B) incrementally link portions of the .so

I've tried splitting $objList up (E.g. alphabetically into 26 lists) and I can make 26 separate .sos but I when I try to link them into one big so I get one tiny .so indirectly referencing all 26 intermediate ones...

% g++ -shared -o lib${lib}.so lib[a-z]$

...which isn't really what I want.

Does anybody know any easy way to increase this limit, or how to actually get g++/ld to link shared objects incrementally - not sure what the terminology is here - passing the input shared objects by value rather than by reference?

Last edited by DavePrince; 07-25-2005 at 05:18 AM.


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 Programs to the commandline BorgKiller Linux - Software 2 04-05-2005 09:10 PM
any links on linking, loading shared libraries, shared objects. etc? ananthbv Programming 0 02-03-2005 07:47 AM
Still library linking problem The_Nerd Programming 19 05-20-2004 04:08 PM
Library linking problem The_Nerd Programming 10 04-26-2004 11:07 PM
Linking a platform independent shared library rozeboom Programming 3 11-18-2003 02:10 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:06 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration