Bug 506720 - Review Request: uClibc - C library for embedded Linux
Summary: Review Request: uClibc - C library for embedded Linux
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Miloslav Trmač
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 502332
TreeView+ depends on / blocked
 
Reported: 2009-06-18 13:24 UTC by Ivana Varekova
Modified: 2009-09-15 07:49 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-15 07:49:35 UTC
Type: ---
Embargoed:
mitr: fedora-review+
j: fedora-cvs+


Attachments (Terms of Use)
gcc-uClibc (1.87 KB, text/plain)
2009-06-18 15:29 UTC, Stefan Assmann
no flags Details

Description Ivana Varekova 2009-06-18 13:24:44 UTC
Spec URL: http://people.redhat.com/varekova/uClibc.spec

SRPM URL: http://people.redhat.com/varekova/uClibc-0.9.30.1-1.fc12.src.rpm

Description:
uClibc is a C library for developing embedded Linux systems.
It is much smaller than the GNU C Library, but nearly all applications
supported by glibc also work perfectly with uClibc.

Comment 1 Denys Vlasenko 2009-06-18 14:51:06 UTC
The goal of this package is to be able to compile stuff against uclibc, without too much PITA.

After build of this package, headers and libs seem to end up in /usr/{lib,include}/uClibc. Ok. How we will use them to build apps?


This is what I do at home to achieve it:
http://busybox.net/~vda/HOWTO/i486-linux-uclibc/HOWTO.txt

And here is Rob's automatic build system for uclibc toolchain for several architectures:
http://landley.net/code/firmware/

My approach (described at the URL above) basically amounts to building a separate cross-compiler for uclibc because:

(1) AFAIK, libc forms a part of the platform's ABI:

# i486-linux-uclibc-gcc -v
Using built-in specs.
Target: i486-linux-uclibc
                   ^^^^^^
$ gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
                                              ^^^
(above: "gnu" basically means "glibc", I think)

and (2) it is easier to follow the same scheme for all uclibc builds, "native" and true cross-compiling ones.

But - this method will install cross-compiling gcc and cross-compiling binutils.
Not sure Fedora would want that. (Comments from the people in the know? Is it possible/acceptable for Fedora to package cross-compiling toolchains?)

I expect Fedora would rather want to use native toolchain, just coerced into using uclibc headers and libs. This is an understandable desire to reuse what we already have installed.

But this is not easy. At least I failed when I tried. Problems usually manifest as gcc and/or ld using start files and/or libs which do not exist, and do not contain some required symbols. Because native gcc/ld expect to link against glibc.

Comment 2 Stefan Assmann 2009-06-18 15:28:21 UTC
Hi Denys,

I packaged uClibc on openSUSE back in the days when I still worked at SUSE. My primary concern was to use uClibc to build static binaries of busybox and some other essentials that I needed to create a really small boot environment. 

Installing a cross-toolchain was not an option back then, I was told so. So I started by reading the mailing list about uClibc and compiling with native gcc. In the end I came up with a little script that uses gcc supplied with openSUSE and overrides all kinds of default paths to use uClibc headers and stuff.

That worked to the extend that I could compile busybox statically. I failed to get shared library support working but that wasn't my main focus. Let me attach the script so you can have a look at it. I'd be happy to get some feedback, knowing this won't be your prefered way of dealing with this ;-) This will need some tweaking for using it in Fedora of course, it's just meant to get an idea.

Thanks!
  Stefan

Comment 3 Stefan Assmann 2009-06-18 15:29:22 UTC
Created attachment 348501 [details]
gcc-uClibc

Comment 4 Bill Nottingham 2009-06-18 15:31:44 UTC
Is there a particular reason we want to ship uClibc other than 'it's there'?

Comment 5 Ivana Varekova 2009-06-19 06:24:40 UTC
The reason is to have it separated from busybox - for now busybox use it to be smaller and more optimized.

Comment 6 Bill Nottingham 2009-06-19 14:39:55 UTC
Right, but we explicitly discourage static linking, much less static linking to another C library. (I know that the busybox-anaconda package is actually dynamically linked.)

Comment 7 Denys Vlasenko 2009-06-22 14:31:01 UTC
Re static linking:

busybox is a rescue package thing. It is useful when dynamic libraries are busted (think rm -rf /lib).

Also, busybox is used when it's critical to minimize the size. glibc really is not caring about code size anymore.

I don't know where exactly busybox is used in Fedora, but in above two cases people usually use statically linked busybox.


Re static linking to another C library: uclibc can be configured and built as a dynamic library. What is the Fedora policy on this? Are alternative libc's allowed?

BTW, in effect we already have two libc's on x86_64: 32-bit and 64-bit glibc have different ABIs and live in different directories.

Adding more libc's boils down to selecting a directory for them (I don't know, /lib-i[456]86-uclibc?)

Comment 8 Miloslav Trmač 2009-06-24 19:47:22 UTC
> $ rpmlint ../SRPMS/uClibc-0.9.30.1-1.fc11.src.rpm 
> uClibc.src:69: E: hardcoded-library-path in $RPM_BUILD_ROOT/lib/*
> uClibc.src:70: E: hardcoded-library-path in $RPM_BUILD_ROOT/lib/
OK, these don't appear in the binary package.
> $ rpmlint ../RPMS/x86_64/uClibc-devel-0.9.30.1-1.fc11.x86_64.rpm 
> 1 packages and 0 specfiles checked; 0 errors, 0 warnings.

Blockers:
- License: should AFAICS be "LGPLv2" (no "+")
- "No debuginfo needed" is rather useless reason for disabling debuginfo.
  Perhaps "This package only contains a static library".
- Use %global instead of %define

Other requirements:
- Use %{?_smp_mflags} in (make V=1)
- All patches should have an upstream bug link or comment 

Notes:
- You can use
    %files ...
    %{_includedir}/uClibc
  instead of
    %files ...
    %dir %{_includedir}/uClibc
    %{_includedir}/uClibc/*
  (and the same for _libdir)
- Please consider setting PREFIX instead of DEVEL_PREFIX
- CFLAGS do not use %{optflags}, it probably doesn't make sense in this case
- The ExcludeArch: comment will have to be filed as a bug component creation in bugzilla
- My POV is that uClibc is a package that can be correctly packaged and made
  available to users of Fedora.
  I probably wouldn't approve a review of any other Fedora package linking
  against uClibc - both anaconda and mkinitrd link against glibc, after all.

Comment 9 Ivana Varekova 2009-06-26 11:49:58 UTC
Thanks fixed:
Spec URL: http://people.redhat.com/varekova/new/uClibc.spec
SRPM URL: http://people.redhat.com/varekova/new/uClibc-0.9.30.1-1.fc12.src.rpm

add notes 
- Please consider setting PREFIX instead of DEVEL_PREFIX
for now I leave DEVEL_PREFIX, but if you want it then I will do the change
- CFLAGS do not use %{optflags}, it probably doesn't make sense in this case
I don't think tit has a sense
-  The ExcludeArch: comment will have to be filed as a bug component creation in
bugzilla
I plan to create the bz, thanks

Comment 10 Miloslav Trmač 2009-06-29 10:02:34 UTC
Thanks, but that package is missing all patches and it does not build any more.

Comment 11 Ivana Varekova 2009-07-02 13:12:51 UTC
Thanks, fixed.

Comment 12 Miloslav Trmač 2009-07-02 14:49:44 UTC
OK, accepted.

Comment 13 Jason Tibbitts 2009-07-17 15:24:51 UTC
I see the fedora-cvs flag was set, but there's nothing here indicating what you need to CVS folks to do.  Please see http://fedoraproject.org/wiki/CVS_admin_requests for some documentation on doing that.

Comment 14 Ivana Varekova 2009-07-20 06:38:41 UTC
New Package CVS Request
=======================
Package Name: uClibc
Short Description: C library for embedded Linux
Owners: varekova vda
Branches: F-11 devel
InitialCC: varekova

Comment 15 Jason Tibbitts 2009-07-21 15:18:00 UTC
CVS done.

Comment 16 Milos Jakubicek 2009-08-29 15:11:26 UTC
The package has been still not imported into CVS and built, what prevents that?

Comment 17 Ivana Varekova 2009-08-31 06:34:15 UTC
Thanks, just build in fc12.

Comment 18 Denys Vlasenko 2009-09-02 11:53:14 UTC
fc11 build is done too (identical to fc12):

http://koji.fedoraproject.org/koji/buildinfo?buildID=130251


Note You need to log in before you can comment on or make changes to this bug.