This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Status? (back, after tornadoes, etc hit Alabama).


Andy, All,

On Tuesday 24 May 2011 21:54:02 ANDY KENNEDY wrote:
> > Stupid question:  Is it possible to statically link an application
> > to
> > NPTL with RT support?

I'd say yes.

> > Oddly enough, on a test application that I 
> > have,
> > I get unresolved errors to numerous **pthread_*_* functions when I
> > attempt
> > to link using -static.

With static libs, you don't have automatic dependency resolution. You
need to specify the libs in the correct order, so that dependent libs
are listed _after_ the libs that depends on them.

What's going to be complicated is in case you have cyclic dependencies,
where a function in lib1.a requires a symbol from lib2.a, which is a 
function which requires a symbol from lib1.a.

For this, you have to tell the linker to loop iteration in the libs until
there are no more unresolved symbols:

# man ld
[--SNIP--]
   -( archives -)
   --start-group archives --end-group
       The archives should be a list of archive files. They may be either
       explicit file names, or -l options.

       The specified archives are searched repeatedly until no new
       undefined references are created.  Normally, an archive is searched
       only once in the order that it is specified on the command line.
       If a symbol in that archive is needed to resolve an undefined
       symbol referred to by an object in an archive that appears later on
       the command line, the linker would not be able to resolve that
       reference.  By grouping the archives, they all be searched
       repeatedly until all possible references are resolved.
[--SNIP--]

Maybe this is the case...

[--SNIP--]
> Okay, found this to NOT be true for simple apps. Don't have a clue
> why it would do it for more complex stuff.  Grrr.

Sorry, I don't have a clue, except the order inwhich you specify -lpthread
and -lrt.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]