Bug 101189 - Latest git fails to compile with radeon
Summary: Latest git fails to compile with radeon
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r600 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Default DRI bug account
QA Contact: Default DRI bug account
URL:
Whiteboard:
Keywords:
: 101190 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-05-25 16:47 UTC by John Dallahan
Modified: 2017-06-17 15:41 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Complete build log (1.54 MB, text/plain)
2017-05-28 13:03 UTC, John Dallahan
Details

Description John Dallahan 2017-05-25 16:47:20 UTC
It seems that commit de9dd4f9f1bb5984c554d0acf7d2592951ecc53f introduced a bug in which you were not able to compile radeon drivers. The latest git currently fails to build with:

/var/tmp/portage/media-libs/mesa-9999/work/mesa-9999/src/amd/common/ac_gpu_info.h:31:20: fatal error: amdgpu.h: No such file or directory

I'm building mesa-9999 on Gentoo. My use flags are: 
USE="classic d3d9 dri3 egl gallium gbm gles2 llvm nptl opencl pax_kernel pic vaapi vdpau wayland xa -bindist -debug -gles1 -openmax -osmesa (-selinux) -unwind% -valgrind -vulkan -xvmc" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="i965 intel r600 radeon (-freedreno) -i915 -imx -nouveau -r100 -r200 -r300 -radeonsi (-vc4) (-vivante) -vmware"
Comment 1 Eric Engestrom 2017-05-26 17:14:42 UTC
Fixed by:

commit 44b29dd7b6cdc1a3fde58c367b9de8081ac4167b
Author: Eric Engestrom <eric.engestrom@imgtec.com>
Date:   Fri May 26 11:59:20 2017 +0100

    amd/common: add missing libdrm include path
Comment 2 Eric Engestrom 2017-05-26 17:14:45 UTC
*** Bug 101190 has been marked as a duplicate of this bug. ***
Comment 3 Pavel Vinogradov 2017-05-26 19:20:16 UTC
drm from git doesn't provide amdgpu.h, but amdgpu_drm.h.
Comment 4 Alex Deucher 2017-05-26 19:23:14 UTC
(In reply to Pavel Vinogradov from comment #3)
> drm from git doesn't provide amdgpu.h, but amdgpu_drm.h.

It provides both:
https://cgit.freedesktop.org/mesa/drm/tree/amdgpu/amdgpu.h
https://cgit.freedesktop.org/mesa/drm/tree/include/drm/amdgpu_drm.h
Comment 5 Pavel Vinogradov 2017-05-26 19:34:42 UTC
hm, strange. do I need to build amdgpu kms as well? for simple radeon hd 4650?

(In reply to Alex Deucher from comment #4)
> (In reply to Pavel Vinogradov from comment #3)
> > drm from git doesn't provide amdgpu.h, but amdgpu_drm.h.
> 
> It provides both:
> https://cgit.freedesktop.org/mesa/drm/tree/amdgpu/amdgpu.h
> https://cgit.freedesktop.org/mesa/drm/tree/include/drm/amdgpu_drm.h
Comment 6 Alex Deucher 2017-05-26 19:50:54 UTC
(In reply to Pavel Vinogradov from comment #5)
> hm, strange. do I need to build amdgpu kms as well? for simple radeon hd
> 4650?

You don't need the amdgpu kernel driver.
Comment 7 Pavel Vinogradov 2017-05-26 20:04:05 UTC
Sorry, I meant the amdgpu kms library in drm itself.

(In reply to Alex Deucher from comment #6)
> (In reply to Pavel Vinogradov from comment #5)
> > hm, strange. do I need to build amdgpu kms as well? for simple radeon hd
> > 4650?
> 
> You don't need the amdgpu kernel driver.
Comment 8 aceman 2017-05-27 10:51:03 UTC
Thanks, fixed for me too.
Comment 9 John Dallahan 2017-05-28 13:03:43 UTC
Created attachment 131547 [details]
Complete build log
Comment 10 John Dallahan 2017-05-28 13:04:33 UTC
This bug is still occurring with the latest git. I attached the complete build log.
Comment 11 jospezial 2017-05-28 15:07:02 UTC
(In reply to Alex Deucher from comment #4)
> (In reply to Pavel Vinogradov from comment #3)
> > drm from git doesn't provide amdgpu.h, but amdgpu_drm.h.
> 
> It provides both:
> https://cgit.freedesktop.org/mesa/drm/tree/amdgpu/amdgpu.h
> https://cgit.freedesktop.org/mesa/drm/tree/include/drm/amdgpu_drm.h


libdrm only installs amdgpu.h in /usr/include/libdrm/ if it is compiled with amdgpu support.

If libdrm is compiled with radeon support only, then /usr/include/libdrm/amdgpu_drm.h is installed only.
Tested with x11-libs/libdrm-2.4.80::gentoo


The bug is introduced in
https://cgit.freedesktop.org/mesa/mesa/commit/?id=f187a493225e33c5ce514c731a0a140d61dacb0b
Comment 12 Emil Velikov 2017-05-30 13:46:48 UTC
This series [1] should address it properly although there's some contentious points around patch 2/5

[1] https://patchwork.freedesktop.org/series/24960/
Comment 13 Pavel Vinogradov 2017-05-30 16:38:37 UTC
works like a charm. thanks.

(In reply to Emil Velikov from comment #12)
> This series [1] should address it properly although there's some contentious
> points around patch 2/5
> 
> [1] https://patchwork.freedesktop.org/series/24960/
Comment 14 Emil Velikov 2017-06-02 16:39:25 UTC
For anyone wondering why patches have not been merged, yet.

Patch 2/5 neuters the partial Opencl support in r600, in an attempt to untangle the convoluted dependencies. A few people are unhappy about it (understandably so) and I've not pushed the patches so that they can resolve this better.
Comment 15 Benji Wiebe 2017-06-17 03:14:59 UTC
With this patch https://patchwork.freedesktop.org/patch/158696/ the build is broken for me now, not using radeon. Two issues: 1) when you remove amdgpu.h from ac_gpu_info.h, you need to (but didn't) add includes for stdint.h and stdbool.h. 2) I get the following error when compiling (after adding the stdint/stdbool includes):

In file included from ../../../src/amd/common/ac_gpu_info.c:37:0:
/usr/local/include/libdrm/amdgpu.h:107:31: error: conflicting types for ‘amdgpu_device_handle’
 typedef struct amdgpu_device *amdgpu_device_handle;
                               ^~~~~~~~~~~~~~~~~~~~
In file included from ../../../src/amd/common/ac_gpu_info.c:26:0:
../../../src/amd/common/ac_gpu_info.h:39:16: note: previous declaration of ‘amdgpu_device_handle’ was here
 typedef void * amdgpu_device_handle;
                ^~~~~~~~~~~~~~~~~~~~



And then a few more compiler warnings/errors that I believe tie into the above one and will be resolved when the above is resolved.
Comment 16 Pavel Vinogradov 2017-06-17 04:28:41 UTC
try current git, the patchset was applied there smoothly.

(In reply to Benji Wiebe from comment #15)
> With this patch https://patchwork.freedesktop.org/patch/158696/ the build is
> broken for me now, not using radeon. Two issues: 1) when you remove amdgpu.h
> from ac_gpu_info.h, you need to (but didn't) add includes for stdint.h and
> stdbool.h. 2) I get the following error when compiling (after adding the
> stdint/stdbool includes):
> 
> In file included from ../../../src/amd/common/ac_gpu_info.c:37:0:
> /usr/local/include/libdrm/amdgpu.h:107:31: error: conflicting types for
> ‘amdgpu_device_handle’
>  typedef struct amdgpu_device *amdgpu_device_handle;
>                                ^~~~~~~~~~~~~~~~~~~~
> In file included from ../../../src/amd/common/ac_gpu_info.c:26:0:
> ../../../src/amd/common/ac_gpu_info.h:39:16: note: previous declaration of
> ‘amdgpu_device_handle’ was here
>  typedef void * amdgpu_device_handle;
>                 ^~~~~~~~~~~~~~~~~~~~
> 
> 
> 
> And then a few more compiler warnings/errors that I believe tie into the
> above one and will be resolved when the above is resolved.
Comment 17 Benji Wiebe 2017-06-17 06:36:55 UTC
(In reply to Pavel Vinogradov from comment #16)
> try current git, the patchset was applied there smoothly.

Yes, I tried current git. I did a git bisect and it pointed to that patch I linked. I've also tried current git as of 1:30 AM CDT, still no go.
Comment 18 Benji Wiebe 2017-06-17 06:37:41 UTC
Tomorrow if you haven't gotten it figured out yet I can start up a VM and do a completely fresh build (though to the best of my knowledge this was fresh too, I deleted the build dir first).
Comment 19 Mauro Rossi 2017-06-17 06:44:45 UTC
Hi, 

with current patch "ac: remove amdgpu.h dependency" applied,
on Android (nougat-x86) I get the following building errors:

In file included from external/mesa/src/amd/common/ac_gpu_info.c:26:
external/mesa/src/amd/common/ac_gpu_info.h:41:2: error: unknown type name 'uint32_t'
        uint32_t                    pci_domain;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:42:2: error: unknown type name 'uint32_t'
        uint32_t                    pci_bus;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:43:2: error: unknown type name 'uint32_t'
        uint32_t                    pci_dev;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:44:2: error: unknown type name 'uint32_t'
        uint32_t                    pci_func;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:47:2: error: unknown type name 'uint32_t'
        uint32_t                    pci_id;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:50:2: error: unknown type name 'uint32_t'
        uint32_t                    pte_fragment_size;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:51:2: error: unknown type name 'uint32_t'
        uint32_t                    gart_page_size;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:52:2: error: unknown type name 'uint64_t'
        uint64_t                    gart_size;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:53:2: error: unknown type name 'uint64_t'
        uint64_t                    vram_size;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:54:2: error: unknown type name 'uint64_t'
        uint64_t                    vram_vis_size;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:55:2: error: unknown type name 'uint64_t'
        uint64_t                    max_alloc_size;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:56:2: error: unknown type name 'uint32_t'
        uint32_t                    min_alloc_size;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:57:2: error: unknown type name 'bool'
        bool                        has_dedicated_vram;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:58:2: error: unknown type name 'bool'
        bool                        has_virtual_memory;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:59:2: error: unknown type name 'bool'
        bool                        gfx_ib_pad_with_type2;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:60:2: error: unknown type name 'bool'
        bool                        has_hw_decode;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:61:2: error: unknown type name 'uint32_t'
        uint32_t                    num_sdma_rings;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:62:2: error: unknown type name 'uint32_t'
        uint32_t                    num_compute_rings;
        ^
external/mesa/src/amd/common/ac_gpu_info.h:63:2: error: unknown type name 'uint32_t'
        uint32_t                    uvd_fw_version;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.


The following changes are necessary in src/amd/common/ac_gpu_info.h

utente@utente-System-Product-Name:~/nougat-x86/external/mesa$ git diff
diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h
index a72ab58f9a..616a1df7fa 100644
--- a/src/amd/common/ac_gpu_info.h
+++ b/src/amd/common/ac_gpu_info.h
@@ -26,6 +26,9 @@
 #ifndef AC_GPU_INFO_H
 #define AC_GPU_INFO_H
 
+#include <stdint.h>
+#include <stdbool.h>
+
 #include "amd_family.h"
 
 #ifdef __cplusplus


Having applied that I still get the following build error:

In file included from external/mesa/src/amd/common/ac_surface.c:38:
external/libdrm/amdgpu/amdgpu.h:107:31: error: typedef redefinition with different types ('struct amdgpu_device *' vs 'void *')
typedef struct amdgpu_device *amdgpu_device_handle;
                              ^
1 error generated.


Could you please check on the latter and provide corrective patch?
I am available to test build on nougat-x86

Thanks

Mauro
Comment 20 Emil Velikov 2017-06-17 11:46:24 UTC
The issues should be resolved in master, as of

commit 1f958c1337290b4062a77f79fc101bb9f4bdf515 (origin/master, origin/HEAD)
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Fri Jun 16 19:53:50 2017 +0100

    radeonsi: include ac_binary.h for struct ac_shader_binary
    

For seemingly unrelated build issues, please file a separate report.
Comment 21 Benji Wiebe 2017-06-17 15:41:15 UTC
Yes this fixes it for me now. Thanks.


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.