[postgis-users] compiling from source code

Regina Obe lr at pcorp.us
Mon Jul 10 13:38:50 PDT 2017


Perhaps you had set it as part of what the answer described here when experimenting

https://stackoverflow.com/questions/23338713/homebrew-how-to-permanently-override-homebrew-cc-homebrew-cxx-env-settings

I assume you just need to reset the HOMEBREW_CC HOMEBREW_CX to nothing or what it was before.


-----Original Message-----
From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Sandeep Gupta
Sent: Monday, July 10, 2017 3:38 PM
To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
Subject: Re: [postgis-users] compiling from source code

It turned out the problem wasl related to compiling conftest.c:

configure:6858: gcc  conftest.c
conftest.c:14:8: error: unknown type name 'Syntax'
        Syntax error
        ^
conftest.c:14:8: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
configure:6858: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|                    Syntax error
configure:6858: gcc  conftest.c
conftest.c:14:8: error: unknown type name 'Syntax'
        Syntax error
        ^
conftest.c:14:8: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
configure:6858: $? = 1


It is related to the problem posted here:
https://stackoverflow.com/questions/15041937/configure-error-c-preprocessor-fails-sanity-check'

Passing -E option as follows fixes the problem ( i am not sure why):
./configure --prefix=/home/linuxbrew/.linuxbrew/Cellar/postgis/2.3.3
CC=/home/linuxbrew/.linuxbrew/bin/gcc
CXX=/home/linuxbrew/.linuxbrew/bin/g++
CPP='/home/linuxbrew/.linuxbrew/bin/g++ -E


However the compile fails here (this is for postgis 2.3.3):

make[1]: Entering directory
'/home/sandeep/.cache/Homebrew/postgis-2.3.3/postgis'
gcc-4.8 -I../liblwgeom  -fpic -I../libpgcommon -I/home/linuxbrew/.linuxbrew/Cellar/geos/3.6.1/include
-I/home/linuxbrew/.linuxbrew/Cellar/libxml2/2.9.4_3/include/libxml2
-I/home/linuxbrew/.linuxbrew/Cellar/sfcgal/1.3.1/include -DHAVE_SFCGAL
   -fPIC -I/home/linuxbrew/.linuxbrew/Cellar/sfcgal/1.3.1/include
-DHAVE_SFCGAL -I. -I./
-I/home/linuxbrew/.linuxbrew/Cellar/postgresql/9.6.3/include/server
-I/home/linuxbrew/.linuxbrew/Cellar/postgresql/9.6.3/include/internal
-I/home/linuxbrew/.linuxbrew/opt/openssl/include
-I/home/linuxbrew/.linuxbrew/opt/readline/include -D_GNU_SOURCE
-I/home/linuxbrew/.linuxbrew/Cellar/libxml2/2.9.4_2/include/libxml2
-c -o postgis_module.o postgis_module.c
make[1]: gcc-4.8: Command not found
<builtin>: recipe for target 'postgis_module.o' failed
make[1]: *** [postgis_module.o] Error 127


I am not sure why the make is picking up gcc-4.8.

Thanks
sandeep



On Mon, Jul 10, 2017 at 2:42 PM, Regina Obe <lr at pcorp.us> wrote:
> Sandeep,
>
> Sounds like you might be having the same issue described here:
>
> https://stackoverflow.com/questions/23338713/homebrew-how-to-permanent
> ly-override-homebrew-cc-homebrew-cxx-env-settings
>
> Does the suggested answer work.
>
> Thanks,
> Regina
>
> -----Original Message-----
> From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On 
> Behalf Of Sandeep Gupta
> Sent: Monday, July 10, 2017 2:12 PM
> To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
> Subject: Re: [postgis-users] compiling from source code
>
> Hi Regina,
>
>  I tried several version of postgis (2.3.3, 2.4.0dev, 2.1.8). I have pkg_config installed on my system.
>
>  The error I get is:
> checking how to run the C preprocessor... gcc
> configure: error: in `/home/sandeep/.cache/Homebrew/postgis-2.3.3':
> configure: error: C preprocessor "gcc" fails sanity check
>
> The configure doesn't proceed after this in my case.
>
> Is there any temporary workaround that you suggest I can try?
>
> Thanks.
> sandeep
>
>
> On Sat, Jul 8, 2017 at 7:40 PM, Regina Obe <lr at pcorp.us> wrote:
>> Sandeep,
>>
>> Which version of PostGIS are you trying to build?  Your configure might be ending for another reason.  For example in PostGIS 2.4, I think we now have a dependency on pkg-config which older versions of PostGIS do not.  We'll sort this out before PostGIS release, but I think downside at moment, is the it fails if pkg-config is not installed.  I forget the exact error you get.
>>
>> I looked around on net for the -V and from what I can tell, that error is harmless and is just part of the process of configure checking the capabilities of the gcc compile.
>> I checked my own config.log and see the same error
>>
>> configure:2948: x86_64-w64-mingw32-gcc -V >&5
>> x86_64-w64-mingw32-gcc.exe: error: unrecognized command line option '-V'
>> x86_64-w64-mingw32-gcc.exe: fatal error: no input files compilation 
>> terminated.
>>
>> But my configure continues, works fine and in the end shows this:
>>
>> configure:20134: result:
>> configure:20136: result:   PostGIS is now configured for x86_64-w64-mingw32
>> configure:20138: result:
>> configure:20140: result:  -------------- Compiler Info -------------
>> configure:20142: result:   C compiler:           x86_64-w64-mingw32-gcc -g -O2
>> configure:20144: result:   SQL preprocessor:     /mingw64/bin/cpp -traditional-cpp -w -P
>> configure:20146: result:
>> configure:20148: result:  -------------- Dependencies --------------
>> configure:20150: result:   GEOS config:          /projects/geos/rel-3.7.0devw64gcc48/bin/geos-config
>> configure:20152: result:   GEOS version:         3.7.0dev
>> configure:20155: result:   GDAL config:          /projects/gdal/rel-2.2.1w64gcc48/bin/gdal-config
>> configure:20157: result:   GDAL version:         2.2.1
>> configure:20161: result:   SFCGAL config:        /projects/CGAL/rel-sfcgal-1.3.0w64gcc48/bin/sfcgal-config
>> configure:20163: result:   SFCGAL version:       1.3.0
>> configure:20167: result:   PostgreSQL config:    /projects/postgresql/rel/pg9.4w64gcc48/bin/pg_config
>> configure:20169: result:   PostgreSQL version:   PostgreSQL 9.4.5
>> configure:20175: result:   PROJ4 version:        49
>> configure:20177: result:   Libxml2 config:       /projects/libxml/rel-libxml2-2.7.8w64gcc48/bin/xml2-config
>> configure:20179: result:   Libxml2 version:      2.7.8
>> configure:20181: result:   JSON-C support:       yes
>> configure:20183: result:   protobuf-c support:   yes
>> configure:20185: result:   PCRE support:         yes
>> configure:20187: result:   PostGIS debug level:  0
>> configure:20189: result:   Perl:                 /usr/bin/perl
>> configure:20191: result:
>> configure:20193: result:  --------------- Extensions ---------------
>> configure:20196: result:   PostGIS Raster:       enabled
>> configure:20204: result:   PostGIS Topology:     enabled
>> configure:20211: result:   SFCGAL support:       enabled
>> configure:20219: result:   Address Standardizer support:       enabled
>> configure:20225: result:
>> configure:20227: result:  -------- Documentation Generation --------
>> configure:20229: result:   xsltproc:             /projects/xsltproc/xsltproc
>> configure:20231: result:   xsl style sheets:     /projects/docbook/docbook-xsl-1.76.1
>> configure:20233: result:   dblatex:
>> configure:20235: result:   convert:              /c/Windows/System32/convert
>> configure:20237: result:   mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd
>>
>>
>>
>> Do you get an output anything like this or does it just end after that terminated?
>>
>> Thanks,
>> Regina
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On 
>> Behalf Of Sandeep Gupta
>> Sent: Friday, July 07, 2017 8:36 PM
>> To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
>> Subject: Re: [postgis-users] compiling from source code
>>
>> Autoconf was missing, so I went ahead install autoconf, automake, and libtool.
>>
>> Tried recompiling.
>>
>> sh autogen.sh outputs:
>> * Running /home/linuxbrew/.linuxbrew/bin/glibtoolize (2.4.6)
>>    OPTIONS = --force --copy --install
>> glibtoolize: putting auxiliary files in '.'.
>> glibtoolize: copying file './config.guess'
>> glibtoolize: copying file './config.sub'
>> glibtoolize: copying file './install-sh'
>> glibtoolize: copying file './ltmain.sh'
>> glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'macros'.
>> glibtoolize: copying file 'macros/libtool.m4'
>> glibtoolize: copying file 'macros/ltoptions.m4'
>> glibtoolize: copying file 'macros/ltsugar.m4'
>> glibtoolize: copying file 'macros/ltversion.m4'
>> glibtoolize: copying file 'macros/lt~obsolete.m4'
>> glibtoolize: Consider adding '-I macros' to ACLOCAL_AMFLAGS in Makefile.am.
>> * Running /home/linuxbrew/.linuxbrew/bin/aclocal (1.15.1)
>> * Running /home/linuxbrew/.linuxbrew/bin/autoconf (2.69) 
>> ======================================
>> Now you are ready to run './configure'
>> ======================================
>>
>> This does not solve though. When I run ./configure same error appears with -V flag being the issue.
>>
>> -sandeep
>>
>>
>>
>>
>>
>>
>>
>> On Fri, Jul 7, 2017 at 6:33 PM, Regina Obe <lr at pcorp.us> wrote:
>>> Okay I just got an irc note from Even Roualt.  He is running Ubuntu
>>> 16.04 and gcc 5.4  and had no issue running
>>>
>>> sh autogen.sh
>>> ./configure
>>>
>>> So doesn't seem like it's a newer gcc issue unless if its 5.3 specific.
>>>
>>> I'm suspecting something with brew,  MacOS, or tool chain like autoconf.
>>>
>>> What does:
>>>
>>> autoconf --version
>>>
>>> Return?
>>>
>>> I get
>>>
>>> autoconf (GNU Autoconf) 2.69
>>> Copyright (C) 2012 Free Software Foundation, Inc.
>>> License GPLv3+/Autoconf: GNU GPL version 3 or later
>>>
>>> Thanks,
>>> Regina
>>>
>>> -----Original Message-----
>>> From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] 
>>> On Behalf Of Sandeep Gupta
>>> Sent: Friday, July 07, 2017 6:18 PM
>>> To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
>>> Subject: Re: [postgis-users] compiling from source code
>>>
>>> Hi Regina,
>>>
>>>  Here is the output for gcc -v (install gcc from linuxbrew, which port of brew package manager of macOS):
>>>
>>> Reading specs from
>>> /home/linuxbrew/.linuxbrew/Cellar/gcc/5.3.0/lib/gcc/x86_64-unknown-l
>>> i
>>> n
>>> ux-gnu/5.3.0/specs
>>> COLLECT_GCC=gcc
>>> COLLECT_LTO_WRAPPER=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.3.0/libe
>>> x e c/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper
>>> Target: x86_64-unknown-linux-gnu
>>> Configured with: ../configure
>>> --prefix=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.3.0
>>> --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5 
>>> --with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp
>>> --with-mpfr=/home/linuxbrew/.linuxbrew/opt/mpfr
>>> --with-mpc=/home/linuxbrew/.linuxbrew/opt/libmpc
>>> --with-isl=/home/linuxbrew/.linuxbrew/opt/isl --with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --with-build-config=bootstrap-debug --disable-werror --with-pkgversion='Homebrew gcc 5.3.0'
>>> --with-bugurl=https://github.com/Homebrew/homebrew/issues
>>> --enable-plugin --disable-nls --disable-multilib Thread model: posix 
>>> gcc version 5.3.0 (Homebrew gcc 5.3.0)
>>>
>>>
>>> Thanks.
>>> sandeep
>>>
>>>
>>>
>>> On Fri, Jul 7, 2017 at 5:52 PM, Regina Obe <lr at pcorp.us> wrote:
>>>> Steve and Sandeep,
>>>>
>>>> Can you try gcc -v instead and let me know what that outputs?
>>>>
>>>> I just checked our Debian PostGIS bot, and she's running gcc 5.2.1  and think she's running the newest of any of our bots . So I can 't rule out a newer gcc at fault here.
>>>> However if I do gcc -V, I get an error on her too, so that's not the issue here:
>>>> --
>>>>
>>>> gcc: error: unrecognized command line option  ?~-V ?T
>>>> gcc: fatal error: no input files
>>>> compilation terminated.
>>>>
>>>> However, lower case -v  (which is what I think configure uses, works just fine).
>>>>
>>>> gcc -v
>>>>
>>>> outputs:
>>>> Using built-in specs.
>>>> COLLECT_GCC=gcc
>>>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
>>>> Target: x86_64-linux-gnu
>>>> Configured with: ../src/configure -v --with-pkgversion='Debian 
>>>> 5.2.1-22' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
>>>> --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++
>>>> --prefix=/usr --program-suffix=-5 --enable-shared --ena
>>>> jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
>>>> --with-arch-directory=amd64
>>>> --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc 
>>>> --enable-multiarch --with-arch-32=i586 --with-abi=m64
>>>> --with-multilib-list=m32,m64,mx32 --enable-m Thread model: posix 
>>>> gcc version 5.2.1 20151010 (Debian 5.2.1-22)
>>>>
>>>>
>>>> I'm not sure where Sandeep's   gcc -V is coming from in configure, cause it looks like gcc -v works fine on his system too, but then somewhere down the line switches to upper case -V which is not a valid switch command even in lower gcc versions.
>>>>
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Regina
>>>>
>>>> -----
>>>> From: Stephen Woodbridge Date: Fri, Jul 7, 2017 at 2:09 PM
>>>>
>>>>
>>>>
>>>> I get the same error running on Ubuntu 16.04 with:
>>>>
>>>> $ gcc -V
>>>> gcc: error: unrecognized command line option  -V
>>>> gcc: fatal error: no input files
>>>> compilation terminated.
>>>>
>>>> Looks like the option should be --version $ gcc --version gcc 
>>>> (Ubuntu
>>>> 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 Copyright (C) 2015 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.
>>>>
>>>> -Steve
>>>>
>>>> On 7/7/2017 1:51 PM, Sandeep Gupta wrote:
>>>> Hi,
>>>>
>>>> I am using gcc version 5.3 to compile postgis on Fedora.
>>>> The compile  fails at the configure step.
>>>>
>>>> I get the error:
>>>>
>>>> configure: error: C preprocessor "gcc" fails sanity check See 
>>>> `config.log' for more details
>>>>
>>>> The relevant line in config.log:
>>>> configure:3031: gcc -v >&5
>>>> Reading specs from
>>>> /home/linuxbrew/.linuxbrew/Cellar/gcc/5.3.0/lib/gcc/x86_64-unknown-
>>>> l
>>>> i
>>>> n
>>>> ux-gnu/5.3.0/specs
>>>> COLLECT_GCC=gcc
>>>> COLLECT_LTO_WRAPPER=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.3.0/lib
>>>> e x e c/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper
>>>> Target: x86_64-unknown-linux-gnu
>>>> Configured with: ../configure
>>>> --prefix=/home/linuxbrew/.linuxbrew/Cellar/gcc/5.3.0
>>>> --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-5 
>>>> --with-gmp=/home/linuxbrew/.linuxbrew/opt/gmp
>>>> --with-mpfr=/home/linuxbrew/.linuxbrew/opt/mpfr
>>>> --with-mpc=/home/linuxbrew/.linuxbrew/opt/libmpc
>>>> --with-isl=/home/linuxbrew/.linuxbrew/opt/isl --with-system-zlib 
>>>> --enable-libstdcxx-time=yes --enable-stage1-checking 
>>>> --enable-checking=release --enable-lto 
>>>> --with-build-config=bootstrap-debug --disable-werror 
>>>> --with-pkgversion='Homebrew gcc 5.3.0'
>>>> --with-bugurl=https://github.com/Homebrew/homebrew/issues
>>>> --enable-plugin --disable-nls --disable-multilib Thread model: 
>>>> posix gcc version 5.3.0 (Homebrew gcc 5.3.0)
>>>> configure:3042: $? = 0
>>>> configure:3031: gcc -V >&5
>>>> gcc: error: unrecognized command line option '-V'
>>>> gcc: fatal error: no input files
>>>> compilation terminated.
>>>>
>>>>
>>>>
>>>> It seems gcc does not like "-V" option. I this a issue to with 
>>>> later gcc versions?
>>>>
>>>> Thanks.
>>>> sandeep
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users at lists.osgeo.org
>>>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>>>
>>>>
>>>> ---
>>>> This email has been checked for viruses by Avast antivirus software.
>>>> https://www.avast.com/antivirus
>>>>
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users at lists.osgeo.org
>>>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>>>
>>>>
>>>> _______________________________________________
>>>> postgis-users mailing list
>>>> postgis-users at lists.osgeo.org
>>>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users



More information about the postgis-users mailing list