Bug 45292

Summary: Compilation failure on d3d1x state tracker: ‘ID3D10Include’ has not been declared
Product: Mesa Reporter: Jeremy Murphy <jeremy.william.murphy>
Component: OtherAssignee: mesa-dev
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: medium CC: ariscop, devurandom, lingfengz, mail, shibam, yamakuzure
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: build.log: Fails on x86_64 with wine-1.3.37
Re-insert neccessary typedef for ID3D10Include
Hackish patch to make d3d build
Another hackish patch against c3bc4101...

Description Jeremy Murphy 2012-01-26 20:04:24 UTC
Created attachment 56211 [details]
build.log: Fails on x86_64 with wine-1.3.37

With d3d1x enabled, mesa fails to compile.  wine-1.3.37 installed.  Snippet from the build log:

x86_64-pc-linux-gnu-g++ -c -I. -I../../../../../src/gallium/include -I../../../../../src/gallium/auxiliary -I../../../../../src/gallium/drivers -Iinclude -I../gd3dapi -I../d3dapi -I../w32api -I../../../include -I../../../auxiliary -O2 -pipe -march=native -w -Wall -fno-strict-aliasing -fno-builtin-memcmp -O2 -pipe -march=native -w  -fPIC  -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DUSE_XCB -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0300 -fvisibility=hidden -I/usr/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS src/guids.cpp -o src/guids.o
In file included from ../d3dapi/d3d10.h:5704:0,
                 from ../d3dapi/d3d10_1.h:39,
                 from ../d3dapi/d3d11.h:7774,
                 from ../gd3dapi/galliumd3d11.h:28,
                 from src/guids.cpp:3:
../w32api/d3d10effect.h:831:44: error: ‘ID3D10Include’ has not been declared
gmake[5]: *** [src/guids.o] Error 1
Comment 1 Jeremy Murphy 2012-02-09 22:43:22 UTC
OK, I have found what is going wrong, it is pretty simple.  d3d10.h contains these three lines at the end of the file:

#include "d3d10misc.h"
#include "d3d10shader.h"
#include "d3d10effect.h"

'ID3D10Include' is defined (typedef'd) in d3d10shader.h and it is used in d3d10effect.h.  At least, it is defined in Wine's copy, but not in Mesa's copy.  However, since Mesa does *not* have its own copy of d3d10effect.h, it always brings in Wine's copy, which expects 'ID3D10Include' to have been previously defined.

This typedef was introduced in Wine in 1.3.2, so I guess you are developing against an older version?  Or are you using the latest Wine but don't hit this problem?  I am curious to know.

Anyway, that's the problem, in case it wasn't already obvious, but I don't know enough about Mesa at the moment to suggest a solution.  Roll your own d3d10effect.h?  Cheers.
Comment 2 Jeremy Murphy 2012-02-09 22:52:08 UTC
However, I have another thought.  The last time that I successfully compiled Mesa against Wine was 16-Dec-2011, which is way after the 'ID3D10Include' typedef was introduced.  So Mesa had been compiling fine until some change introduced shortly after that.  Curious.
Comment 3 Philip Milev 2012-02-20 06:02:10 UTC
I can confirm this on x86_64 gentoo-3.2.6 using wine-1.4_rc3 and mesa-9999.

In file included from ../d3dapi/d3d10.h:5704:0,
                 from ../d3dapi/d3d10_1.h:39,
                 from ../d3dapi/d3d11.h:7774,
                 from ../gd3dapi/galliumd3d11.h:28,
                 from src/guids.cpp:3:
../w32api/d3d10effect.h:831:44: error: ‘ID3D10Include’ has not been declared
Comment 4 Jeremy Murphy 2012-02-20 06:56:53 UTC
(In reply to comment #3)
> I can confirm this on x86_64 gentoo-3.2.6 using wine-1.4_rc3 and mesa-9999.

Thanks.  Have you had any luck doing a git bisect to find the origin of the bug?  I tried, but with no luck.  :(
Comment 5 Sven Eden 2012-02-21 03:42:29 UTC
Created attachment 57383 [details] [review]
Re-insert neccessary typedef for ID3D10Include

Hi!

I have been able to get past this error with the attached patch.

System: Gentoo x64, kernel 3.2.5, wine 1.3.37

But it does not mean it works, I run into the next error.

Build snippet:
-------------------------------
In file included from ../w32api/windows.h:66:0,
                 from ../w32api/rpc.h:29,
                 from ../d3dapi/d3d11shader.h:7,
                 from src/dxbc_parse.cpp:29:
../w32api/winsock.h:447:16: error: redefinition of 'struct timeval'
/usr/include/bits/time.h:31:8: error: previous definition of 'struct timeval'
../w32api/winsock.h:451:10: error: invalid type in declaration before ',' token
-------------------------------

As "w32api" is just a link to /usr/include/wine/windows, it is a wine thing.

But: When timeval is defined from /usr/include/bits/time.h, the macro "_STRUCT_TIMEVAL" is defined. Unfortunately I can't seem to find a point where to patch any idl file to check that.

There are two possibilities.

A) windows.h does not include winsock.h if WINE_NOWINSOCK is defined

     65 #ifndef WINE_NOWINSOCK
     66 #include <winsock.h>
     67 #endif /* WINE_NOWINSOCK */

B) define _TIMEVAL_DEFINED if _STRUCT_TIMEVAL is defined, because winsock.h checks that:

#ifndef _TIMEVAL_DEFINED
#define _TIMEVAL_DEFINED
typedef struct WS(timeval)
{
    LONG    tv_sec;                /* seconds */
    LONG    tv_usec;               /* and microseconds */
} TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
#endif

-------------

I'd prefer the latter, but I have no idea where to put that, yet.
Comment 6 Philip Milev 2012-04-08 01:38:40 UTC
Hi any progress here ?

I've tried all releases of wine (up to 1.5.1) and mesa-9999 with no luck. 

I was able to get past the ID3D10Include, but also ran into the timeval structure redefinition in winsock.h. 

I guess we need assistance.
Comment 7 Andrew Cook 2012-04-14 22:52:17 UTC
Created attachment 60001 [details] [review]
Hackish patch to make d3d build

'fixes' build problems. probably not suitable for merge but it does list what needs to be changed.

there's all so a problem with __uuidof:

In function ‘const GUID& __wine_uuidof() [...]’:
... warning: returning reference to temporary [enabled by default]

that is way beyond my knowledge

after building the samples dont run, problem in dxgi (dxgi_native.cpp:254, first few lines. fails to create display) which eventualy segfaults in libgcc_s for some reason.
Comment 8 Andrew Cook 2012-04-15 17:08:27 UTC
(In reply to comment #7)
> Created attachment 60001 [details] [review] [review]
> Hackish patch to make d3d build

i should probably mention, this is against 8.0.2. building mesa-git on this machine would mean building a few other things and i'd rather not. hopefully that will fix itself soon
Comment 9 Dennis Schridde 2012-05-28 12:41:02 UTC
Persists in 8.0.3 with Wine 1.5.5:
In file included from ../d3dapi/d3d10.h:5704:0,
                 from ../d3dapi/d3d10_1.h:39,
                 from ../d3dapi/d3d11.h:7774,
                 from ../gd3dapi/galliumd3d11.h:28,
                 from src/guids.cpp:3:
../w32api/d3d10effect.h: At global scope:
../w32api/d3d10effect.h:831:44: error: ‘ID3D10Include’ has not been declared

There are also still a huge load of these:
../d3dapi/d3d10shader.h: In function ‘const GUID& __wine_uuidof() [with T = ID3D10ShaderReflection, GUID = _GUID]’:
../d3dapi/d3d10shader.h:486:1: warning: returning reference to temporary [enabled by default]
Comment 10 Andrew Cook 2012-07-23 14:42:42 UTC
Created attachment 64550 [details] [review]
Another hackish patch against c3bc4101...

patch against c3bc41011f9ffe648b7dd4915c6202b776cd1ab4
compiles without error with wine-1.5.8

demo's still fail on display->init (forgot the line number)
Comment 11 Andrew Cook 2012-07-24 05:56:55 UTC
bug found: dxgi_loader_create_drm_screen (dxgi_loader.cpp:193) fails 
to get a 'pipe_screen'.
it looks like it should be replaceable with create_drm_screen from egl.c, but
actually doing that has proven to be beyond my skill (where the heck is it
once its compiled? is it used ANYWHERE except egl.c? looks generic enough)

also you can remove the wall of 'reference to temporary' errors by changing
__CRT_UUID_DECL in guiddef.h. i'm not sure how wine compiles without throwing
millions of these warnings.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.