Thread: MinGW-W64 compile error

MinGW-W64 compile error

From
Leonardo M. Ramé
Date:
Hi, I'm trying to build the client library of PostgreSql 9.3.x using
this version of MinGW's gcc:

gcc.exe (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 5.2.0

I did a ./configure --without-zlib

then make (mingw32-make.exe), and got this:

$ /e/MinGW/mingw32/bin/mingw32-make.exe
E:/MinGW/mingw32/bin/mingw32-make -C src all
mingw32-make[1]: Entering directory 'E:/postgresql-9.3.10/src'
E:/MinGW/mingw32/bin/mingw32-make -C common all
mingw32-make[2]: Entering directory 'E:/postgresql-9.3.10/src/common'
E:/MinGW/mingw32/bin/mingw32-make -C ../backend submake-errcodes
mingw32-make[3]: Entering directory 'E:/postgresql-9.3.10/src/backend'
mingw32-make[3]: Nothing to be done for 'submake-errcodes'.
mingw32-make[3]: Leaving directory 'E:/postgresql-9.3.10/src/backend'
g++  -DFRONTEND -I../../src/include -I./src/include/port/win32
-DEXEC_BACKEND  "-I../../src/include/port/win32" -DBUILDING_DLL  -c -o
relpath.o relpath.c
relpath.c: In function 'int forkname_chars(const char*, ForkNumber*)':
relpath.c:55:15: error: invalid conversion from 'int' to 'ForkNumber'
[-fpermissive]
   for (forkNum = 1; forkNum <= MAX_FORKNUM; forkNum++)
                ^
relpath.c:55:51: error: no 'operator++(int)' declared for postfix '++'
[-fpermissive]
   for (forkNum = 1; forkNum <= MAX_FORKNUM; forkNum++)
                                                    ^
<builtin>: recipe for target 'relpath.o' failed
mingw32-make[2]: *** [relpath.o] Error 1
mingw32-make[2]: Leaving directory 'E:/postgresql-9.3.10/src/common'
makefile:34: recipe for target 'all-common-recurse' failed
mingw32-make[1]: *** [all-common-recurse] Error 2
mingw32-make[1]: Leaving directory 'E:/postgresql-9.3.10/src'
GNUmakefile:11: recipe for target 'all-src-recurse' failed
mingw32-make: *** [all-src-recurse] Error 2

Does anyone know how can I get rid of this error?.

Regards,

--
Leonardo M. Ramé
http://leonardorame.blogspot.com


Re: MinGW-W64 compile error

From
Tom Lane
Date:
"=?UTF-8?Q?Leonardo_M._Ram=c3=a9?=" <l.rame@griensu.com> writes:
> Hi, I'm trying to build the client library of PostgreSql 9.3.x using
> this version of MinGW's gcc:
> ...
> g++  -DFRONTEND -I../../src/include -I./src/include/port/win32
> -DEXEC_BACKEND  "-I../../src/include/port/win32" -DBUILDING_DLL  -c -o
> relpath.o relpath.c

Why is it invoking g++ and not gcc?

> relpath.c: In function 'int forkname_chars(const char*, ForkNumber*)':
> relpath.c:55:15: error: invalid conversion from 'int' to 'ForkNumber'
> [-fpermissive]
>    for (forkNum = 1; forkNum <= MAX_FORKNUM; forkNum++)
> relpath.c:55:51: error: no 'operator++(int)' declared for postfix '++'
> [-fpermissive]
>    for (forkNum = 1; forkNum <= MAX_FORKNUM; forkNum++)

The second of these definitely comes from trying to compile C code as C++,
and I think the first does too.

            regards, tom lane


Re: MinGW-W64 compile error

From
Leonardo M. Ramé
Date:
El 04/11/15 a las 00:05, Tom Lane escribió:
> "=?UTF-8?Q?Leonardo_M._Ram=c3=a9?=" <l.rame@griensu.com> writes:
>> Hi, I'm trying to build the client library of PostgreSql 9.3.x using
>> this version of MinGW's gcc:
>> ...
>> g++  -DFRONTEND -I../../src/include -I./src/include/port/win32
>> -DEXEC_BACKEND  "-I../../src/include/port/win32" -DBUILDING_DLL  -c -o
>> relpath.o relpath.c
>
> Why is it invoking g++ and not gcc?

I don't know. I just installed MinGW, then ./configure, maybe there's an
error in the configure script?.

>
>> relpath.c: In function 'int forkname_chars(const char*, ForkNumber*)':
>> relpath.c:55:15: error: invalid conversion from 'int' to 'ForkNumber'
>> [-fpermissive]
>>     for (forkNum = 1; forkNum <= MAX_FORKNUM; forkNum++)
>> relpath.c:55:51: error: no 'operator++(int)' declared for postfix '++'
>> [-fpermissive]
>>     for (forkNum = 1; forkNum <= MAX_FORKNUM; forkNum++)
>
> The second of these definitely comes from trying to compile C code as C++,
> and I think the first does too.
>
>             regards, tom lane
>
>




Re: MinGW-W64 compile error

From
Leonardo M. Ramé
Date:
El 04/11/15 a las 06:00, Leonardo M. Ramé escribió:
>
> El 04/11/15 a las 00:05, Tom Lane escribió:
>> "=?UTF-8?Q?Leonardo_M._Ram=c3=a9?=" <l.rame@griensu.com> writes:
>>> Hi, I'm trying to build the client library of PostgreSql 9.3.x using
>>> this version of MinGW's gcc:

Nevermind, deleted my MinGW instalation, then installed msys and
MinGW-W64 again, defined /etc/fstab to my MinGW/mingw32/bin directory
ans voila!, it compiled without errors.

Regards,
Leonardo.


Re: MinGW-W64 compile error

From
Tom Lane
Date:
"=?UTF-8?Q?Leonardo_M._Ram=c3=a9?=" <l.rame@griensu.com> writes:
> El 04/11/15 a las 00:05, Tom Lane escribi�:
>> Why is it invoking g++ and not gcc?

> I don't know. I just installed MinGW, then ./configure, maybe there's an
> error in the configure script?.

I looked at the configure script carefully, and so far as I can see,
it will only choose compilers named "gcc" or "cc" of its own accord.
Choosing g++ would only be possible if you have CC = g++ in your
environment.

            regards, tom lane