Bug 73999 - mesa 32bit build fails with llvm enabled (cross compilation)
Summary: mesa 32bit build fails with llvm enabled (cross compilation)
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-23 23:09 UTC by Luzipher
Modified: 2014-01-26 04:55 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
build.log of the 32bit build (1.16 MB, text/plain)
2014-01-23 23:09 UTC, Luzipher
Details
emerge -pqv mesa (397 bytes, text/plain)
2014-01-23 23:10 UTC, Luzipher
Details
emerge --info (5.59 KB, text/plain)
2014-01-23 23:11 UTC, Luzipher
Details
messages produced by compilers while running configure (132.36 KB, text/plain)
2014-01-23 23:12 UTC, Luzipher
Details

Description Luzipher 2014-01-23 23:09:05 UTC
Created attachment 92693 [details]
build.log of the 32bit build

Problem
================
When cross-compiling mesa, the 32bit build of mesa fails for me if I enable LLVM, while 64bit works. Without LLVM both build passes work.

I'm not entirely sure that it is a Mesa problem (though I think it is), but I'd be happy for any pointers how to fix this issue since I don't have any idea where to start. I need to enable LLVM as my new r9 290x need the radeonsi driver, which in turn needs LLVM.


System Specs
================
OS: Gentoo (multilib-portage)
LLVM from git (x86 and x64 builds)
Kernel: 3.13-rc7
GCC: 4.8.2
Mesa driver: radeonsi
ebuild: media-libs/mesa-9999 from x11 overlay


Configure Line
================
./configure --prefix=/usr --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib32 --disable-silent-rules --disable-dependency-tracking --enable-dri --enable-glx --enable-shared-glapi --enable-texture-float --disable-debug --enable-egl --enable-gbm --enable-gles1 --enable-gles2 --enable-glx-tls --disable-osmesa --enable-asm --without-llvm-shared-libs --with-dri-drivers= --with-gallium-drivers=,swrast,r600,radeonsi PYTHON2=/usr/bin/python2.7 --with-egl-platforms=x11,drm --enable-gallium-llvm --disable-openvg --disable-gallium-egl --enable-r600-llvm-compiler --enable-vdpau --disable-xa --disable-xvmc LLVM_CONFIG=/usr/bin/llvm-config.x86


Tail of build.log (for details see attachements)
================
libtool: compile:  x86_64-pc-linux-gnu-gcc -m32 -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"10.1.0-devel\" "-DPACKAGE_STRING=\"Mesa 10.1.0-devel\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"10.1.0-devel\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD=1 -I. -I../../../src/gallium/auxiliary/util -I../../../include -I../../../src/gallium/include -I../../../src/gallium/auxiliary -D_GNU_SOURCE -DHAVE_PTHREAD -DTEXTURE_FLOAT_ENABLED -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1 -DHAVE_ALIAS -DHAVE_DRI3 -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_LLVM=0x0 -fvisibility=hidden -march=native -O2 -pipe -m32 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -c draw/draw_pt_fetch_shade_pipeline_llvm.c  -fPIC -DPIC -o draw/.libs/draw_pt_fetch_shade_pipeline_llvm.o
In file included from /usr/include/llvm-c/Core.h:18:0,
                 from ./gallivm/lp_bld.h:49,
                 from ./gallivm/lp_bld_sample.h:41,
                 from draw/draw_llvm.h:36,
                 from draw/draw_llvm.c:28:
/usr/include/llvm/Support/DataTypes.h:52:3: error: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
 # error "Must #define __STDC_CONSTANT_MACROS before " \
   ^
In file included from /usr/include/llvm-c/Core.h:18:0,
                 from ./gallivm/lp_bld.h:49,
                 from ./gallivm/lp_bld_sample.h:41,
                 from ./draw/draw_llvm.h:36,
                 from draw/draw_pt_fetch_shade_pipeline_llvm.c:38:
/usr/include/llvm/Support/DataTypes.h:52:3: error: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
 # error "Must #define __STDC_CONSTANT_MACROS before " \
   ^
In file included from /usr/include/llvm-c/Core.h:18:0,
                 from ./gallivm/lp_bld.h:49,
                 from ./gallivm/lp_bld_const.h:41,
                 from draw/draw_llvm_sample.c:35:
/usr/include/llvm/Support/DataTypes.h:52:3: error: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
 # error "Must #define __STDC_CONSTANT_MACROS before " \
   ^
libtool: compile:  x86_64-pc-linux-gnu-g++ -m32 -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"10.1.0-devel\" "-DPACKAGE_STRING=\"Mesa 10.1.0-devel\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"10.1.0-devel\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD=1 -I. -fvisibility=hidden -I../../../include -I../../../src/gallium/include -I../../../src/gallium/auxiliary -D_GNU_SOURCE -DHAVE_PTHREAD -DTEXTURE_FLOAT_ENABLED -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1 -DHAVE_ALIAS -DHAVE_DRI3 -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_LLVM=0x0 -march=native -O2 -pipe -m32 -Wall -fno-strict-aliasing -fno-builtin-memcmp -c gallivm/lp_bld_misc.cpp  -fPIC -DPIC -o gallivm/.libs/lp_bld_misc.o
draw/draw_llvm.c: In function 'create_jit_dvbuffer_type':
draw/draw_llvm.c:101:4: error: implicit declaration of function 'LLVMAddTypeName' [-Werror=implicit-function-declaration]
    LLVMAddTypeName(gallivm->module, struct_name, dvbuffer_type);
    ^
draw/draw_llvm.c:106:4: error: implicit declaration of function 'LLVMInvalidateStructLayout' [-Werror=implicit-function-declaration]
    LLVMInvalidateStructLayout(gallivm->target, dvbuffer_type);
    ^
Makefile:1707: recipe for target 'draw/draw_pt_fetch_shade_pipeline_llvm.lo' failed
gmake[3]: *** [draw/draw_pt_fetch_shade_pipeline_llvm.lo] Error 1
gmake[3]: *** Waiting for unfinished jobs....
libtool: compile:  x86_64-pc-linux-gnu-g++ -m32 -DPACKAGE_NAME=\"Mesa\" -DPACKAGE_TARNAME=\"mesa\" -DPACKAGE_VERSION=\"10.1.0-devel\" "-DPACKAGE_STRING=\"Mesa 10.1.0-devel\"" "-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\"" -DPACKAGE_URL=\"\" -DPACKAGE=\"mesa\" -DVERSION=\"10.1.0-devel\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DYYTEXT_POINTER=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_PTHREAD=1 -I. -fvisibility=hidden -I../../../include -I../../../src/gallium/include -I../../../src/gallium/auxiliary -D_GNU_SOURCE -DHAVE_PTHREAD -DTEXTURE_FLOAT_ENABLED -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DHAVE_DLOPEN -DHAVE_POSIX_MEMALIGN -DHAVE_LIBDRM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1 -DHAVE_ALIAS -DHAVE_DRI3 -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_LLVM=0x0 -march=native -O2 -pipe -m32 -Wall -fno-strict-aliasing -fno-builtin-memcmp -c gallivm/lp_bld_debug.cpp  -fPIC -DPIC -o gallivm/.libs/lp_bld_debug.o
In file included from /usr/include/llvm-c/Core.h:18:0,
                 from ./gallivm/lp_bld.h:49,
                 from ./gallivm/lp_bld_sample.h:41,
                 from draw/draw_llvm.h:36,
                 from draw/draw_vs_llvm.c:36:
/usr/include/llvm/Support/DataTypes.h:52:3: error: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
 # error "Must #define __STDC_CONSTANT_MACROS before " \
   ^
cc1: some warnings being treated as errors
Makefile:1707: recipe for target 'draw/draw_llvm.lo' failed
gmake[3]: *** [draw/draw_llvm.lo] Error 1
draw/draw_vs_llvm.c:84:1: error: no previous prototype for 'draw_create_vs_llvm' [-Werror=missing-prototypes]
 draw_create_vs_llvm(struct draw_context *draw,
 ^
cc1: some warnings being treated as errors
In file included from /usr/include/llvm-c/Core.h:18:0,
                 from gallivm/lp_bld_debug.cpp:30:
/usr/include/llvm/Support/DataTypes.h:48:3: error: #error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
 # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
   ^
Makefile:1707: recipe for target 'draw/draw_vs_llvm.lo' failed
gmake[3]: *** [draw/draw_vs_llvm.lo] Error 1
/usr/include/llvm/Support/DataTypes.h:52:3: error: #error "Must #define __STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
 # error "Must #define __STDC_CONSTANT_MACROS before " \
   ^
Makefile:1707: recipe for target 'draw/draw_llvm_sample.lo' failed
gmake[3]: *** [draw/draw_llvm_sample.lo] Error 1
gallivm/lp_bld_misc.cpp:67:38: fatal error: llvm/Target/TargetSelect.h: No such file or directory
 #include <llvm/Target/TargetSelect.h>
                                      ^
compilation terminated.
gallivm/lp_bld_debug.cpp:40:40: fatal error: llvm/Target/TargetRegistry.h: No such file or directory
 #include <llvm/Target/TargetRegistry.h>
                                        ^
compilation terminated.
Makefile:1731: recipe for target 'gallivm/lp_bld_misc.lo' failed
gmake[3]: *** [gallivm/lp_bld_misc.lo] Error 1
Makefile:1731: recipe for target 'gallivm/lp_bld_debug.lo' failed
gmake[3]: *** [gallivm/lp_bld_debug.lo] Error 1
gmake[3]: Leaving directory '/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999-x86/src/gallium/auxiliary'
Makefile:1760: recipe for target 'all-recursive' failed
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory '/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999-x86/src/gallium/auxiliary'
Makefile:533: recipe for target 'all-recursive' failed
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory '/var/tmp/portage/media-libs/mesa-9999/work/Mesa-9999-x86/src'
Makefile:584: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
Comment 1 Luzipher 2014-01-23 23:10:18 UTC
Created attachment 92694 [details]
emerge -pqv mesa
Comment 2 Luzipher 2014-01-23 23:11:09 UTC
Created attachment 92695 [details]
emerge --info
Comment 3 Luzipher 2014-01-23 23:12:14 UTC
Created attachment 92696 [details]
messages produced by compilers while running configure
Comment 4 Michel Dänzer 2014-01-24 04:03:22 UTC
Works for me with

 --with-llvm-prefix=<path to 32-bit LLVM prefix>

instead of

 LLVM_CONFIG=<...>
Comment 5 Luzipher 2014-01-26 01:30:36 UTC
First, thanks for looking at this !

I'm unable to build without the LLVM_CONFIG set. If I remove it, the build doesn't find LLVM during the configure phase (message ist something along the line "LLVM > 3.3 needed"). You wrote "instead", so I tried to omit it, but does LLVM_CONFIG really break the build ?

What exactly do you mean with "<path to 32-bit LLVM prefix>" ? I tried the following paths, all with the same result as described above:
/usr/lib32
/usr/local
/usr/include
/usr/include/gentoo-multilib/x86
/usr/include/gentoo-multilib/x86/llvm

And do you build with "llvm-shared-libs" enabled ? I don't - if I try, configure fails with "llvm-config.x86 not found".
Comment 6 Luzipher 2014-01-26 04:55:36 UTC
After writing the last comment, I thought about the error message I got when trying to build with "llvm-shared-libs" enabled. There is indeed no /usr/bin/llvm-config.x86 on my system, but there is a /usr/bin/i686-pc-linux-gnu-llvm-config-x86 executable. It turns out that there is a simple workaround:

    cd /usr/bin
    ln -s i686-pc-linux-gnu-llvm-config-x86 llvm-config.x86

With that symbolic link, Mesa builds for amd64 as well as x86 (with llvm-shared-libs enabled).

So this seems to be a gentoo / multilib-portage problem with either correctly installing llvm or setting up the Mesa build environment. I'm going to alert the gentoo devs to this.


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.