Bug 44928

Summary: i965 build error on recent git
Product: Mesa Reporter: Fabio Pedretti <pedretti.fabio>
Component: Drivers/DRI/i965Assignee: Eric Anholt <eric>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: medium CC: daniel, jfonseca, kai, kibi, marchesin, mattst88, mesa-dev
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: patch
patch2

Description Fabio Pedretti 2012-01-19 01:26:37 UTC
Build fails with:

*** Warning: Linking the executable i965_symbols_test against the loadable module
*** i965_dri.so is not portable!
/usr/bin/ld: warning: libdricore.so, needed by ./.libs/i965_dri.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libglsl.so, needed by ./.libs/i965_dri.so, not found (try using -rpath or -rpath-link)
./.libs/i965_dri.so: undefined reference to `ralloc_context'
./.libs/i965_dri.so: undefined reference to `_mesa_update_framebuffer'
./.libs/i965_dri.so: undefined reference to `_mesa_lookup_renderbuffer
...

Full log available here:
https://launchpadlibrarian.net/90422055/buildlog_ubuntu-oneiric-i386.mesa_8.0~git1201190957.32b07b~gd~o_FAILEDTOBUILD.txt.gz
Comment 1 Jose Fonseca 2012-01-23 03:59:10 UTC
FWIW, our build bots are failing to build i965:

$ ./autogen.sh --prefix=/usr --enable-gles1 --enable-gles2 --enable-openvg --enable-xorg --enable-xa --disable-glut --enable-gallium-egl --enable-gallium-llvm --with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast
$ make -j2
[...]
  CCLD   i965_symbols_test

*** Warning: Linking the executable i965_symbols_test against the loadable module
*** i965_dri.so is not portable!
./.libs/i965_dri.so: undefined reference to `ir_print_visitor::ir_print_visitor()'
./.libs/i965_dri.so: undefined reference to `ir_variable::determine_interpolation_mode(bool)'
./.libs/i965_dri.so: undefined reference to `_mesa_meta_glsl_Clear'
./.libs/i965_dri.so: undefined reference to `_mesa_get_srgb_format_linear'
./.libs/i965_dri.so: undefined reference to `count_tessellated_primitives'
./.libs/i965_dri.so: undefined reference to `_mesa_reference_renderbuffer_'
./.libs/i965_dri.so: undefined reference to `_mesa_accum'
./.libs/i965_dri.so: undefined reference to `_mesa_override_glsl_version'
./.libs/i965_dri.so: undefined reference to `_mesa_associate_uniform_storage'
./.libs/i965_dri.so: undefined reference to `_swrast_add_soft_renderbuffers'
./.libs/i965_dri.so: undefined reference to `_mesa_generate_parameters_list_for_uniforms'
./.libs/i965_dri.so: undefined reference to `hash_table_call_foreach'
./.libs/i965_dri.so: undefined reference to `do_set_program_inouts(exec_list*, gl_program*, bool)'
./.libs/i965_dri.so: undefined reference to `ra_add_transitive_reg_conflict'
./.libs/i965_dri.so: undefined reference to `_mesa_meta_begin'
./.libs/i965_dri.so: undefined reference to `do_common_optimization(exec_list*, bool, bool, unsigned int)'
./.libs/i965_dri.so: undefined reference to `glsl_type::get_scalar_type() const'
./.libs/i965_dri.so: undefined reference to `vbo_get_minmax_indices'
./.libs/i965_dri.so: undefined reference to `_swrast_set_renderbuffer_accessors'
/usr/lib/dri/libdricore.so: undefined reference to `_glapi_tls_Context'
./.libs/i965_dri.so: undefined reference to `_swrast_render_texture'
./.libs/i965_dri.so: undefined reference to `vbo_bind_arrays'
./.libs/i965_dri.so: undefined reference to `_mesa_meta_in_progress'
./.libs/i965_dri.so: undefined reference to `_mesa_image_offset'
./.libs/i965_dri.so: undefined reference to `_mesa_reference_framebuffer_'
./.libs/i965_dri.so: undefined reference to `_mesa_readpixels'
./.libs/i965_dri.so: undefined reference to `_mesa_reference_program_'
./.libs/i965_dri.so: undefined reference to `_mesa_meta_end'
./.libs/i965_dri.so: undefined reference to `visit_list_elements(ir_hierarchical_visitor*, exec_list*, bool)'
/usr/lib/dri/libdricore.so: undefined reference to `_glapi_tls_Dispatch'
collect2: ld returned 1 exit status
make[5]: *** [i965_symbols_test] Error 1
make[5]: Leaving directory `/var/lib/hudson/jobs/mesa-ubuntu64-make/workspace/src/mesa/drivers/dri/i965'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/var/lib/hudson/jobs/mesa-ubuntu64-make/workspace/src/mesa/drivers/dri'
make[3]: *** [default] Error 1
make[3]: Leaving directory `/var/lib/hudson/jobs/mesa-ubuntu64-make/workspace/src/mesa/drivers'
make[2]: *** [driver_subdirs] Error 2
make[2]: Leaving directory `/var/lib/hudson/jobs/mesa-ubuntu64-make/workspace/src/mesa'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/var/lib/hudson/jobs/mesa-ubuntu64-make/workspace/src'
make: *** [default] Error 1
Comment 2 Matt Turner 2012-01-23 09:54:52 UTC
A couple of people on IRC mentioned this problem, and Cyril Brulebois and I tried to get to the bottom of it with Daniel Vetter (who has the problem).

It looked to me like DRICORE_LIB_DEPS and DRI_LIB_DEPS weren't being set properly, since danvet's log was missing -L../../../../../../ (or whatever) before -ldricore.
Comment 3 Daniel Vetter 2012-01-23 10:58:38 UTC
Ok, let's add some fine details about my system here: Generally debian unstable, x86_65, the only thing installed in /usr/local is libdrm (I've triple-checked for any .so and .pc files).

Versions:
libtool: 2.4.2-1
autoconf: 2.68
automake: 1.11.2
Comment 4 Stephane Marchesin 2012-01-23 18:30:54 UTC
Same here, on ubuntu 11.10.
Comment 5 Matt Turner 2012-01-23 19:25:22 UTC
I'm curious, do you get this build failure after e326480e4ebe8687948041c2dc5f5b7595559a2e (the i965/automake patch) or after one of the later patches which cause dricore and glapi to always be shared, ie adefee50d or 2b3a8cbc?
Comment 6 Caleb Callaway 2012-01-23 22:11:08 UTC
On my development system (Ubuntu 11.10 64-bit), this issue appears in commit 2b3a8cbc
Comment 7 Matt Turner 2012-01-23 22:21:38 UTC
(In reply to comment #6)
> On my development system (Ubuntu 11.10 64-bit), this issue appears in commit
> 2b3a8cbc

Thanks. Does building commit e326480e with --enable-shared-dricore result in the same failure?
Comment 8 Caleb Callaway 2012-01-23 23:03:26 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > On my development system (Ubuntu 11.10 64-bit), this issue appears in commit
> > 2b3a8cbc
> 
> Thanks. Does building commit e326480e with --enable-shared-dricore result in
> the same failure?

Yes, same failure commit e326480e with --enable-shared-dricore. In case it helps, here's how I'm calling autogen.sh:

./autogen.sh --prefix=$WLD --enable-gles2 --disable-gallium-egl --with-egl-platforms=x11,wayland,drm --enable-gbm --enable-64-bit --enable-shared-glapi --enable-shared-dricore
Comment 9 Matt Turner 2012-01-24 12:48:04 UTC
Created attachment 56111 [details] [review]
patch

The attached patch fixes the problem (I've gotten confirmation from 2 people) but I didn't really understand why. In writing this, I think I see why now --

Linking with i965_dri.la (which contains a list of libraries i965_dri.so is linked against) should have i965_symbols_test linked with those libraries too. In i965_dri.la we have

# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''

# Libraries that this one depends upon.
dependency_libs=' -L../../../../../lib -ldricore -lexpat -lpthread -ldl -lglsl -ldrm_intel -ldrm -lxcb-dri2'

Since it's trying to link with -ldricore -lglsl but not being able to find them, I have to think that -L../../../../../lib shouldn't be in dependency_libs but rather in inherited_linker_flags.

If someone wants to `make i965_dri.la`, move the -L flag to inherited_linker_flags and then run `make i965_symbols_test` to confirm my theory, I'd appreciate it.

All this is probably moot thought. Eric suggested killing the symbols test.
Comment 10 Matt Turner 2012-01-24 14:01:46 UTC
Created attachment 56112 [details] [review]
patch2

maybe a better fix... if it works.
Comment 11 Caleb Callaway 2012-01-24 22:39:26 UTC
First patch works for me...the second patch doesn't :/
Comment 12 Eric Anholt 2012-01-26 16:18:29 UTC
commit c88503944234421ecb617001aad305ff3b1b83d2
Author: Eric Anholt <eric@anholt.net>
Date:   Thu Jan 26 16:11:12 2012 -0800

    i965: Drop the missing symbols link test.
    
    This was horribly broken and has cost everyone more time than we were
    ever going to save using it.  It might have been fixable, but the
    problem it was originally trying to solve can be better solved with
    -Werror=missing-prototypes and -Werror=implicit-function-declaration.
    
    Also, it was always producing a big scary warning about how the link
    test was non-portable.
    
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44928

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.