minaco2 / distcc

Automatically exported from code.google.com/p/distcc
GNU General Public License v2.0
0 stars 0 forks source link

distcc-3.1 fails to compile on MacOS SnowLeopard: HAVE_DECL_SNPRINTF not propagated? #80

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. What version of distcc are you using (e.g. "2.7.1")? 
distcc-3.1

2. What platform are you running on?  What compilare are you using?
MacOS X SnowLeopard, 10.6
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)

3. What were you trying to do (e.g. "install distcc", "build Mozilla")?
install distcc

4. What went wrong?  
Compilation of distcc failed, due to conflicting definitions of snprintf.

5. If you have an example of a compiler invocation that failed, quote it, in 
full:

gcc -DHAVE_CONFIG_H -D_GNU_SOURCE -DSYSCONFDIR="\"/usr/local/etc\"" 
-DPKGDATADIR="\"/usr/local/share/distcc\"" -Isrc -I"./src" -I"./lzo" -I"./popt" 
-Werror -g -O2 -MD -W -Wall -Wimplicit -Wshadow -Wpointer-arith -Wcast-align 
-Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes 
-Wnested-externs -Wmissing-declarations -Wuninitialized -I/sw/include 
-D_REENTRANT -D_THREAD_SAFE  -o src/emaillog.o -c src/emaillog.c

6. What error logging do you get?  
See below:

7. If you got an error message on stderr, quote that error exactly.
----------
gcc -DHAVE_CONFIG_H -D_GNU_SOURCE -DSYSCONFDIR="\"/usr/local/etc\"" 
-DPKGDATADIR="\"/usr/local/share/distcc\"" -Isrc -I"./src" -I"./lzo" -I"./popt" 
-Werror -g -O2 -MD -W -Wall -Wimplicit -Wshadow -Wpointer-arith -Wcast-align 
-Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes 
-Wnested-externs -Wmissing-declarations -Wuninitialized -I/sw/include 
-D_REENTRANT -D_THREAD_SAFE  -o src/emaillog.o -c src/emaillog.c

In file included from src/emaillog.c:36:
src/snprintf.h:30: error: expected declaration specifiers or '...' before 
numeric constant
src/snprintf.h:30: error: expected declaration specifiers or '...' before 
'__builtin_object_size'
cc1: warnings being treated as errors
src/snprintf.h:30: warning: conflicting types for built-in function 
'__builtin___snprintf_chk'
src/snprintf.h:37: error: expected declaration specifiers or '...' before 
numeric constant
src/snprintf.h:37: error: expected declaration specifiers or '...' before 
'__builtin_object_size'
src/snprintf.h:37: warning: conflicting types for built-in function 
'__builtin___vsnprintf_chk'
make: *** [src/emaillog.o] Error 1
$ 
-------
Line 30 (+/- 1) of src/snprintf.h is:

#if !HAVE_DECL_SNPRINTF
int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
#endif

Line 37 (+/- 1) is:
#if !HAVE_DECL_VSNPRINTF
int vsnprintf(char *, size_t, const char *, va_list);
#endif

Oddly enough, HAVE_DECL_SNPRINTF and HAVE_DECL_VSNPRINTF are both declared to 
be 1 in src/config.h.  Adding
  #include "config.h"
makes the error go away.

After fixing that, another error crops up:

gcc -DHAVE_CONFIG_H -D_GNU_SOURCE -DSYSCONFDIR="\"/usr/local/etc\"" 
-DPKGDATADIR="\"/usr/local/share/distcc\"" -Isrc -I"./src" -I"./lzo" -I"./popt" 
-Werror -g -O2 -MD -W -Wall -Wimplicit -Wshadow -Wpointer-arith -Wcast-align 
-Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes 
-Wnested-externs -Wmissing-declarations -Wuninitialized -I/sw/include 
-D_REENTRANT -D_THREAD_SAFE  -o src/hosts.o -c src/hosts.c
cc1: warnings being treated as errors
src/hosts.c:135: warning: declaration of 'strndup' shadows a built-in function

This time, the HAVE_STRNDUP variable is set to 0 in config.h.  Commenting out 
that paragraph at line 135 gives the following error:

gcc -DHAVE_CONFIG_H -D_GNU_SOURCE -DSYSCONFDIR="\"/usr/local/etc\"" 
-DPKGDATADIR="\"/usr/local/share/distcc\"" -Isrc -I"./src" -I"./lzo" -I"./popt" 
-Werror -g -O2 -MD -W -Wall -Wimplicit -Wshadow -Wpointer-arith -Wcast-align 
-Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes 
-Wnested-externs -Wmissing-declarations -Wuninitialized -I/sw/include 
-D_REENTRANT -D_THREAD_SAFE  -o src/hosts.o -c src/hosts.c
cc1: warnings being treated as errors
src/hosts.c: In function 'dcc_parse_hosts':
src/hosts.c:540: warning: implicit declaration of function 'strndup'
src/hosts.c:540: warning: incompatible implicit declaration of built-in 
function 'strndup'

I renamed the included strndup to my_strndup, and it made it through that 
error.  Then I had to run configure --without-avahi, because I was getting 
errors about 64-bit vs 32-bit libraries.  Now I'm through most of it, but now 
python is complaining:

-------------------------------------

if test -z "/sw/bin/python2.5"; then    \
      echo "Not building include-server: No suitable python found"; \
    else                        \
      mkdir -p "./_include_server" &&      \
      DISTCC_VERSION="3.1"          \
      SRCDIR="."                            \
      CFLAGS="-g -O2 -MD -W -Wall -Wimplicit -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wmissing-declarations -Wuninitialized -D_THREAD_SAFE  -Wno-missing-prototypes -Wno-missing-declarations -Wno-write-strings -Wp,-U_FORTIFY_SOURCE"           \
      CPPFLAGS="-DHAVE_CONFIG_H -D_GNU_SOURCE -DSYSCONFDIR="\"/usr/local/etc\"" -DPKGDATADIR="\"/usr/local/share/distcc\"" -Isrc -I"./src" -I"./lzo" -I"./popt""                        \
      /sw/bin/python2.5 "./include_server/setup.py" \
          build                     \
            --build-base="./_include_server"  \
            --build-temp="./_include_server"; \
    fi
setup.py: PYTHON_CFLAGS must be defined.
running build
running build_py
running build_ext
building 'include_server.distcc_pump_c_extensions' extension
gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -O2 -MD -W -Wall 
-Wimplicit -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings 
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs 
-Wmissing-declarations -Wuninitialized -D_THREAD_SAFE -Wno-missing-prototypes 
-Wno-missing-declarations -Wno-write-strings -Wp,-U_FORTIFY_SOURCE 
-DHAVE_CONFIG_H -D_GNU_SOURCE -DSYSCONFDIR=/usr/local/etc 
-DPKGDATADIR=/usr/local/share/distcc -Isrc -I./src -I./lzo -I./popt 
-D_GNU_SOURCE=1 -Isrc -I./src -I./lzo -I./popt -I/sw/include/python2.5 -c 
/private/var/root/distcc-3.1/src/include_server/c_extensions/distcc_pump_c_exten
sions_module.c -o 
./_include_server/private/var/root/distcc-3.1/src/include_server/c_extensions/di
stcc_pump_c_extensions_module.o
In file included from /sw/include/python2.5/Python.h:57,
                 from /private/var/root/distcc-3.1/src/include_server/c_extensions/distcc_pump_c_extensions_module.c:24:
/sw/include/python2.5/pyport.h:547: warning: 'struct winsize' declared inside 
parameter list
/sw/include/python2.5/pyport.h:547: warning: its scope is only this definition 
or declaration, which is probably not what you want
/sw/include/python2.5/pyport.h:548: warning: 'struct winsize' declared inside 
parameter list
In file included from /sw/include/python2.5/Python.h:57,
                 from /private/var/root/distcc-3.1/src/include_server/c_extensions/distcc_pump_c_extensions_module.c:24:
/sw/include/python2.5/pyport.h:761:2: error: #error "LONG_BIT definition 
appears wrong for platform (bad gcc/glibc config?)."
error: command 'gcc' failed with exit status 1
make: *** [include-server] Error 1
-------------------------------------

I'm giving up and handing it over to you.  My patches (such as they are) are 
attached.

Original issue reported on code.google.com by pkts...@gmail.com on 8 Mar 2011 at 11:42

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you. Your patch works for me. I'm using Lion 10.7.2 with xcode 4.2

Original comment by LiangZhenjing on 13 Jan 2012 at 4:41

GoogleCodeExporter commented 9 years ago
The patch conflicts with one from Akim Demaille <demaille@gostai.com> which was 
committed in revision 715
<http://code.google.com/p/distcc/source/detail?r=715>.

Original comment by fergus.h...@gmail.com on 25 Jan 2012 at 12:48

GoogleCodeExporter commented 9 years ago
I applied the parts of the patch which didn't conflict with Akim's change -- 
the new #includes.
I suspect that probably fixes the problem.

Original comment by fergus.h...@gmail.com on 25 Jan 2012 at 7:41

GoogleCodeExporter commented 9 years ago
Thank you; I just couldn't take any more time to understand the problem and 
make it work, so I'm glad you could do it.

Original comment by pkts...@gmail.com on 25 Jan 2012 at 8:39

GoogleCodeExporter commented 9 years ago
I think this is probably fixed now, so I'm going to mark it as fixed.
Feel free to reopen the bug if things are still not working.

Original comment by fergus.h...@gmail.com on 10 Apr 2012 at 8:10