minaco2 / distcc

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

distcc 3.2rc1 compilation error on cygwin #124

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Compiling distcc on cygwin/Windows fails with tons of errors like this:

gcc -DHAVE_CONFIG_H -D_GNU_SOURCE -DSYSCONFDIR="\"/usr/local/etc\"" 
-DPKGDATADIR="\"/usr/local/share/distcc\""  -I "../src" -Isrc -I"../lzo"  
-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 -D_REENTRAN
T    -o src/loadfile.o -c ../src/loadfile.c
In file included from 
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/rpcnsip.h:10:0,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/rpcndr.h:21,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/wtypes.h:8,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/winscard.h:10,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/windows.h:97,
                 from ../src/tempfile.c:55:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/rpcnsi.h:26:10: 
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ 
before ‘RPC_STATUS’
In file included from 
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/rpcnsip.h:10:0,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/rpcndr.h:21,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/wtypes.h:8,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/winscard.h:10,
                 from /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/windows.h:97,
                 from ../src/tempfile.c:55:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/rpcnsi.h:27:10: 
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ 
before ‘RPC_STATUS’
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/rpcnsi.h:28:10: 
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ 
before ‘RPC_STATUS’
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api/rpcnsi.h:29:10: 
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ 
before ‘RPC_STATUS’
...

-- snip --

The problem arises because distcc source files indirectly include a system 
header file named "rpc.h" (via including windows.h). It seems that this is a 
system header file that only exists on Windows/cygwin (it's located in 
c:\cygwin\usr\include\w32api\rpc.h on my system).

Including a file named "rpc.h" causes troubles because distcc also contains a 
header file with that name. Moreover, compilation of distcc is performed with 
"gcc ... -Isrc ..." which causes the distcc source dir to be part of header 
searched path causing the #include <rpc.h> directive in the w32api files to 
include the rpc.h of distcc instead of the one in w32api.

Solution: There are at least two ways to fix the issue:
 1. rename rpc.h coming with distcc. E.g. to rpcdistcc.h or whatever
 2. replace "-Isrc" from the compiler invocation by "-iquote src" as shown in the attached patch (Note: without adding "src" to the list of searched header directories, we get compilation failures for the Python extension.)

Original issue reported on code.google.com by zull...@gmail.com on 23 Feb 2013 at 1:06

Attachments:

GoogleCodeExporter commented 9 years ago
> Solution: There are at least two ways to fix the issue:
>  1. rename rpc.h coming with distcc. E.g. to rpcdistcc.h or
>  whatever
>  2. replace "-Isrc" from the compiler invocation by "-iquote src"
>  as shown in the attached patch (Note: without adding "src" to
>  the list of searched header directories, we get compilation
>  failures for the Python extension.)

Moving the compilation to new src/Makefile will avoid any use of both -Isrc and 
-I$(srcdir)/src.

Original comment by mand...@gmail.com on 3 Mar 2014 at 6:28