minaco2 / distcc

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

Compilation fails under Cygwin #132

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Version: This is not mentioned in the source code download from source using 
svn.
Last change log is: 2011-10-26
Platform: Windows Xp
Compiler: CYGWIN_NT-5.1 dell830 1.7.25(0.270/5/3) 2013-08-31 20:39 i686 Cygwin
cc (GCC) 4.8.2
Build Distcc using 'make'.

What went wrong:
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  -o src/distcc.o -c 
src/distcc.c
src/distcc.c:44:23: fatal error: libiberty.h: No such file or directory
 #include <libiberty.h>
                       ^
compilation terminated.

Original issue reported on code.google.com by jt.big...@googlemail.com on 16 Nov 2013 at 12:35

GoogleCodeExporter commented 9 years ago
One seems to have to unpack and build bin-utils and then handcraft the Makefile 
to include libiberty.h from bin-utils, and also tell GNU to ignore: 
char-subscripts warnings.

But the compilation fails with:
gcc -DHAVE_CONFIG_H -D_GNU_SOURCE -DSYSCONFDIR="\"/usr/local/etc\"" 
-DPKGDATADIR="\"/usr/local/share/distcc\"" -Isrc -I"./src" -I"./lzo"  
-I"../binutils-2.23/include" -Werror -Wno-error=char-subscripts -g -O2 -MD -W 
-Wall -Wimplicit -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings 
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs 
-Wmissing-declarations -Wuninitialized  -o src/exec.o -c src/exec.c
In file included from /usr/include/w32api/wtypes.h:7:0,
                 from /usr/include/w32api/winscard.h:10,
                 from /usr/include/w32api/windows.h:97,
                 from src/exec.c:65:
src/rpc.h:27:5: error: conflicting types for ‘dcc_x_result_header’
 int dcc_x_result_header(int ofd, enum dcc_protover);
     ^
In file included from /usr/include/w32api/windows.h:88:0,
                 from src/exec.c:65:
src/rpc.h:27:5: note: previous declaration of ‘dcc_x_result_header’ was here
 int dcc_x_result_header(int ofd, enum dcc_protover);
     ^
In file included from /usr/include/w32api/wtypes.h:7:0,
                 from /usr/include/w32api/winscard.h:10,
                 from /usr/include/w32api/windows.h:97,
                 from src/exec.c:65:

There many error messages that follow this, too numerous to list here.
At least Cygwin comes with distcc 2.18.3 (24.04.2005)

Original comment by jt.big...@googlemail.com on 16 Nov 2013 at 8:38

GoogleCodeExporter commented 9 years ago
There's a couple of different issues here.

1. libiberty.

Cause:

It looks like the libiberty issue was introduced by
https://code.google.com/p/distcc/source/detail?r=774

r774 | mandyke@gmail.com | 2013-05-08 15:21:45 +0100 (Wed, 08 May 2013) | 3 
lines

Support @FILE arguments correctly. Requires GNU libiberty.

That change did update the INSTALL file to say that GNU libiberty was a build 
prerequisite.

Possible solutions:
- One possibility would be to include GNU libiberty in the distcc distribution.
- Another possibility would be to improve the documentation in the INSTALL file 
about the required prerequisites and in particular to explain how to install 
the required prerequisites for Cygwin.

2. dcc_x_result_header.

Cause:
The error that you are seeing there comes from a conflict between distcc's 
"rpc.h" header file and a system header of the same name that is included by 
/usr/include/w32api/wtypes.h.  This conflict causes distcc's "rpc.h" to get 
wrongly included by wtypes.h, which then results in compilation errors because 
distcc's "rpc.h" has been included prior to including "distcc.h" which declares 
the dcc_x_result_header enum.

Non-solutions:
Including distcc.h earlier (or other modifications relating to how the 
dcc_x_result_header enum is declared) would likely not be sufficient to solve 
the problem, since wtypes.h presumably really needs the system <rpc.h> file.  
Even if such an approach did work, it would be fragile.

Solutions:
There are a couple of possible fixes.  One would be to rename distcc's "rpc.h" 
to something else, e.g. "dcc_rpc.h".  Another would be to change distcc's 
Makefile.in to use "-iquote " instead of "-I"; to make that portable it would 
require a test in configure.ac to determine whether the compiler supports 
"-iquote".
Either would be acceptable IMHO.

Original comment by fergus.h...@gmail.com on 18 Nov 2013 at 10:40