delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/01/14/14:15:04

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,TW_XC
X-Spam-Check-By: sourceware.org
Message-ID: <50F40B7E.6040200@dronecode.org.uk>
Date: Mon, 14 Jan 2013 13:43:26 +0000
From: Jon TURNEY <jon DOT turney AT dronecode DOT org DOT uk>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
CC: angelo DOT graziosi AT alice DOT it
Subject: Re: Another issue with CLANG
References: <50F00B98 DOT 9090306 AT alice DOT it> <50F2C529 DOT 6070303 AT dronecode DOT org DOT uk> <50F2C837 DOT 9020903 AT alice DOT it> <50F2D0D8 DOT 1040403 AT dronecode DOT org DOT uk> <50F3F03A DOT 4080503 AT alice DOT it>
In-Reply-To: <50F3F03A.4080503@alice.it>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 14/01/2013 11:47, Angelo Graziosi wrote:
> Il 13/01/2013 16.20, Jon TURNEY ha scritto:
>> On 13/01/2013 14:44, Angelo Graziosi wrote:
>>> Il 13/01/2013 15.31, Jon TURNEY ha scritto:
>>>> On 11/01/2013 12:54, Angelo Graziosi wrote:
>>>>> An application which need to be built with clang++, fails to build when it
>>>>> includes glx.h and indirectly windows.h headers like in the test case shown
>>>>> below.
>>>>>
>>>>> In short, X11/Xlib.h define Status as a macro (an alias for int) instead
>>>>> rpcdce.h uses Status a a pointer variable name...
>>>>
>>>> I don't think there's anything clang-specific about this problem.  The same
>>>> issue can be seen with gcc.
>>>>
>>>> If your application needs both Xlib and Win32 interfaces, you should include
>>>> <X11/Xwindows.h> rather than <windows.h>, which wraps any conflicting
>>>> declarations.
>>>>
>>>> (xcb uses a sensible namespace, so this is not necessary for applications
>>>> which use xcb and Win32.)
>>>>
>>>> You probably need the latest upstream x11proto (not yet packaged for cygwin)
>>>> for this wrapping to work correctly with the mingw-w64 w32api headers [1]
>>>>
>>>> Alternatively you can work around this yourself e.g. as in [2]
>>>
>>>
>>> Thanks Jon, foo.cxx was anly a test case to reproduce the errors. In the true
>>> application those headers were included indirectly... :-(
>>>
>>> In file included from input_line_87:1:
>>> In file included from include/TX11GL.h:29:
>>> In file included from /usr/include/GL/glx.h:45:
>>> In file included from /usr/include/w32api/GL/gl.h:13:
>>
>> This looks very wrong, mixing native and X GL headers isn't going to work.
>>
>> Assuming you mean to build an X application, this should be finding
>> /usr/include/GL/gl.h, so maybe an include path issue?
> 
> For the record...
> 
> ROOT guys have fixed this issue with the following patch to their patched
> version of llvm/clang:
> 
> $ cat InitHeaderSearch.cpp.diff
> --- ROOT/interpreter/llvm/src/tools/clang/lib/Frontend/InitHeaderSearch.cpp   
> 2013-01-01 11:50:05.000000000 +0100
> +++
> root_trunk/interpreter/llvm/src/tools/clang/lib/Frontend/InitHeaderSearch.cpp
>       2013-01-14 12:10:43.906250000 +0100
> @@ -305,7 +305,8 @@
>    case llvm::Triple::RTEMS:
>      break;
>    case llvm::Triple::Cygwin:
> -    AddPath("/usr/include/w32api", System, true, false, false);
> +    // The headers in w32api/ are not cygwin-compatible (but native)
> +    //AddPath("/usr/include/w32api", System, true, false, false);

Well, ok.  But this comment is almost completely wrong.

cygwin clang has /usr/include/w32api in the default include path (try
compiling your test program with clang -v), and since it appears *after*
/usr/include, including glx.h works correctly.

I have no idea what the right way to solve this problem is.




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019