Ticket #2109 (new bug)

Opened 11 years ago

Last modified 11 years ago

Can't find asm/errno.h

Reported by: whiteknight Owned by:
Priority: normal Milestone:
Component: build Version: 3.3.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform: linux

Description

I just upgraded my laptop to Ubuntu 11.04, and immediately there is a problem building Parrot.

In file included from src/datatypes.c:23:
In file included from ./include/parrot/parrot.h:35:
In file included from /usr/include/errno.h:36:
In file included from /usr/include/bits/errno.h:25:
/usr/include/linux/errno.h:4:10: fatal error: 'asm/errno.h' file not found

errno.h used to be in /usr/include/asm/errno.h, but as of Ubuntu 11.04 it appears in these locations:

> locate errno.h
/opt/intel/Compiler/11.1/064/Documentation/en_US/compiler_c/main_cls/copts/common_options/option_fmath_errno.htm
/opt/intel/Compiler/11.1/064/Documentation/ja_JP/compiler_c/main_cls/copts/common_options/option_fmath_errno.htm
/usr/include/errno.h
/usr/include/asm-generic/errno.h
/usr/include/bits/errno.h
/usr/include/linux/errno.h
/usr/include/sys/errno.h
/usr/lib/syslinux/com32/include/errno.h

So it looks like it's in /usr/include/errno.h ("#include <errno.h>") or in /usr/include/asm-generic/errno.h ("#include <asm-generic/errno.h>"). What's weird is that the two files are not the same, and don't define the same constants. It looks like Parrot will build with /usr/include/asm-generic/errno.h, but fails with a symbol undefined error with /usr/include/errno.h. I don't know if this is a "bug" as far as Ubuntu is concerned or not. It certainly seems undesired to me.

I can, as a temporary fix, use a symlink to put the files in the correct places. However, For completeness, I wonder if we should do any of the following:

  • Try to avoid using asm/errno.h in our code, if possible
  • Add a configure probe to search for the correct errno.h
  • Yell at Ubuntu until they fix this.

Any of these are fine, I just want to get some opinions about it. If more people upgrade ubuntu and run into these problems, we will be getting more reports about it.

Change History

Changed 11 years ago by jkeenan

Datum: It appears we have never had to probe for errno.h before, as references to it don't appear within the configuration system.

$ ack 'errno.h' *      
compilers/imcc/imclexer.c
46:#include <errno.h>

include/parrot/parrot.h
35:#include <errno.h>

src/gc/malloc.c
332:#include <errno.h>    /* needed for optional MALLOC_FAILURE_ACTION */
5545:      * Include errno.h to support default failure action.

tools/dev/lib_deps.pl
384:errno       errno.h

Changed 11 years ago by jkeenan

Datum: On my older Debian,

$ lsb_release -a 2>/dev/null | grep -i description
Description:    Debian GNU/Linux 5.0.3 (lenny)
$ cat /usr/include/asm/errno.h 
#include <asm-generic/errno.h>

So asm/errno.h does nothing but include asm-generic/errno.h. Has this configuration changed on your Ubuntu?

kid51

Changed 11 years ago by pmichaud

On Thu, May 12, 2011 at 01:30:33AM -0000, Parrot wrote:
>  I just upgraded my laptop to Ubuntu 11.04, and immediately there is a
>  problem building Parrot. [...]

FWIW, Since Apr 30 I've been running Kubuntu 11.04 on all of my machines, 
and haven't encountered this error when building Parrot.  So perhaps it's
something specific to your configuration or Parrot setup.

By looking at the files you cite I do see that /usr/include/linux/errno.h 
does have #include <asm/errno.h> and that there is no /usr/include/asm/errno.h 
file on my machine (which sounds like an Ubuntu bug)... but for some reason I 
never encounter the error when building Parrot.

Perhaps there's a package that is/isn't loaded on your machine that isn't/is
loaded on mine?  What options are you sending to parrot Configure.pl?  

>  {{{
>  In file included from src/datatypes.c:23:
>  In file included from ./include/parrot/parrot.h:35:
>  In file included from /usr/include/errno.h:36:
>  In file included from /usr/include/bits/errno.h:25:
>  /usr/include/linux/errno.h:4:10: fatal error: 'asm/errno.h' file not found
>  }}}
> 
> [...]
> 
>  So it looks like it's in /usr/include/errno.h ("#include <errno.h>") or in
>  /usr/include/asm-generic/errno.h ("#include <asm-generic/errno.h>").

Parrot is doing the correct thing here -- it's including <errno.h>,
which in turn includes <bits/errno.h>, which includes <linux/errno.h>,
which includes <asm/errno.h> (and that's where the error is).  I don't
see any way to fix this in Parrot.

>   - Try to avoid using asm/errno.h in our code, if possible

I doubt that Parrot uses asm/errno.h directly -- it's getting it
indirectly through the chain listed above.

>   - Add a configure probe to search for the correct errno.h

It's already getting the correct errno.h -- the one in /usr/include/errno.h .

>   - Yell at Ubuntu until they fix this.

I'll add a fourth option -- figure out why it's working on my machine and
not yours.  :-)

Pm

Changed 11 years ago by pmichaud

Also, the problem is apparently noted in Launchpad:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/778047

They suggest the symlink workaround.  I still don't know why my
machine(s) aren't exhibiting the problem.

Pm


Changed 11 years ago by bacek

Hello.

Looks like you have to install gcc-multilib package.

-- Bacek

Changed 11 years ago by pmichaud

On Wed, May 11, 2011 at 09:38:15PM -0500, Patrick R. Michaud wrote:
> I still don't know why my machine(s) aren't exhibiting the problem.

Aha, found it from the ticket:

> > /opt/intel/Compiler/11.1/064/Documentation/en_US/compiler_c/main_cls/copts/common_options/option_fmath_errno.htm
> > /opt/intel/Compiler/11.1/064/Documentation/ja_JP/compiler_c/main_cls/copts/common_options/option_fmath_errno.htm

Looks like you're maybe using the Intel compiler?  This bug seems
to only affect the Intel compiler, whereas all my systems have 
been using gcc.

Pm

Changed 11 years ago by plobsing

Sounds like your system headers are in a bad way. POSIX specifies ( http://pubs.opengroup.org/onlinepubs/000095399/basedefs/errno.h.html) that '#include <errno.h>' should pull in all the symbols required to operate on the errno global. If this isn't working, it is critical platform-level breakage that should be hard to miss by the Ubuntu team, which suggests your configuration has somehow diverged from the vanilla ubuntu in these matters.

Is this result with gcc? Other compilers have a history of similar issues with new linux distro releases (to be fair, the headers are designed and tested for gcc only).

Can you reproduce this issue on a clean install? Perhaps the upgrader left you in a bad state.

As for remedies, we don't (and shouldn't) refer to system-specific header files such as asm-generic/errno.h unless absolutely necessary. A quick ack in our codebase finds no uses of asm-generic/ and only one use of asm/. Configure probes for this sort of feature common across all platforms should also be held as a last resort.

I recommend you raise the issue with Ubuntu. This is a critical platform error. If the error is as you've described, most any code is broken on your platform (try writting code that performs meaninful and sound operations without using errno). This is completely unacceptable.

Note: See TracTickets for help on using tickets.