[uClinux-dev] uClinux-dist-test-20050614 released for testing

David McCullough davidm at snapgear.com
Wed Aug 3 17:37:27 EDT 2005

Jivin John Williams lays it down ...
> Hi David,
> David McCullough wrote:
> >Jivin John Williams lays it down ...
> >
> >>Working through the issues - first one off the rank is that if uClibc is 
> >>configured with thread support
> >>
> >>
> >>Then it becomes necessary for me to explicitly link all apps against 
> >>-lpthreads.  Otherwise I get this:
> >>
> >>/mnt/home/jwilliam/uClinux-dist-test/uClibc/libc/misc/internals/__uClibc_main.c:125: 
> >>undefined reference to `__pthread_initialize_minimal'
> >>/mnt/home/jwilliam/uClinux-dist-test/uClibc/libc/misc/internals/__uClibc_main.c:125: 
> >>undefined reference to `__pthread_initialize_minimal'
> >>
> >>This seems like a new behaviour - I've grepped through the various 
> >
> >Nothing has changed in the uClibc front from the last release IIRC.
> Hmmm.. something's changed - current uClinux-dist CVS sources can build 
> with or without pthreads, no concerns.

Ok,  there is a new uClibc,  we brought it in so long ago I figured it
must have been in the last one :-(

> >>SnapGear targets and don't see an obvious generic solution.  Don't want 
> >>to just add "-lpthread" onto all link commands, since that will fail if 
> >>pthreads aren't built...
> >
> >
> >I think this is supposed to be dealt with by a weak symbol.  That is,
> >unless you link against libpthread,  it should just not link/use this
> >function.
> Hmm  - I recall issues with mb-gcc and it's weak symbol support, however 
> somehow this was not a problem in previous versions of the dist/uClibc.
> from uClibc/libc/misc/internals/__uClibc_main.c:
> extern void weak_function __pthread_initialize_minimal(void);
> #endif
> ...
>     /* Before we start initialzing uClibc we have to call
>      * __pthread_initialize_minimal so we can use pthread_locks
>      * whenever they are needed.
>      */
>     if (likely(__pthread_initialize_minimal!=NULL))
>         __pthread_initialize_minimal();
> #endif

I saw that,  thats why I thought of the weak symbol thing.  If it works
in the old version then it should be ok still.

> I tried disabling pthreads, but then the uClibc build fails in librt. 
> librt is definitely new since last time, and there's no option to turn 
> it off.  This would be a hack anyway, pthreads needs to work.
> What's puzzling me is why this has worked previously, but not now, with 
> the same toolchain.  Any suggestions for where to look, other than a 
> mega-diff between previous and current uClibc trees?

I would start with your config.arch,

I had a quick look and I don't think all is up to date wrt. the
common/config.arch.  For example there is no "-nodefault..." flags
anywhere, and they are a big part of the cleanups we have done to ensure
absolutely correct headers are used.  Also the crtbegin/crtend files and
so on.  That said,  you are using the central header/lib config already
so I may be way off base.

Obviously librt needs fixing as well, no ideas there.

We had a few problems with this version IIRC,  but they were all in the
dynamic loader (MMU) systems.

Double check the compile options in the two builds.


David McCullough, davidm at snapgear.com  Ph:+61 7 34352815 http://www.SnapGear.com
Custom Embedded Solutions + Security   Fx:+61 7 38913630 http://www.uCdot.org

More information about the uClinux-dev mailing list