[Mesa-dev] problem on building vmwgfx

Eric Engestrom eric.engestrom at imgtec.com
Tue Feb 28 16:41:48 UTC 2017


On Tuesday, 2017-02-28 14:40:55 +0100, Zhiguang Liu wrote:
> Hi, Eric,
> 
> Thanks for your suggestion. I modify the order of the include in
> dma-fence.c and the error has gone. However, when I recompile it I got the
> same error on drm_bridge.c.
> 
> ===============================================================
> make
> make -C /lib/modules/3.13.0-108-generic/build
>  KCPPFLAGS="-DVMWGFX_STANDALONE -DTTM_STANDALONE" SUBDIRS=`/bin/pwd`
> DRMSRCDIR=`/bin/pwd` modules
> make[1]: Entering directory `/usr/src/linux-headers-3.13.0-108-generic'
>   CC [M]  /home/zg/vmware/vmwgfx/ww_mutex.o
>   CC [M]  /home/zg/vmware/vmwgfx/dma-fence.o
>   CC [M]  /home/zg/vmware/vmwgfx/reservation.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_auth.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_bufs.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_context.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_crtc.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_drv.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_fops.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_ioctl.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_irq.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_modes.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_edid.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_lock.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_memory.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_vm.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_sysfs.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_hashtab.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_mm.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_debugfs.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_info.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_global.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_cache.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_prime.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_pci.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_atomic.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_scatter.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_dma.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_modeset_lock.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_crtc_helper.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_plane_helper.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_atomic_helper.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_bridge.o
> In file included from /home/zg/vmware/vmwgfx/drm_bridge.c:27:0:
> /home/zg/vmware/vmwgfx/drm_compat.h:113:3: error: expected identifier or
> ‘(’ before ‘{’ token
>   ({BUILD_BUG_ON(_s != TASK_NORMAL); \
>    ^
> include/linux/sched.h:2077:12: note: in expansion of macro ‘wake_up_state’
>  extern int wake_up_state(struct task_struct *tsk, unsigned int state);
>             ^
> make[2]: *** [/home/zg/vmware/vmwgfx/drm_bridge.o] Error 1
> make[1]: *** [_module_/home/zg/vmware/vmwgfx] Error 2
> make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-108-generic'
> make: *** [modules] Error 2
> 
> ===============================================================
> 
> 
> I try to reorder the include file in drm_bridge.c as follows:
> #include <linux/err.h>
> #include <linux/module.h>
> 
> 
> #include "drm_crtc.h"
> #include "drm_compat.h"
> #include "drmP.h"
> 
> Then I got some other error as shown below:
> 
> ===============================================================
> zg at ubuntu:~/vmware/vmwgfx$ make
> make -C /lib/modules/3.13.0-108-generic/build
>  KCPPFLAGS="-DVMWGFX_STANDALONE -DTTM_STANDALONE" SUBDIRS=`/bin/pwd`
> DRMSRCDIR=`/bin/pwd` modules
> make[1]: Entering directory `/usr/src/linux-headers-3.13.0-108-generic'
>   CC [M]  /home/zg/vmware/vmwgfx/ww_mutex.o
>   CC [M]  /home/zg/vmware/vmwgfx/dma-fence.o
>   CC [M]  /home/zg/vmware/vmwgfx/reservation.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_auth.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_bufs.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_context.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_crtc.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_drv.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_fops.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_ioctl.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_irq.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_modes.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_edid.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_lock.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_memory.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_vm.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_sysfs.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_hashtab.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_mm.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_debugfs.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_info.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_global.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_cache.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_prime.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_pci.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_atomic.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_scatter.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_dma.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_modeset_lock.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_crtc_helper.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_plane_helper.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_atomic_helper.o
>   CC [M]  /home/zg/vmware/vmwgfx/drm_bridge.o
> In file included from /home/zg/vmware/vmwgfx/drm_crtc.h:101:0,
>                  from /home/zg/vmware/vmwgfx/drm_bridge.c:28:
> /home/zg/vmware/vmwgfx/drm_modes.h:400:27: error: field
> ‘picture_aspect_ratio’ has incomplete type
>   enum hdmi_picture_aspect picture_aspect_ratio;
>                            ^
> make[2]: *** [/home/zg/vmware/vmwgfx/drm_bridge.o] Error 1
> make[1]: *** [_module_/home/zg/vmware/vmwgfx] Error 2
> make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-108-generic'
> make: *** [modules] Error 2
> 
> ===============================================================

Looks like there are more issues than I thought.
I don't know this codebase at all, I just recognized the first error you
saw and knew how to fix it.

For more in-depth help, I suggest asking Sinclair or Thomas (both Cc'ed).

Cheers,
  Eric

> 
> 
> 
> 
> 
> 
> Best regards,
> Zhiguang
> 
> On Tue, Feb 28, 2017 at 2:24 PM, Eric Engestrom <eric.engestrom at imgtec.com>
> wrote:
> 
> > On Tuesday, 2017-02-28 14:04:15 +0100, Zhiguang Liu wrote:
> > > Hi,
> > >
> > > I try to build vmwgfx on Ubuntu 12.04 with gcc-4.8.1, make 3.8.1. I clone
> > > the source files using the following command:
> > >
> > > git clone git://anongit.freedesktop.org/git/mesa/vmwgfx
> > >
> > > However, when I use 'make' command to build it, I got one error like
> > this:
> > >
> > > ================================================================
> > > zg at ubuntu:~/vmware/vmwgfx$ make
> > > make -C /lib/modules/3.13.0-108-generic/build
> > KCPPFLAGS="-DVMWGFX_STANDALONE
> > > -DTTM_STANDALONE" SUBDIRS=`/bin/pwd` DRMSRCDIR=`/bin/pwd` modules
> > > make[1]: Entering directory `/usr/src/linux-headers-3.13.0-108-generic'
> > >   CC [M]  /home/zg/vmware/vmwgfx/ww_mutex.o
> > >   CC [M]  /home/zg/vmware/vmwgfx/dma-fence.o
> > > In file included from /home/zg/vmware/vmwgfx/dma-fence.c:37:0:
> > > /home/zg/vmware/vmwgfx/drm_compat.h:113:3: error: expected identifier or
> > > ‘(’ before ‘{’ token
> > >   ({BUILD_BUG_ON(_s != TASK_NORMAL); \
> > >    ^
> > > include/linux/sched.h:2077:12: note: in expansion of macro
> > ‘wake_up_state’
> > >  extern int wake_up_state(struct task_struct *tsk, unsigned int state);
> > >             ^
> >
> > The problem isn't with the macro, but the fact that it's defined before
> > the function it replaces.
> >
> > The result is that this:
> >         extern int wake_up_state(struct task_struct *tsk, unsigned int
> > state);
> >
> > … gets rewritten as this (by the preprocessor):
> >         extern int ({BUILD_BUG_ON(_s != TASK_NORMAL); wake_up_state(struct
> > task_struct *tsk); });
> >
> > … which is invalid and doesn't compile.
> >
> > Changing the order of the includes should fix this. Can you try this
> > patch?
> >
> > ----8<----
> > diff --git a/core/dma-fence.c b/core/dma-fence.c
> > index d28fb37..515593f 100644
> > --- a/core/dma-fence.c
> > +++ b/core/dma-fence.c
> > @@ -34,8 +34,8 @@ EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit);
> >
> >  #include <linux/slab.h>
> >  #include <asm/atomic.h>
> > -#include "drm_compat.h"
> >  #include "core/dma-fence.h"
> > +#include "drm_compat.h"
> >
> >  #define trace_dma_fence_signaled(_a)
> >  #define trace_dma_fence_wait_start(_a)
> > ---->8----
> >
> > Cheers,
> >   Eric
> >
> >
> > > make[2]: *** [/home/zg/vmware/vmwgfx/dma-fence.o] Error 1
> > > make[1]: *** [_module_/home/zg/vmware/vmwgfx] Error 2
> > > make[1]: Leaving directory `/usr/src/linux-headers-3.13.0-108-generic'
> > > make: *** [modules] Error 2
> > > ================================================================
> > >
> > > I opened the drm_compat.h and it seems that nothing goes wrong for line
> > > 113. Does anyone have some idea on this problem?
> > >
> > > [image: Inline image 1]
> > >
> > > Best regards,
> > > Zhiguang
> >


More information about the mesa-dev mailing list