Bug 68780 - built-in-constants.c:188: undefined reference to `strndup'
Summary: built-in-constants.c:188: undefined reference to `strndup'
Alias: None
Product: piglit
Classification: Unclassified
Component: infrastructure (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium blocker
Assignee: Ian Romanick
QA Contact: Eric Anholt
Keywords: regression
Depends on:
Reported: 2013-08-31 07:20 UTC by Vinson Lee
Modified: 2013-09-18 05:37 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Description Vinson Lee 2013-08-31 07:20:04 UTC
piglit: 6e6b1752ec018caa7566b2eb88530155179b53fd (master)

MinGW and MSVC builds are broken because they do not have strndup.

Linking CXX executable ../../../../bin/built-in-constants.exe
/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/built-in-constants.dir/objects.a -Wl,--no-whole-archive  -o ../../../../bin/built-in-constants.exe -Wl,--out-implib,libbuilt-in-constants.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 
CMakeFiles/built-in-constants.dir/objects.a(built-in-constants.c.obj): In function `parse_file':
tests/shaders/built-in-constants.c:188: undefined reference to `strndup'

commit 4c617fa70f7ee1bd6cfa818a0f3d1d994ea9e7ab
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Mon Aug 26 09:57:22 2013 -0700

    glsl: Enhance built-in-constants to test extensions too
    v2: Use an array of pointers to char for required_extensions (using
    strndup) instead of the previous static buffer cleverness.  Also replace
    the previous cleverness for generating the GLSL extension enables with
    something less clever and easier to understand.  Both suggested by Eric.
    v3: Decallocated the extension strings in the non-error case.  There are
    still some PIGLIT_SKIP cases that could leak, but meh.  Noticed by Topi.
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
Comment 1 Ian Romanick 2013-09-05 17:46:21 UTC
Patch sent to the piglit mailing list:

Comment 2 Vinson Lee 2013-09-18 05:37:42 UTC
commit 4777d6e74ec2509d6b64dc374f00abd6d98e722b
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Sep 5 10:43:56 2013 -0700

    util: Add an implementation of strndup
    Commit 4c617fa7 added a use of strndup, and that broke this build with
    various Windows compilers that don't support strndup.
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68780
    Tested-by: Vinson Lee <vlee@freedesktop.org>
    Reviewed-by: Ken Phillis Jr. <kphillisjr@gmail.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.