bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-string-c++.o:(.data+0x0): undefined reference to `rpl_memchr'


From: Simon Josefsson
Subject: Re: test-string-c++.o:(.data+0x0): undefined reference to `rpl_memchr'
Date: Thu, 22 Apr 2010 08:55:56 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Hi Simon,
>
>> While debugging a 'asprintf' bug on Windows, I noticed that building the
>> 'vasprintf' module fails:
>> 
>> gnulib-tool --create-testdir --dir m --with-tests vasprintf
>> cd m
>> ./configure --host=i586-mingw32msvc --build=i686-pc-linux-gnu 
>> make
>> 
>> results in:
>> 
>> g++ -DHAVE_CONFIG_H -I.  -DGNULIB_STRICT_CHECKING=1 -I. -I. -I.. -I./.. 
>> -I../gllib -I./../gllib    -MT test-string-c++2.o -MD -MP -MF 
>> .deps/test-string-c++2.Tpo -c -o test-string-c++2.o test-string-c++2.cc
>> mv -f .deps/test-string-c++2.Tpo .deps/test-string-c++2.Po
>> g++     -o test-string-c++.exe test-string-c++.o test-string-c++2.o 
>> ../gllib/libgnu.a  
>> test-string-c++.o:(.data+0x0): undefined reference to `rpl_memchr'
>> test-string-c++.o:(.rodata+0x0): undefined reference to `rpl_memchr'
>> test-string-c++2.o:(.rodata+0x0): undefined reference to `rpl_memchr'
>> collect2: ld returned 1 exit status
>> make[4]: *** [test-string-c++.exe] Error 1
>> make[4]: Leaving directory `/home/jas/src/gnulib/m/gltests'
>
> Can you show the result of 'grep MEMCHR config.status' and the relevant
> portion of gllib/string.h ?

S["REPLACE_MEMCHR"]="1"
S["HAVE_RAWMEMCHR"]="1"
S["HAVE_MEMCHR"]="1"
S["GNULIB_RAWMEMCHR"]="0"
S["GNULIB_MEMCHR"]="1"
D["HAVE_MEMCHR"]=" 1"
D["GNULIB_TEST_MEMCHR"]=" 1"

See below for string.h contents.

Config.h contains:

/* Define to 1 when the gnulib module memchr should be tested. */
#define GNULIB_TEST_MEMCHR 1
/* Define to 1 if you have the `memchr' function. */
#define HAVE_MEMCHR 1
/* Define to 1 if rawmemchr is declared even after undefining macros. */
/* #undef HAVE_RAW_DECL_RAWMEMCHR */

> In two native mingw builds, one with default settings and one with
> gl_cv_func_memchr_works=no, I could not reproduce your problem.

My build is a cross-compile.

Thanks,
/Simon

/* Return the first instance of C within N bytes of S, or NULL.  */
#if 1
# if 1
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   define memchr rpl_memchr
#  endif
_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
                                  __attribute__ ((__pure__))
                                  _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
# else
#  if ! 1
_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
                                  __attribute__ ((__pure__))
                                  _GL_ARG_NONNULL ((1)));
#  endif
  /* On some systems, this function is defined as an overloaded function:
       extern "C" { const void * std::memchr (const void *, int, size_t); }
       extern "C++" { void * std::memchr (void *, int, size_t); }  */
_GL_CXXALIAS_SYS_CAST2 (memchr,
                        void *, (void const *__s, int __c, size_t __n),
                        void const *, (void const *__s, int __c, size_t __n));
# endif
# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
_GL_CXXALIASWARN1 (memchr, void const *,
                   (void const *__s, int __c, size_t __n));
# else
_GL_CXXALIASWARN (memchr);
# endif
#elif defined GNULIB_POSIXCHECK
# undef memchr
/* Assume memchr is always declared.  */
_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
                 "use gnulib module memchr for portability" );
#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]