Bug 104558 - Building Vulkan Radeon driver fails
Summary: Building Vulkan Radeon driver fails
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/radeon (show other bugs)
Version: 17.3
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-09 15:18 UTC by Paul Menzel
Modified: 2018-01-16 17:09 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Output of `./configure …` (23.90 KB, text/plain)
2018-01-11 15:29 UTC, Paul Menzel
Details

Description Paul Menzel 2018-01-09 15:18:17 UTC
Configuring Mesa with the line below – only Radeon Vulkan driver selected – the build fails.

```
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/autogen.sh --prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --sysconfdir=/etc --sharedstatedir=/var --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --datarootdir=/usr/share --datadir=/usr/share --infodir=/usr/share/info --localedir=/usr/share/locale --mandir=/usr/share/man --docdir=/usr/share/doc/mesalib --exec-prefix=/usr --enable-texture-float --enable-gles1 --enable-gles2 --enable-osmesa --enable-xa --enable-glx-tls --with-platforms=drm,x11,wayland --with-gallium-drivers=nouveau,r600,radeonsi,svga,swrast --with-vulkan-drivers=radeon
[…]
checking if module mako in python is installed... No module named mako
no
[…]
```

```
make[4]: Entering directory '/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/build/src/amd/vulkan'
  CXXLD    libvulkan_radeon.la
../../../src/amd/common/.libs/libamd_common.a(common_libamd_common_la-ac_llvm_helper.o): In function `ac_is_sgpr_param':
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:61: undefined reference to `llvm::Argument::getArgNo() const'
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:62: undefined reference to `llvm::AttributeSet::hasAttribute(unsigned int, llvm::Attribute::AttrKind) const'
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:63: undefined reference to `llvm::AttributeSet::hasAttribute(unsigned int, llvm::Attribute::AttrKind) const'
../../../src/amd/common/.libs/libamd_common.a(common_libamd_common_la-ac_llvm_helper.o): In function `ac_llvm_is_function':
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:78: undefined reference to `LLVMGetValueKind'
../../../src/amd/common/.libs/libamd_common.a(common_libamd_common_la-ac_llvm_helper.o): In function `ac_add_attr_dereferenceable':
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:50: undefined reference to `llvm::AttrBuilder::addDereferenceableAttr(unsigned long)'
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:51: undefined reference to `llvm::Argument::getArgNo() const'
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:51: undefined reference to `llvm::Value::getContext() const'
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:51: undefined reference to `llvm::AttributeSet::get(llvm::LLVMContext&, unsigned int, llvm::AttrBuilder const&)'
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:51: undefined reference to `llvm::Argument::addAttr(llvm::AttributeSet)'
../../../src/amd/common/.libs/libamd_common.a(common_libamd_common_la-ac_llvm_helper.o): In function `ac_llvm_get_called_value':
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/common/ac_llvm_helper.cpp:69: undefined reference to `LLVMGetCalledValue'
./.libs/libvulkan_common.a(radv_device.o): In function `disk_cache_get_function_timestamp':
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/util/disk_cache.h:89: undefined reference to `LLVMInitializeAMDGPUTargetInfo'
./.libs/libvulkan_common.a(radv_shader.o): In function `shader_variant_create':
/dev/shm/bee-root/mesalib/mesalib-17.3.1-0/source/src/amd/vulkan/radv_shader.c:459: undefined reference to `LLVMDisposeTargetMachine'
[…]
```

It could be related to missing Mako templates for Python [1].

[1] https://bugs.freedesktop.org/show_bug.cgi?id=104551
Comment 1 Bas Nieuwenhuizen 2018-01-09 16:58:37 UTC
This looks like it fails to link with LLVM. What LLVM version do you have installed?

Furthermore, could you attach the full output of configure and the failing command with make V=1 ?
Comment 2 Paul Menzel 2018-01-11 15:22:44 UTC
(In reply to Bas Nieuwenhuizen from comment #1)
> This looks like it fails to link with LLVM. What LLVM version do you have
> installed?

I have LLVM 4.0.0 installed built with `-DLLVM_BUILD_LLVM_DYLIB=ON` from Linux from Scratch [1].

> builds libraries as static and links all of them into an unique shared one. This is the recommended way of building a shared library.

> Furthermore, could you attach the full output of configure and the failing
> command with make V=1 ?

```
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtbeginS.o  -Wl,--whole-archive ./.libs/libvulkan_common.a ../../../src/vulkan/.libs/libvulkan_util.a ../../../src/vulkan/.libs/libvulkan_wsi.a ../../../src/amd/common/.libs/libamd_common.a ../../../src/amd/addrlib/.libs/libamdgpu_addrlib.a ../../../src/compiler/nir/.libs/libnir.a ../../../src/util/.libs/libmesautil.a -Wl,--no-whole-archive  -L/usr/lib -lz -lelf -ldrm_amdgpu -ldrm -lpthread -ldl -lX11-xcb -lX11 -lxcb -lxcb-dri3 -lxcb-xfixes -lxcb-present -lxcb-sync -lxshmfence -lwayland-client -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0 -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtendS.o /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib64/crtn.o  -O2 -Wl,-Bsymbolic -Wl,--gc-sections -Wl,--no-undefined -pthread -pthread   -pthread -Wl,-soname -Wl,libvulkan_radeon.so -o .libs/libvulkan_radeon.so
```

[1] http://www.linuxfromscratch.org/blfs/view/8.1/general/llvm.html
Comment 3 Paul Menzel 2018-01-11 15:29:15 UTC
Created attachment 136663 [details]
Output of `./configure …`

The errors below are shown.

```
[…]
llvm-config: error: missing: /usr/lib/libLLVMDemangle.so
llvm-config: error: missing: /usr/lib/libLLVMSupport.so
llvm-config: error: missing: /usr/lib/libLLVMCore.so
llvm-config: error: missing: /usr/lib/libLLVMMC.so
llvm-config: error: missing: /usr/lib/libLLVMAMDGPUUtils.so
llvm-config: error: missing: /usr/lib/libLLVMAMDGPUAsmPrinter.so
llvm-config: error: missing: /usr/lib/libLLVMAMDGPUInfo.so
llvm-config: error: missing: /usr/lib/libLLVMAMDGPUDesc.so
llvm-config: error: missing: /usr/lib/libLLVMMCParser.so
llvm-config: error: missing: /usr/lib/libLLVMAMDGPUAsmParser.so
llvm-config: error: missing: /usr/lib/libLLVMProfileData.so
llvm-config: error: missing: /usr/lib/libLLVMBitReader.so
llvm-config: error: missing: /usr/lib/libLLVMObject.so
llvm-config: error: missing: /usr/lib/libLLVMAnalysis.so
llvm-config: error: missing: /usr/lib/libLLVMBitWriter.so
llvm-config: error: missing: /usr/lib/libLLVMTransformUtils.so
llvm-config: error: missing: /usr/lib/libLLVMInstCombine.so
llvm-config: error: missing: /usr/lib/libLLVMScalarOpts.so
llvm-config: error: missing: /usr/lib/libLLVMTarget.so
llvm-config: error: missing: /usr/lib/libLLVMCodeGen.so
llvm-config: error: missing: /usr/lib/libLLVMDebugInfoMSF.so
llvm-config: error: missing: /usr/lib/libLLVMDebugInfoCodeView.so
llvm-config: error: missing: /usr/lib/libLLVMAsmPrinter.so
llvm-config: error: missing: /usr/lib/libLLVMAsmParser.so
llvm-config: error: missing: /usr/lib/libLLVMIRReader.so
llvm-config: error: missing: /usr/lib/libLLVMLinker.so
llvm-config: error: missing: /usr/lib/libLLVMVectorize.so
llvm-config: error: missing: /usr/lib/libLLVMInstrumentation.so
llvm-config: error: missing: /usr/lib/libLLVMipo.so
llvm-config: error: missing: /usr/lib/libLLVMSelectionDAG.so
llvm-config: error: missing: /usr/lib/libLLVMAMDGPUCodeGen.so
llvm-config: error: missing: /usr/lib/libLLVMMCDisassembler.so
llvm-config: error: missing: /usr/lib/libLLVMAMDGPUDisassembler.so
llvm-config: error: missing: /usr/lib/libLLVMRuntimeDyld.so
llvm-config: error: missing: /usr/lib/libLLVMExecutionEngine.so
llvm-config: error: missing: /usr/lib/libLLVMMCJIT.so
llvm-config: error: missing: /usr/lib/libLLVMX86Utils.so
llvm-config: error: missing: /usr/lib/libLLVMX86AsmPrinter.so
llvm-config: error: missing: /usr/lib/libLLVMX86Info.so
llvm-config: error: missing: /usr/lib/libLLVMX86Desc.so
llvm-config: error: missing: /usr/lib/libLLVMGlobalISel.so
llvm-config: error: missing: /usr/lib/libLLVMX86CodeGen.so
llvm-config: error: missing: /usr/lib/libLLVMX86AsmParser.so
llvm-config: error: missing: /usr/lib/libLLVMX86Disassembler.so
[…]
```
Comment 4 Michel Dänzer 2018-01-11 15:38:24 UTC
(In reply to Paul Menzel from comment #2)
> I have LLVM 4.0.0 installed built with `-DLLVM_BUILD_LLVM_DYLIB=ON` from
> Linux from Scratch [1].

Does adding -DLLVM_LINK_LLVM_DYLIB=ON for the LLVM build, then re-running Mesa's configure against the resulting llvm-config help?

Also make sure BUILD_SHARED_LIBS isn't enabled for the LLVM build.
Comment 5 Paul Menzel 2018-01-11 22:25:24 UTC
(In reply to Michel Dänzer from comment #4)
> (In reply to Paul Menzel from comment #2)
> > I have LLVM 4.0.0 installed built with `-DLLVM_BUILD_LLVM_DYLIB=ON` from
> > Linux from Scratch [1].
> 
> Does adding -DLLVM_LINK_LLVM_DYLIB=ON for the LLVM build, then re-running
> Mesa's configure against the resulting llvm-config help?

Yes, that helped. Could the configure script be updated to check against the desired LLVM configuration, that means for example, abort if llvm-config returns the errors?

> Also make sure BUILD_SHARED_LIBS isn't enabled for the LLVM build.

Yes, that was disabled all along.
Comment 6 Emil Velikov 2018-01-16 17:09:05 UTC
Sounds like the following LLVM bug https://bugs.llvm.org/show_bug.cgi?id=34977

Paul if you want to be a rock star, you can send a patch to the LLVM devs ;-)


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.