One of latest libdrm commits make libdrm fails to build on 32 bit Ubuntu 16.06. Builds fine on 64 bit and newer Ubuntus. Error:
make: Entering directory '/<<BUILDDIR>>/libdrm-2.4.89+git1801270630.6f0f6c~oibaf~x/build/tests/amdgpu'
../../../tests/amdgpu/basic_tests.c: In function ‘amdgpu_userptr_test’:
../../../tests/amdgpu/basic_tests.c:1397:2: warning: ignoring return value of ‘posix_memalign’, declared with attribute warn_unused_result [-Wunused-result]
posix_memalign(&ptr, sysconf(_SC_PAGE_SIZE), BUFFER_SIZE);
In file included from ../../../amdgpu/amdgpu_internal.h:35:0,
../../../libdrm_macros.h: In function ‘drm_munmap’:
../../../libdrm_macros.h:79:4: error: size of unnamed array is negative
STATIC_ASSERT(LARGE_OFF_T % 2147483629 == 721 &&
Makefile:616: recipe for target 'amdgpu_test-vm_tests.o' failed
make: *** [amdgpu_test-vm_tests.o] Error 1
make: Leaving directory '/<<BUILDDIR>>/libdrm-2.4.89+git1801270630.6f0f6c~oibaf~x/build/tests/amdgpu'
Full build log including configure flags:
Hi, There are two different drivers, a 64 bit driver and a 32 bit driver. Please make sure you have the 32 bit one. This sounds like the 64 bit driver has been downloaded. There are different bis consumed by a 32 bit int and a 64 int and this messes with thread safety which in turn messages with signals given by the operating system.
Note I am compiling the drm source from git. The same source builds fine on newer Ubuntu. Maybe it's something broken/old in the ubuntu 16.04 toolchain?
I think you might be hitting a bug combining C++ compilers trying to compile C and autotools not being smart enough.
What happens if you try to build using Meson?
(If you've never used Meson before, Mesa has a good page describing how to use it: https://mesa3d.org/meson.html)
(In reply to Eric Engestrom from comment #3)
> I think you might be hitting a bug combining C++ compilers trying to compile
> C and autotools not being smart enough.
> What happens if you try to build using Meson?
> (If you've never used Meson before, Mesa has a good page describing how to
> use it: https://mesa3d.org/meson.html)
That's a lot of bull**** and you know it ;-) This is pre-processor stuff, where autotools or any build system doesn't care.
Issue is a missing config.h include in the C file. I'll send a patch in a moment.
The following commit should resolve it. Although we might want to consider using gcc/clang -include config.h and drop the explicit includes from the code.
Author: Emil Velikov <firstname.lastname@example.org>
Date: Mon Jan 29 14:51:31 2018 +0000
tests/amdgpu: add missing config.h include