After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 570806 - trio.c fails to compile
trio.c fails to compile
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.7.3
Other All
: Normal blocker
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2009-02-06 17:41 UTC by gnome
Modified: 2009-03-03 06:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description gnome 2009-02-06 17:41:15 UTC
Please describe the problem:
trio.c (from libxml2 2.7.3) fails to compile with the following error:
    Error: undefined identifier 'errno'
    trio.c line 1210     save_errno = errno; 



Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?
Yes

Other information:
The problem is due to `#include <errno.h>` being guarded with `#ifdef HAVE_ERRNO_H`.
HAVE_ERRNO_H is NEVER defined as config.h is NOT included.

Adding `#include "config.h"` as the first include appears to fix the problem.
Comment 1 William M. Brack 2009-03-02 08:45:04 UTC
I do not understand what you are doing.

 1) trio.c includes trio.h
 2) trio.h includes config.h provided that
    a) TRIO_TRIO_H is not defined
    b) WITHOUT_TRIO is not defined
    c) HAVE_CONFIG_H is defined
 3) HAVE_CONFIG_H is (normally) defined within Makefile

Which of these steps is going wrong for you, and why?
Comment 2 gnome 2009-03-02 17:36:07 UTC
I'm not using a makefile.  I'm using an Xcode project.
OK, so perhaps I should add -D HAVE_CONFIG_H to the Xcode project, but this worked before without it.
The problem appeared because a test for HAVE_ERRNO_H was added to trio.c, so it should also include "config.h".
The file trio.h tries to include <config.h> when, clearly, it should be "config.h".
Comment 3 William M. Brack 2009-03-03 06:38:18 UTC
Actually, that should be "-DHAVE_CONFIG_H" (no space).  The test for HAVE_ERRNO_H was added on April 17, 2007 in order to ease compilation on Windows CE, and was a part of libxml2-2.6.28.  I would concur that enclosing config.h in quotation marks would be better, and have made that change in SVN.  I also note that trio.h has been like that for around 5 years.

Thank you for the report.