Bug 71506 - indirect_glx.c:350: multiple definition of `indirect_create_context'
Summary: indirect_glx.c:350: multiple definition of `indirect_create_context'
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium blocker
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-11-11 18:21 UTC by Vinson Lee
Modified: 2013-11-19 19:02 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
nm -u src/glx/tests/*.o (18.07 KB, text/plain)
2013-11-11 21:39 UTC, Vinson Lee
Details
Patch to glx/tests to provide a stub __glXGetCurrentContext() function when $(DEFINES) are such that is not a macro (998 bytes, patch)
2013-11-12 23:28 UTC, Jon Turney
Details | Splinter Review

Description Vinson Lee 2013-11-11 18:21:36 UTC
indirect_glx.c:350: multiple definition of `indirect_create_context'

mesa: ab2da985b67704ac556da591e227b41f3a2e1419 (master)

$ ./autogen.sh --disable-dri3 --disable-xvmc --with-dri-drivers= --with-gallium-drivers=swrast
$ make check
[...]
  CXXLD    glx-test
../../../src/glx/.libs/libglx.a(indirect_glx.o): In function `indirect_create_context':
src/glx/indirect_glx.c:350: multiple definition of `indirect_create_context'
fake_glx_screen.o:src/glx/tests/fake_glx_screen.cpp:56: first defined here
Comment 1 Vinson Lee 2013-11-11 20:38:43 UTC
17c94de33baf66ad5c264b7a046394c651bc6126 is the first bad commit
commit 17c94de33baf66ad5c264b7a046394c651bc6126
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Mon Sep 10 17:11:33 2012 +0300

    mesa/dri: Add basic plumbing for GLX_ARB_robustness reset notification strategy
    
    No drivers advertise the DRI2 extension yet, so no driver should ever
    see a value other than false for notify_reset.
    
    The changes in nouveau use tabs because nouveau seems to have it's own
    indentation rules.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

:040000 040000 76b2737e9b48d9c042d4bc05020803c7328d605a dba600f5c9a4c2e147e30e60fbd5b7f286aaa17a M	src
bisect run success
Comment 2 Ian Romanick 2013-11-11 21:30:42 UTC
That is bizarre.  I always 'make check' as part of my build, and I haven't seen that failure.  There must be something different about your configure flags that allows this to happen.  Something is happening that causes src/glx/indirect_glx.o go get pulled in when linking glx-test, and it should not.

Can you attach the output of 'nm -u src/glx/tests/*.o'?
Comment 3 Vinson Lee 2013-11-11 21:39:52 UTC
Created attachment 89058 [details]
nm -u src/glx/tests/*.o
Comment 4 Ian Romanick 2013-11-11 21:51:20 UTC
Hrm... diffing that with mine doesn't show anything obvious.  How about 'nm -u src/glx/.libs/create_context.o'?  I get:

[idr@mumford-wire master-64]$ nm -u src/glx/.libs/create_context.o 
                 U __assert_fail
                 U free
                 U GetGLXScreenConfigs
                 U _GLOBAL_OFFSET_TABLE_
                 U __glXSendErrorForXcb
                 U indirect_create_context_attribs
                 U xcb_generate_id
                 U xcb_glx_create_context_attribs_arb_checked
                 U xcb_request_check
                 U XGetXCBConnection
Comment 5 Vinson Lee 2013-11-11 21:55:19 UTC
I see the same output.

$ nm -u src/glx/.libs/create_context.o
                 U __assert_fail
                 U free
                 U GetGLXScreenConfigs
                 U _GLOBAL_OFFSET_TABLE_
                 U __glXSendErrorForXcb
                 U indirect_create_context_attribs
                 U xcb_generate_id
                 U xcb_glx_create_context_attribs_arb_checked
                 U xcb_request_check
                 U XGetXCBConnection
Comment 6 Ian Romanick 2013-11-11 22:01:01 UTC
I'm really confused now. :(  You're sure that bisect is good?  There's nothing in that commit that modifies any file under src/glx.

I'm also not able to reproduce this even using your configure options.
Comment 7 Armin K 2013-11-11 22:37:12 UTC
If you revert changes to Makefile.am made by these two commits, test builds and passess fine:

http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c5330226f391a7a29b6538851090b0ef730a239

http://cgit.freedesktop.org/mesa/mesa/commit/?id=0cce5538673148ffcd7aa9479f6b88cf9a641352
Comment 8 Armin K 2013-11-11 22:48:56 UTC
Even to be more precise, (manually) reverting this commit fixes the issue, at least here:

http://cgit.freedesktop.org/mesa/mesa/commit/?id=0cce5538673148ffcd7aa9479f6b88cf9a641352

Reproducible with GCC 4.8.2 and Binutils 2.23.2.
Comment 9 Ian Romanick 2013-11-12 18:25:20 UTC
Hm... does building with --enable-glx-tls help?  I wonder if the added __glXGetCurrentContext in fake_glx_screen.cpp is to blame.
Comment 10 Armin K 2013-11-12 19:02:44 UTC
It builds for me if query_renderer_unittest.cpp is removed from list of source files without any modifications to fake_glx_screen.cpp
Comment 11 Armin K 2013-11-12 19:12:56 UTC
And indeed, using --enable-glx-tls seems to fix the build.
Comment 12 Jon Turney 2013-11-12 23:28:25 UTC
Created attachment 89110 [details] [review]
Patch to glx/tests to provide a stub __glXGetCurrentContext() function when $(DEFINES) are such that is not a macro

(In reply to comment #9)
> Hm... does building with --enable-glx-tls help?  I wonder if the added
> __glXGetCurrentContext in fake_glx_screen.cpp is to blame.

Apparently so.  Here's the relevant output doing a build with LDFLAGS=-Wl,--print-map

> Archive member included because of file (symbol)
> 
> ../../../src/glx/.libs/libglx.a(clientinfo.o)
>                               clientinfo_unittest.o (__glX_send_client_info)
> ../../../src/glx/.libs/libglx.a(create_context.o)
>                               create_context_unittest.o (glXCreateContextAttribsARB)
> ../../../src/glx/.libs/libglx.a(indirect_size.o)
>                               enum_sizes.o (__glCallLists_size)
> ../../../src/glx/.libs/libglx.a(indirect_init.o)
>                               indirect_api.o (__glXNewIndirectAPI)
> ../../../src/glx/.libs/libglx.a(query_renderer.o)
>                               query_renderer_unittest.o (glXQueryRendererIntegerMESA)
> ../../../src/glx/.libs/libglx.a(glxcurrent.o)
>                               ../../../src/glx/.libs/libglx.a(query_renderer.o) (__glXGetCurrentContext)
> ../../../src/glx/.libs/libglx.a(glxext.o)
>                               ../../../src/glx/.libs/libglx.a(glxcurrent.o) (__glXSetupForCommand)
> ../../../src/glx/.libs/libglx.a(glxconfig.o)
>                               ../../../src/glx/.libs/libglx.a(glxext.o) (glx_config_destroy_list)
> ../../../src/glx/.libs/libglx.a(glx_query.o)
>                               ../../../src/glx/.libs/libglx.a(glxext.o) (__glXQueryServerString)
> ../../../src/glx/.libs/libglx.a(glxhash.o)
>                               ../../../src/glx/.libs/libglx.a(glxext.o) (__glxHashCreate)
> ../../../src/glx/.libs/libglx.a(indirect_glx.o)
>                               ../../../src/glx/.libs/libglx.a(glxext.o) (indirect_create_screen)

So it seems that that the removal of the __glXGetCurrentContext stub in commit 8c5330226f391a7a29b6538851090b0ef730a239 "After adding $(DEFINES) to AM_CPPFLAGS, the __glXGetCurrentContext wrapper function is no longer needed and causes compile errors. Using the correct defines causes it to be a macro!" is not always correct.

Reading src/glx/glxclient.h, __glXGetCurrentContext is not a macro if HAVE_PTHREAD && !GLX_USE_TLS, so the stub should probably be provided in that case.  Patch attached.
Comment 13 Jon Turney 2013-11-19 15:29:35 UTC
To ssh://git.freedesktop.org/git/mesa/mesa
   21ae513..5ab59e5  master -> master
Comment 14 Emil Velikov 2013-11-19 19:02:29 UTC
Might be a good idea to pick this up for the 10.0 branch ?


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.