Bug 72556

Summary: tests/util/piglit-util.c:69: multiple definition of `asprintf'
Product: piglit Reporter: Vinson Lee <vlee>
Component: testsAssignee: Eric Anholt <eric>
Status: RESOLVED FIXED QA Contact: Eric Anholt <eric>
Severity: blocker    
Priority: medium CC: anuj.phogat, brianp, jfonseca, stereotype441
Version: unspecifiedKeywords: regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2013-12-10 06:55:18 UTC
piglit: e88a4a4c202b80785091b64c13b99dddd5679457 (master)

$ mingw64-cmake .
$ make
[...]
Linking CXX executable ../../../../../../bin/arb_sample_shading-builtin-gl-sample-mask.exe
cd target_api/gl/tests/spec/arb_sample_shading/execution && /usr/bin/cmake -E cmake_link_script CMakeFiles/arb_sample_shading-builtin-gl-sample-mask.dir/link.txt --verbose=1
/usr/bin/cmake -E remove -f CMakeFiles/arb_sample_shading-builtin-gl-sample-mask.dir/objects.a
/usr/bin/x86_64-w64-mingw32-ar cr CMakeFiles/arb_sample_shading-builtin-gl-sample-mask.dir/objects.a @CMakeFiles/arb_sample_shading-builtin-gl-sample-mask.dir/objects1.rsp
/usr/bin/x86_64-w64-mingw32-g++   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -Wall -Wno-narrowing -g    -static-libgcc -static-libstdc++ -Wl,--whole-archive CMakeFiles/arb_sample_shading-builtin-gl-sample-mask.dir/objects.a -Wl,--no-whole-archive  -o ../../../../../../bin/arb_sample_shading-builtin-gl-sample-mask.exe -Wl,--out-implib,libarb_sample_shading-builtin-gl-sample-mask.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lglut ../../../util/libpiglitutil_gl.a -lopengl32 -lglu32 -lglut ../../../../../no_api/tests/util/libpiglitutil.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 
../../../../../no_api/tests/util/libpiglitutil.a(piglit-util.c.obj): In function `asprintf':
tests/util/piglit-util.c:69: multiple definition of `asprintf'
CMakeFiles/arb_sample_shading-builtin-gl-sample-mask.dir/objects.a(builtin-gl-sample-mask.cpp.obj):/usr/x86_64-w64-mingw32/sys-root/mingw/include/stdio.h:203: first defined here


commit 995104c02baebd7e26fdc6545b836af7ddb65c15
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Thu Oct 10 17:17:31 2013 -0700

    ARB_sample_shading: Add test to verify the functionality of gl_SampleMask[]
    
    V2: Get rid of redundant projection matrix.
    V3: Draw to a multisample texture and use it later to verify
        the expected color of each sample.
        Use piglit_draw_rect() and get rid of redundant code.
        Use piglit_vertex in vertex shader.
        Use piglit_link_simple_program().
    
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Paul Berry <stereotype441@gmail.com>
Comment 1 Brian Paul 2013-12-12 16:00:42 UTC
Evidently, the C++ lib's asprintf() is clashing with Piglit's implementation in piglit-util.c

But we're not seeing this with our in-house build of piglit on mingw64.

Any ideas, Jose?

Vinson, could you try something like this in piglit_util.c and see what happens:

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 1c7f118..0ff54ac 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -56,7 +56,7 @@
 #include "piglit-util.h"
 
 
-#if defined(_WIN32)
+#if defined(_WIN32) && !defined(__MINGW32__)
 
 /* Some versions of MinGW are missing _vscprintf's declaration, although they
  * still provide the symbol in the import library.
Comment 2 Vinson Lee 2013-12-12 23:34:49 UTC
The patch in comment #1 fixes the build on Fedora.
Comment 3 Vinson Lee 2013-12-31 07:37:42 UTC
commit 52bce82ddb8fc4b2dce95af0908abf4054591b77
Author: Vinson Lee <vlee@freedesktop.org>
Date:   Sat Dec 21 13:22:23 2013 -0800

    cmake: Check for asprintf.
    
    Newer versions of MinGW provide asprintf in stdio.h. Do not define
    asprintf if it already exists.
    
    This patch fixes the Fedora 20 MinGW build.
    
    Signed-off-by: Vinson Lee <vlee@freedesktop.org>
    Tested-by: Brian Paul <brianp@vmware.com>

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.