Package: coreutils;
Reported by: Assaf Gordon <assafgordon <at> gmail.com>
Date: Fri, 18 Jan 2013 22:34:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13495 in the body.
You can then email your comments to 13495 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Fri, 18 Jan 2013 22:34:02 GMT) Full text and rfc822 format available.Assaf Gordon <assafgordon <at> gmail.com>
:bug-coreutils <at> gnu.org
.
(Fri, 18 Jan 2013 22:34:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: bug-coreutils <at> gnu.org Subject: Compilation fails on Mac OS X 10.8.0 Date: Fri, 18 Jan 2013 17:32:47 -0500
Hello, Trying to compile the latest coreutils on Mac OS X, I get the following compilation error: $ ./configure [ works OK ] $ make [ ... ] CC lib/stpncpy.o lib/stpncpy.c:34: error: expected declaration specifiers or '...' before numeric constant lib/stpncpy.c:34: error: expected ')' before '!=' token lib/stpncpy.c:34: error: expected ')' before '?' token make[2]: *** [lib/stpncpy.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 This happens with the released version 8.20, and also with "8.20.90-e27bfd" (I had to git-pull on another machine and do "make dist" to generate it). The compiler is (From Apple's Xcode-452-command-line-tools package): $ clang --version Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) Target: x86_64-apple-darwin10.8.0 Thread model: posix The OS is: $ uname -a Darwin minimacc.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 I can provide more details if needed. Regards, -gordon
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Fri, 18 Jan 2013 22:47:01 GMT) Full text and rfc822 format available.Message #8 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Fri, 18 Jan 2013 17:45:30 -0500
More information: Assaf Gordon wrote, On 01/18/2013 05:32 PM: > Hello, > > Trying to compile the latest coreutils on Mac OS X, I get the following compilation error: > > $ ./configure > [ works OK ] > $ make > [ ... ] > CC lib/stpncpy.o > lib/stpncpy.c:34: error: expected declaration specifiers or '...' before numeric constant > lib/stpncpy.c:34: error: expected ')' before '!=' token > lib/stpncpy.c:34: error: expected ')' before '?' token > make[2]: *** [lib/stpncpy.o] Error 1 > make[1]: *** [all-recursive] Error 1 > make: *** [all] Error 2 > > This happens with the released version 8.20, and also with "8.20.90-e27bfd" (I had to git-pull on another machine and do "make dist" to generate it). > -1- I was wrong, the compiler was not "clang" - based on "config.log", it was GCC (or some gcc/llvm hybrid?) : === relevant fragment from config.log === configure:4681: checking for gcc configure:4697: found /usr/bin/gcc configure:4708: result: gcc configure:4937: checking for C compiler version configure:4946: gcc --version >&5 i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. configure:4957: $? = 0 configure:4946: gcc -v >&5 Using built-in specs. Target: i686-apple-darwin11 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) configure:4957: $? = 0 configure:4946: gcc -V >&5 llvm-gcc-4.2: argument to `-V' is missing configure:4957: $? = 1 configure:4946: gcc -qversion >&5 i686-apple-darwin11-llvm-gcc-4.2: no input files === -2- Trying to use clang, I get other errors (still in stpncpy.c): $ ./configure CC=clang [ works OK ] $ make [ ... ] CC lib/stpncpy.o lib/stpncpy.c:34:1: error: expected parameter declarator __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:110:5: note: expanded from macro 'stpncpy' ((__darwin_obsz0 (dest) != (size_t) -1) \ ^ /usr/include/secure/_common.h:38:63: note: expanded from macro '__darwin_obsz0' #define __darwin_obsz0(object) __builtin_object_size (object, 0) ^ lib/stpncpy.c:34:1: error: expected ')' __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:110:5: note: expanded from macro 'stpncpy' ((__darwin_obsz0 (dest) != (size_t) -1) \ ^ /usr/include/secure/_common.h:38:63: note: expanded from macro '__darwin_obsz0' #define __darwin_obsz0(object) __builtin_object_size (object, 0) ^ lib/stpncpy.c:34:1: note: to match this '(' __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:110:5: note: expanded from macro 'stpncpy' ((__darwin_obsz0 (dest) != (size_t) -1) \ ^ /usr/include/secure/_common.h:38:54: note: expanded from macro '__darwin_obsz0' #define __darwin_obsz0(object) __builtin_object_size (object, 0) ^ lib/stpncpy.c:34:1: error: expected ')' __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:110:27: note: expanded from macro 'stpncpy' ((__darwin_obsz0 (dest) != (size_t) -1) \ ^ lib/stpncpy.c:34:1: note: to match this '(' __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:110:4: note: expanded from macro 'stpncpy' ((__darwin_obsz0 (dest) != (size_t) -1) \ ^ lib/stpncpy.c:34:1: error: expected ')' __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:111:4: note: expanded from macro 'stpncpy' ? __builtin___stpncpy_chk (dest, src, len, __darwin_obsz (dest)) \ ^ lib/stpncpy.c:34:1: note: to match this '(' __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:110:3: note: expanded from macro 'stpncpy' ((__darwin_obsz0 (dest) != (size_t) -1) \ ^ lib/stpncpy.c:34:1: error: conflicting types for '__builtin_object_size' __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:110:5: note: expanded from macro 'stpncpy' ((__darwin_obsz0 (dest) != (size_t) -1) \ ^ /usr/include/secure/_common.h:38:32: note: expanded from macro '__darwin_obsz0' #define __darwin_obsz0(object) __builtin_object_size (object, 0) ^ /usr/include/secure/_string.h:61:56: note: '__builtin_object_size' is a builtin with type 'unsigned long (const void *, int)' return __builtin___memcpy_chk (__dest, __src, __len, __darwin_obsz0(__dest)); ^ /usr/include/secure/_common.h:38:32: note: expanded from macro '__darwin_obsz0' #define __darwin_obsz0(object) __builtin_object_size (object, 0) ^ lib/stpncpy.c:34:1: error: definition of builtin function '__builtin_object_size' __stpncpy (char *dest, const char *src, size_t n) ^ lib/stpncpy.c:28:20: note: expanded from macro '__stpncpy' # define __stpncpy stpncpy ^ /usr/include/secure/_string.h:110:5: note: expanded from macro 'stpncpy' ((__darwin_obsz0 (dest) != (size_t) -1) \ ^ /usr/include/secure/_common.h:38:32: note: expanded from macro '__darwin_obsz0' #define __darwin_obsz0(object) __builtin_object_size (object, 0) ^ lib/stpncpy.c:39:7: error: use of undeclared identifier 'n' if (n >= 4) ^ lib/stpncpy.c:41:19: error: use of undeclared identifier 'n' size_t n4 = n >> 2; ^ lib/stpncpy.c:45:16: error: use of undeclared identifier 'src' c = *src++; ^ lib/stpncpy.c:49:16: error: use of undeclared identifier 'src' c = *src++; ^ lib/stpncpy.c:53:16: error: use of undeclared identifier 'src' c = *src++; ^ lib/stpncpy.c:57:16: error: use of undeclared identifier 'src' c = *src++; ^ lib/stpncpy.c:64:7: error: use of undeclared identifier 'n' n -= dest - s; ^ lib/stpncpy.c:69:3: error: use of undeclared identifier 'n' n &= 3; ^ lib/stpncpy.c:70:7: error: use of undeclared identifier 'n' if (n == 0) ^ lib/stpncpy.c:75:12: error: use of undeclared identifier 'src' c = *src++; ^ lib/stpncpy.c:76:9: error: use of undeclared identifier 'n' --n; ^ lib/stpncpy.c:80:11: error: use of undeclared identifier 'n' if (n == 0) ^ lib/stpncpy.c:85:10: error: use of undeclared identifier 'n' while (n-- > 0) ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make[2]: *** [lib/stpncpy.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Sat, 19 Jan 2013 01:00:01 GMT) Full text and rfc822 format available.Message #11 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Assaf Gordon <assafgordon <at> gmail.com> Cc: 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Fri, 18 Jan 2013 16:58:44 -0800
I'm puzzled as to why stpncpy.c is being compiled at all. Doesn't OS X have stpncpy? I would look in config.log and try to figure out why 'configure' thinks stpncpy is missing.
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Sun, 20 Jan 2013 02:54:02 GMT) Full text and rfc822 format available.Message #14 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Sat, 19 Jan 2013 22:02:22 -0500
On 01/18/13 19:58, Paul Eggert wrote: > I'm puzzled as to why stpncpy.c is being compiled at all. > Doesn't OS X have stpncpy? I would look in config.log > and try to figure out why 'configure' thinks stpncpy is > missing. This seems like the relevant part from 'config.log' (but more info below): === configure:8522: result: no configure:8522: checking for sigaction configure:8522: clang -o conftest -g -O2 conftest.c >&5 configure:8522: $? = 0 configure:8522: result: yes configure:8522: checking for sigaltstack configure:8522: clang -o conftest -g -O2 conftest.c >&5 configure:8522: $? = 0 configure:8522: result: yes configure:8522: checking for siginterrupt configure:8522: clang -o conftest -g -O2 conftest.c >&5 configure:8522: $? = 0 configure:8522: result: yes configure:8522: checking for snprintf configure:8522: clang -o conftest -g -O2 conftest.c >&5 conftest.c:144:6: warning: incompatible redeclaration of library function 'snprintf' char snprintf (); ^ conftest.c:144:6: note: 'snprintf' is a builtin with type 'int (char *, unsigned long, const char *, ...)' 1 warning generated. configure:8522: $? = 0 configure:8522: result: yes configure:8522: checking for stpncpy configure:8522: clang -o conftest -g -O2 conftest.c >&5 conftest.c:145:6: warning: incompatible redeclaration of library function 'stpncpy' char stpncpy (); ^ conftest.c:145:6: note: 'stpncpy' is a builtin with type 'char *(char *, const char *, unsigned long)' 1 warning generated. Undefined symbols for architecture x86_64: "_stpncpy", referenced from: _main in conftest-eAtTGu.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) configure:8522: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "GNU coreutils" | #define PACKAGE_TARNAME "coreutils" | #define PACKAGE_VERSION "8.20.90-e27bfd" | #define PACKAGE_STRING "GNU coreutils 8.20.90-e27bfd" | #define PACKAGE_BUGREPORT "bug-coreutils <at> gnu.org" | #define PACKAGE_URL "http://www.gnu.org/software/coreutils/" | #define PACKAGE "coreutils" | #define VERSION "8.20.90-e27bfd" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define __EXTENSIONS__ 1 | #define _ALL_SOURCE 1 | #define _DARWIN_C_SOURCE 1 | #define _GNU_SOURCE 1 | #define _POSIX_PTHREAD_SEMANTICS 1 | #define _TANDEM_SOURCE 1 | #define HAVE_FSEEKO 1 | #define HAVE_ALLOCA_H 1 | #define HAVE_ALLOCA 1 | #define HAVE_ARPA_INET_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_SYS_PARAM_H 1 | #define HAVE_SYS_SOCKET_H 1 | #define HAVE_DIRENT_H 1 | #define HAVE_WCTYPE_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_NETDB_H 1 | #define HAVE_NETINET_IN_H 1 | #define HAVE_GETOPT_H 1 | #define HAVE_TERMIOS_H 1 | #define HAVE_SYS_TIME_H 1 | #define HAVE_GRP_H 1 | #define HAVE_ICONV_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_LANGINFO_H 1 | #define HAVE_XLOCALE_H 1 | #define HAVE_MATH_H 1 | #define HAVE_SYS_MMAN_H 1 | #define HAVE_SYS_STATVFS_H 1 | #define HAVE_SYS_SELECT_H 1 | #define HAVE_PTHREAD_H 1 | #define HAVE_UTMP_H 1 | #define HAVE_UTMPX_H 1 | #define HAVE_SCHED_H 1 | #define HAVE_SPAWN_H 1 | #define HAVE_SYS_IOCTL_H 1 | #define HAVE_SYS_RESOURCE_H 1 | #define HAVE_SYS_UIO_H 1 | #define HAVE_SYS_UTSNAME_H 1 | #define HAVE_SYS_WAIT_H 1 | #define HAVE_UTIME_H 1 | #define HAVE_PATHS_H 1 | #define HAVE_SYSLOG_H 1 | #define HAVE_PWD_H 1 | #define D_INO_IN_DIRENT 1 | #define HAVE_LONG_FILE_NAMES 1 | #define HAVE_PATHCONF 1 | #define HAVE_BTOWC 1 | #define HAVE_REALPATH 1 | #define HAVE_CHOWN 1 | #define HAVE_FCHOWN 1 | #define HAVE_FCHDIR 1 | #define HAVE_LCHMOD 1 | #define HAVE_FCNTL 1 | #define HAVE_SYMLINK 1 | #define HAVE_ISBLANK 1 | #define HAVE_ISWCTYPE 1 | #define HAVE_MBSRTOWCS 1 | #define HAVE_WMEMCHR 1 | #define HAVE_WMEMCPY 1 | #define HAVE_FPURGE 1 | #define HAVE_ALARM 1 | #define HAVE_FSYNC 1 | #define HAVE_STRTOF 1 | #define HAVE_FTRUNCATE 1 | #define HAVE_FSTATFS 1 | #define HAVE_GETDTABLESIZE 1 | #define HAVE_GETLOGIN 1 | #define HAVE_FLOCKFILE 1 | #define HAVE_FUNLOCKFILE 1 | #define HAVE_TCGETATTR 1 | #define HAVE_TCSETATTR 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_GETUSERSHELL 1 | #define HAVE_ISWCNTRL 1 | #define HAVE_ISWBLANK 1 | #define HAVE_LINK 1 | #define HAVE_READLINK 1 | #define HAVE_LSTAT 1 | #define HAVE_MBSINIT 1 | #define HAVE_MBRTOWC 1 | #define HAVE_MBRLEN 1 | #define HAVE_ISASCII 1 | #define HAVE_MPROTECT 1 | #define HAVE_GETGROUPLIST 1 | #define HAVE_FCHMOD 1 | #define HAVE_MKFIFO 1 | #define HAVE_MKNOD 1 | #define HAVE_MKSTEMP 1 | #define HAVE_NL_LANGINFO 1 | #define HAVE_POSIX_SPAWN 1 | #define HAVE_UTMPXNAME 1 | #define HAVE_WCSCOLL 1 | #define HAVE_SETENV 1 | #define HAVE_SETTIMEOFDAY 1 | #define HAVE_SIGACTION 1 | #define HAVE_SIGALTSTACK 1 | #define HAVE_SIGINTERRUPT 1 | #define HAVE_SNPRINTF 1 | /* end confdefs.h. */ | /* Define stpncpy to an innocuous variant, in case <limits.h> declares stpncpy. | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | #define stpncpy innocuous_stpncpy | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char stpncpy (); below. | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | <limits.h> exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include <limits.h> | #else | # include <assert.h> | #endif | | #undef stpncpy | | /* Override any GCC internal prototype to avoid an error. | Use char because int might match the return type of a GCC | builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern "C" | #endif | char stpncpy (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined __stub_stpncpy || defined __stub___stpncpy | choke me | #endif | | int | main () | { | return stpncpy (); | ; | return 0; | } configure:8522: result: no configure:8522: checking for strdup configure:8522: clang -o conftest -g -O2 conftest.c >&5 conftest.c:145:6: warning: incompatible redeclaration of library function 'strdup' char strdup (); ^ conftest.c:145:6: note: 'strdup' is a builtin with type 'char *(const char *)' === I tried compiling a simple test program: === $ cat test.c #include <string.h> int main () { char a[10]; stpncpy (a,"a",10); return 0; } $ clang -o test test.c Undefined symbols for architecture x86_64: "___stpncpy_chk", referenced from: _main in test-GyRBLi.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) === And it might be related to the following: http://gcc.gnu.org/ml/gcc-patches/2011-11/msg02470.html Trying macro expansion gives: === $ clang -E test.c | grep -A 4 -B 4 stpncpy char *strdup(const char *); void *memccpy(void *, const void *, int, size_t); # 140 "/usr/include/string.h" 3 4 char *stpcpy(char *, const char *); char *stpncpy(char *, const char *, size_t) __attribute__((availability(macosx,introduced=10.7))); char *strndup(const char *, size_t) __attribute__((availability(macosx,introduced=10.7))); size_t strnlen(const char *, size_t) __attribute__((availability(macosx,introduced=10.7))); char *strsignal(int sig); # 155 "/usr/include/string.h" 3 4 -- static __inline char * __inline_stpncpy_chk (char *restrict __dest, const char *restrict __src, size_t __len) { return __builtin___stpncpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 2 > 1)); } -- # 2 "test.c" 2 int main () { char a[10]; ((__builtin_object_size (a, 0) != (size_t) -1) ? __builtin___stpncpy_chk (a, "a", 10, __builtin_object_size (a, 2 > 1)) : __inline_stpncpy_chk (a, "a", 10)); return 0; } === So if I understand correctly, this is the cause: 1. string.h does have "stpncpy", as a macro/inline 2. linking programs with stpncpy fails, leading "configure" to think there's no "stpncpy" 3. 'string.h' is #include'd, but so is gnulib's stpncpy.c 4.the GNULIB definition of 'stpncpy' conflicts with the 'string.h' definition.
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Sun, 20 Jan 2013 03:33:02 GMT) Full text and rfc822 format available.Message #17 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Assaf Gordon <assafgordon <at> gmail.com> Cc: 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Sat, 19 Jan 2013 19:31:50 -0800
On 01/19/2013 07:02 PM, Assaf Gordon wrote: > So if I understand correctly, this is the cause: > 1. string.h does have "stpncpy", as a macro/inline > 2. linking programs with stpncpy fails, leading "configure" to think there's no "stpncpy" OK, so far so good. 'configure' is correct: stpncpy is busted on that platform. > 3. 'string.h' is #include'd, but so is gnulib's stpncpy.c But shouldn't the compiler be including the gnulib string.h? And doesn't gnulib's string.h contain something that looks like this? /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ #if 1 # if 1 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef stpncpy # define stpncpy rpl_stpncpy # endif This should #undef the system's <string.h> stpncpy, which is busted, and substitute gnulib's good one. We need to figure out why that isn't working. Could you please try this: ./configure make clean make V=1 I'm interested in the last (failing) command executed by the last 'make'. Suppose it is like this: gcc -std=gnu99 -I. -I./lib -Ilib ... -o lib/stpncpy.o lib/stpncpy.c Please send the relevant part of the preprocessed output for that command, i.e., the output of gcc -E -std=gnu99 -I. -I./lib -Ilib ... lib/stpncpy.c where the "..." contains all the -I options that ar relevant to the preprocessor. I'm interested in any part of that output that has anything to do with stpncpy. Thanks.
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Sun, 20 Jan 2013 03:58:01 GMT) Full text and rfc822 format available.Message #20 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Sat, 19 Jan 2013 23:07:07 -0500
[Message part 1 (text/plain, inline)]
On 01/19/13 22:31, Paul Eggert wrote: > > Could you please try this: > > ./configure > make clean > make V=1 > > I'm interested in the last (failing) command executed by the last 'make'. > Suppose it is like this: > > gcc -std=gnu99 -I. -I./lib -Ilib ... -o lib/stpncpy.o lib/stpncpy.c > > Please send the relevant part of the preprocessed output for that command, > i.e., the output of > > gcc -E -std=gnu99 -I. -I./lib -Ilib ... lib/stpncpy.c > The failed command was: === depbase=`echo lib/stpncpy.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'` ; \ gcc -std=gnu99 -I. -I./lib -Ilib -I./lib -Isrc -I./src -g -O2 -MT lib/stpncpy.o -MD -MP -MF $depbase.Tpo -c -o lib/stpncpy.o lib/stpncpy.c === Attached is the output of: === gcc -E -std=gnu99 -I. -I./lib -Ilib -I./lib -Isrc -I./src -g -O2 -MT lib/stpncpy.o -MD -MP -MF lib/.deps/stpncpy.Tpo lib/stpncpy.c > stnpcpy.E.txt === I don't know exactly why, but it seems the definition of "stpncpy" is replaced From: === char * __stpncpy (char *dest, const char *src, size_t n) { char c; char *s = dest; === To: === char * ((__builtin_object_size (char *dest, 0) != (size_t) -1) ? __builtin___stpncpy_chk (char *dest, const char *src, size_t n, __builtin_object_size (char *dest, 2 > 1)) : __inline_stpncpy_chk (char *dest, const char *src, size_t n)) { char c; char *s = dest; === Which looks like some macro expansion, but I couldn't find the declaration of this macro. -gordon
[stpncpy.E.txt (text/plain, attachment)]
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Sun, 20 Jan 2013 05:17:02 GMT) Full text and rfc822 format available.Message #23 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Assaf Gordon <assafgordon <at> gmail.com> Cc: 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Sat, 19 Jan 2013 21:15:19 -0800
On 01/19/2013 08:07 PM, Assaf Gordon wrote: > Which looks like some macro expansion, but I couldn't find the declaration of this macro. It's because stpncpy.c earlier has this: # define __stpncpy stpncpy which means that this: char * __stpncpy (char *dest, const char *src, size_t n) { expands to this: char * stpncpy (char *dest, const char *src, size_t n) { which in turn is expanded by the stpncpy macro in the system string.h, to this: char * ((__builtin_object_size (char *dest, 0) != (size_t) -1) ? __builtin___stpncpy_chk (char *dest, const char *src, size_t n, __builtin_object_size (char *dest, 2 > 1)) : __inline_stpncpy_chk (char *dest, const char *src, size_t n)) { which is obviously bogus. Does something like the following patch fix things for you? diff --git a/lib/stpncpy.c b/lib/stpncpy.c index 466cd5f..8b14fb9 100644 --- a/lib/stpncpy.c +++ b/lib/stpncpy.c @@ -31,7 +31,7 @@ /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ char * -__stpncpy (char *dest, const char *src, size_t n) +(__stpncpy) (char *dest, const char *src, size_t n) { char c; char *s = dest;
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Mon, 21 Jan 2013 19:31:02 GMT) Full text and rfc822 format available.Message #26 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Mon, 21 Jan 2013 14:39:40 -0500
On 01/20/13 00:15, Paul Eggert wrote: > On 01/19/2013 08:07 PM, Assaf Gordon wrote: >> Which looks like some macro expansion, but I couldn't find the declaration of this macro. > > Does something like the following patch fix things for you? > > diff --git a/lib/stpncpy.c b/lib/stpncpy.c > index 466cd5f..8b14fb9 100644 > --- a/lib/stpncpy.c > +++ b/lib/stpncpy.c > @@ -31,7 +31,7 @@ > /* Copy no more than N bytes of SRC to DST, returning a pointer past the > last non-NUL byte written into DST. */ > char * > -__stpncpy (char *dest, const char *src, size_t n) > +(__stpncpy) (char *dest, const char *src, size_t n) > { > char c; > char *s = dest; > Yes. This fixes the problem. Compilation succeeds with both gcc and clang. Thank you! -gordon
Paul Eggert <eggert <at> cs.ucla.edu>
:Assaf Gordon <assafgordon <at> gmail.com>
:Message #31 received at 13495-done <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Assaf Gordon <assafgordon <at> gmail.com> Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 13495-done <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Mon, 21 Jan 2013 22:20:15 -0800
On 01/21/2013 11:39 AM, Assaf Gordon wrote: > This fixes the problem. Compilation succeeds with both gcc and clang. Thanks for checking. I pushed the following patch into gnulib and am marking this coreutils bug as done. --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-01-21 Paul Eggert <eggert <at> cs.ucla.edu> + + stpncpy: port to OS X 10.8 + * lib/stpncpy.c (__stpncpy): Parenthesize name when defining function. + Problem reported by Assaf Gordon in <http://bugs.gnu.org/13495>. + 2013-01-16 Paul Eggert <eggert <at> cs.ucla.edu> unistd: port to recent mingw diff --git a/lib/stpncpy.c b/lib/stpncpy.c index 466cd5f..8b14fb9 100644 --- a/lib/stpncpy.c +++ b/lib/stpncpy.c @@ -31,7 +31,7 @@ /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ char * -__stpncpy (char *dest, const char *src, size_t n) +(__stpncpy) (char *dest, const char *src, size_t n) { char c; char *s = dest; -- 1.7.11.7
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Thu, 24 Jan 2013 21:08:01 GMT) Full text and rfc822 format available.Message #34 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Thu, 24 Jan 2013 16:07:33 -0500
Paul Eggert wrote, On 01/22/2013 01:20 AM: > On 01/21/2013 11:39 AM, Assaf Gordon wrote: >> This fixes the problem. Compilation succeeds with both gcc and clang. > > Thanks for checking. I pushed the following patch into gnulib > and am marking this coreutils bug as done. > Just a follow-up, not necessarily a gnulib/coreutils bug: compiling using defaults works: ./configure make or ./configure CC=clang make But adding "CFLAGS=-g -O0" to ease debugging results in unresolved symbol "___stpncpy_chk": $ CFLAGS="-g -O0" ./configure $ make [ ... snip ... ] CCLD src/dircolors Undefined symbols for architecture x86_64: "___stpncpy_chk", referenced from: _make_link_name in ls.o ___inline_stpncpy_chk in ls.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make[2]: *** [src/dir] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 (This is not a show-stopper for me, so I'm not waiting for a solution). -Gordon
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Thu, 24 Jan 2013 21:39:02 GMT) Full text and rfc822 format available.Message #37 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Assaf Gordon <assafgordon <at> gmail.com> Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Thu, 24 Jan 2013 13:38:16 -0800
On 01/24/13 13:07, Assaf Gordon wrote: > $ CFLAGS="-g -O0" ./configure Isn't it better to use this? ./configure CFLAGS="-g -O0" If that works, it solves your problem. Otherwise: > $ make > [ ... snip ... ] > CCLD src/dircolors > Undefined symbols for architecture x86_64: > "___stpncpy_chk", referenced from: This is the broken stpncpy implementation on OS X. But why isn't 'configure' catching that? What is the value of HAVE_STPNCPY? It should not be 1. config.log should tell you why it has the wrong value.
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Fri, 25 Jan 2013 19:27:02 GMT) Full text and rfc822 format available.Message #40 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Fri, 25 Jan 2013 14:25:57 -0500
Paul Eggert wrote, On 01/24/2013 04:38 PM: > On 01/24/13 13:07, Assaf Gordon wrote: >> $ CFLAGS="-g -O0" ./configure > > Isn't it better to use this? > > ./configure CFLAGS="-g -O0" > > If that works, it solves your problem. No, doesn't work - same linking error. > Otherwise: > >> $ make >> [ ... snip ... ] >> CCLD src/dircolors >> Undefined symbols for architecture x86_64: >> "___stpncpy_chk", referenced from: > > This is the broken stpncpy implementation on OS X. > But why isn't 'configure' catching that? > What is the value of HAVE_STPNCPY? It should > not be 1. config.log should tell you why it has > the wrong value. I found the following: 1. "config.log" has one check for "stpncpy" the fails: === configure:8522: checking for stpncpy configure:8522: gcc -std=gnu99 -o conftest -g -O0 conftest.c >&5 conftest.c:145: warning: conflicting types for built-in function 'stpncpy' Undefined symbols for architecture x86_64: "_stpncpy", referenced from: _main in ccBRWint.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status configure:8522: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "GNU coreutils" | #define PACKAGE_TARNAME "coreutils" | #define PACKAGE_VERSION "8.20.90-e27bfd" | #define PACKAGE_STRING "GNU coreutils 8.20.90-e27bfd" | #define PACKAGE_BUGREPORT "bug-coreutils <at> gnu.org" | #define PACKAGE_URL "http://www.gnu.org/software/coreutils/" | #define PACKAGE "coreutils" | #define VERSION "8.20.90-e27bfd" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define __EXTENSIONS__ 1 | #define _ALL_SOURCE 1 | #define _DARWIN_C_SOURCE 1 | #define _GNU_SOURCE 1 | #define _POSIX_PTHREAD_SEMANTICS 1 | #define _TANDEM_SOURCE 1 | #define HAVE_FSEEKO 1 | #define HAVE_ALLOCA_H 1 | #define HAVE_ALLOCA 1 | #define HAVE_ARPA_INET_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_SYS_PARAM_H 1 | #define HAVE_SYS_SOCKET_H 1 | #define HAVE_DIRENT_H 1 | #define HAVE_WCTYPE_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_NETDB_H 1 | #define HAVE_NETINET_IN_H 1 | #define HAVE_GETOPT_H 1 | #define HAVE_TERMIOS_H 1 | #define HAVE_SYS_TIME_H 1 | #define HAVE_GRP_H 1 | #define HAVE_ICONV_H 1 | #define HAVE_WCHAR_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_LANGINFO_H 1 | #define HAVE_XLOCALE_H 1 | #define HAVE_MATH_H 1 | #define HAVE_SYS_MMAN_H 1 | #define HAVE_SYS_STATVFS_H 1 | #define HAVE_SYS_SELECT_H 1 | #define HAVE_PTHREAD_H 1 | #define HAVE_UTMP_H 1 | #define HAVE_UTMPX_H 1 | #define HAVE_SCHED_H 1 | #define HAVE_SPAWN_H 1 | #define HAVE_SYS_IOCTL_H 1 | #define HAVE_SYS_RESOURCE_H 1 | #define HAVE_SYS_UIO_H 1 | #define HAVE_SYS_UTSNAME_H 1 | #define HAVE_SYS_WAIT_H 1 | #define HAVE_UTIME_H 1 | #define HAVE_PATHS_H 1 | #define HAVE_SYSLOG_H 1 | #define HAVE_PWD_H 1 | #define D_INO_IN_DIRENT 1 | #define HAVE_LONG_FILE_NAMES 1 | #define HAVE_PATHCONF 1 | #define HAVE_BTOWC 1 | #define HAVE_REALPATH 1 | #define HAVE_CHOWN 1 | #define HAVE_FCHOWN 1 | #define HAVE_FCHDIR 1 | #define HAVE_LCHMOD 1 | #define HAVE_FCNTL 1 | #define HAVE_SYMLINK 1 | #define HAVE_ISBLANK 1 | #define HAVE_ISWCTYPE 1 | #define HAVE_MBSRTOWCS 1 | #define HAVE_WMEMCHR 1 | #define HAVE_WMEMCPY 1 | #define HAVE_FPURGE 1 | #define HAVE_ALARM 1 | #define HAVE_FSYNC 1 | #define HAVE_STRTOF 1 | #define HAVE_FTRUNCATE 1 | #define HAVE_FSTATFS 1 | #define HAVE_GETDTABLESIZE 1 | #define HAVE_GETLOGIN 1 | #define HAVE_FLOCKFILE 1 | #define HAVE_FUNLOCKFILE 1 | #define HAVE_TCGETATTR 1 | #define HAVE_TCSETATTR 1 | #define HAVE_GETTIMEOFDAY 1 | #define HAVE_GETUSERSHELL 1 | #define HAVE_ISWCNTRL 1 | #define HAVE_ISWBLANK 1 | #define HAVE_LINK 1 | #define HAVE_READLINK 1 | #define HAVE_LSTAT 1 | #define HAVE_MBSINIT 1 | #define HAVE_MBRTOWC 1 | #define HAVE_MBRLEN 1 | #define HAVE_ISASCII 1 | #define HAVE_MPROTECT 1 | #define HAVE_GETGROUPLIST 1 | #define HAVE_FCHMOD 1 | #define HAVE_MKFIFO 1 | #define HAVE_MKNOD 1 | #define HAVE_MKSTEMP 1 | #define HAVE_NL_LANGINFO 1 | #define HAVE_POSIX_SPAWN 1 | #define HAVE_UTMPXNAME 1 | #define HAVE_WCSCOLL 1 | #define HAVE_SETENV 1 | #define HAVE_SETTIMEOFDAY 1 | #define HAVE_SIGACTION 1 | #define HAVE_SIGALTSTACK 1 | #define HAVE_SIGINTERRUPT 1 | #define HAVE_SNPRINTF 1 | /* end confdefs.h. */ | /* Define stpncpy to an innocuous variant, in case <limits.h> declares stpncpy. | For example, HP-UX 11i <limits.h> declares gettimeofday. */ | #define stpncpy innocuous_stpncpy | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char stpncpy (); below. | Prefer <limits.h> to <assert.h> if __STDC__ is defined, since | <limits.h> exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include <limits.h> | #else | # include <assert.h> | #endif | | #undef stpncpy | | /* Override any GCC internal prototype to avoid an error. | Use char because int might match the return type of a GCC | builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern "C" | #endif | char stpncpy (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined __stub_stpncpy || defined __stub___stpncpy | choke me | #endif | | int | main () | { | return stpncpy (); | ; | return 0; | } configure:8522: result: no === 2. "config.log" has another check for the declaration of "stpncpy" that succeeds: === configure:21404: checking whether stpncpy is declared configure:21404: gcc -std=gnu99 -c -g -O0 conftest.c >&5 configure:21404: $? = 0 configure:21404: result: yes === 3. "lib/config.h" then have the followings (after "configure"): === /* Define to 1 when the gnulib module stpncpy should be tested. */ #define GNULIB_TEST_STPNCPY 1 /* Define to 1 if you have the declaration of `stpncpy', and to 0 if you don't. */ #define HAVE_DECL_STPNCPY 1 /* Define if you have the stpncpy() function and it works. */ /* #undef HAVE_STPNCPY */ === 4. The declaration of "stpncpy" in /usr/include/secure/_string.h is messy: === #define stpncpy(dest, src, len) \ ((__darwin_obsz0 (dest) != (size_t) -1) \ ? __builtin___stpncpy_chk (dest, src, len, __darwin_obsz (dest)) \ : __inline_stpncpy_chk (dest, src, len)) static __inline char * __inline_stpncpy_chk (char *__restrict __dest, const char *__restrict __src, size_t __len) { return __builtin___stpncpy_chk (__dest, __src, __len, __darwin_obsz(__dest)); } === So I'm guessing that even though gnulib's stpncpy code is used, because the MacOS's native declaration of stpncpy is included, it causes problems when the macro is expanded to use "__stpncpy_chk".
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Fri, 25 Jan 2013 20:09:02 GMT) Full text and rfc822 format available.Message #43 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Fri, 25 Jan 2013 15:08:42 -0500
An ugly work-around: "-O1" seems to overcome the messy macro expansion of stpncpy. So either compile everything with CFLAGS="-g -O1", Or compile everything with "-g -O0" until it fails, then compile two problematic objects with "-O1" and continue, Or just compile the program of interest and ignore the rest. Not ideal, but since my goal was to debug "rm", it suffices. A better solution could be to modify the code and override the definition of stpncpy (but I'm not meddling with gnulib). For completeness, the following works: $ ./configure CFLAGS="-g -O0" $ make ## will fail with unresolved "__strpncpy_chk" # Compile two objects with "-O1" $ rm -f src/ls.o src/src_ginstall-install.o $ make CFLAGS="-g -O1" src/ls.o src/src_ginstall-install.o # Compile the rest with "-O0" $ make
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Fri, 25 Jan 2013 22:19:02 GMT) Full text and rfc822 format available.Message #46 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Assaf Gordon <assafgordon <at> gmail.com> Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Fri, 25 Jan 2013 14:18:20 -0800
On 01/25/2013 11:25 AM, Assaf Gordon wrote: > So I'm guessing that even though gnulib's stpncpy code is used, > because the MacOS's native declaration of stpncpy is included, it > causes problems when the macro is expanded to use "__stpncpy_chk". Does the following patch fix things for you? It attempts to change the substitute string.h to inhibit that macro expansion. diff --git a/lib/string.in.h b/lib/string.in.h index 6223cce..b8d6a33 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -262,11 +262,13 @@ _GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ #if @GNULIB_STPNCPY@ -# if @REPLACE_STPNCPY@ +# if @REPLACE_STPNCPY@ || (!@HAVE_STPNCPY@ && defined stpncpy) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef stpncpy # define stpncpy rpl_stpncpy # endif +# endif +# if @REPLACE_STPNCPY@ _GL_FUNCDECL_RPL (stpncpy, char *, (char *restrict __dst, char const *restrict __src, size_t __n)
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Mon, 28 Jan 2013 19:32:02 GMT) Full text and rfc822 format available.Message #49 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Assaf Gordon <assafgordon <at> gmail.com> To: Paul Eggert <eggert <at> cs.ucla.edu> Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Mon, 28 Jan 2013 14:30:59 -0500
Paul Eggert wrote, On 01/25/2013 05:18 PM: > On 01/25/2013 11:25 AM, Assaf Gordon wrote: > >> So I'm guessing that even though gnulib's stpncpy code is used, >> because the MacOS's native declaration of stpncpy is included, it >> causes problems when the macro is expanded to use "__stpncpy_chk". > > Does the following patch fix things for you? It attempts to change > the substitute string.h to inhibit that macro expansion. > No, doesn't work, on two levels: 1. This code isn't used - due to the combination of #if's. The resulting "lib/string.h" contains: /* Copy no more than N bytes of SRC to DST, returning a pointer past the last non-NUL byte written into DST. */ #if 1 # if 0 || (!0 && defined stpncpy) # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef stpncpy # define stpncpy rpl_stpncpy # endif # endif And this isn't used. I checked by adding an "#error" above the "#undef" - and it didn't trigger an error. 2. I took the two lines (undef+defined) and put them outside the #if's (and verified they were processed, using #error) - but they still did not fix the compilation error.
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Mon, 04 Feb 2013 06:45:02 GMT) Full text and rfc822 format available.Message #52 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: Paul Eggert <eggert <at> cs.ucla.edu> To: Assaf Gordon <assafgordon <at> gmail.com> Cc: bug-gnulib <bug-gnulib <at> gnu.org>, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Sun, 03 Feb 2013 22:43:13 -0800
On 01/28/2013 11:30 AM, Assaf Gordon wrote: > 1. This code isn't used - due to the combination of #if's. > The resulting "lib/string.h" contains: > /* Copy no more than N bytes of SRC to DST, returning a pointer past the > last non-NUL byte written into DST. */ > #if 1 > # if 0 || (!0 && defined stpncpy) > # if !(defined __cplusplus && defined GNULIB_NAMESPACE) > # undef stpncpy > # define stpncpy rpl_stpncpy > # endif > # endif > > And this isn't used. Well, I'm lost then, because I thought that your platform (when using the compiler options in question) did a #define strpncpy(...) ..., which should cause the above undef+define to trigger. > 2. I took the two lines (undef+defined) and put them outside the #if's > (and verified they were processed, using #error) - but they still did not fix the compilation error. Sorry, I'm lost here too. I'm afraid more detective work will need to be done on your end.
bug-coreutils <at> gnu.org
:bug#13495
; Package coreutils
.
(Mon, 04 Feb 2013 23:11:02 GMT) Full text and rfc822 format available.Message #55 received at 13495 <at> debbugs.gnu.org (full text, mbox):
From: karl <at> freefriends.org (Karl Berry) To: assafgordon <at> gmail.com, bug-gnulib <at> gnu.org, 13495 <at> debbugs.gnu.org Subject: Re: bug#13495: Compilation fails on Mac OS X 10.8.0 Date: Mon, 4 Feb 2013 23:09:02 GMT
> 1. This code isn't used - due to the combination of #if's. Sorry if I'm missing the point here, but FWIW, my suggestion for cpp-related debugging is to take the line from make for compiling the file and change it to: gcc -E -dD -o foobar ...copy rest of cmdline from make output... Then foobar will have the #define statements, in the context of the regular preprocessed output, so you can see what is #defining what and why. http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html (at -dCHARS, toward the end.) (Or similar, for other compilers. Sorry, I don't recall if you're using gcc.) Best, karl
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Tue, 05 Mar 2013 12:24:03 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.