segasai / q3c

PostgreSQL extension for spatial indexing on a sphere
GNU General Public License v2.0
76 stars 27 forks source link

Build failure on recent Debian and Ubuntu #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
q3c-1.4.19 can't be compiled on recent versions of Debian (since 7.0) and most 
probably Ubuntu, if you use stock packages for postgresql (9.1, 9.2, 9.3).

> make
gcc -DQ3C_VERSION='"release-1.4.18-1-g74a4237"'  -O3 -D_GNU_SOURCE 
-D__STDC_FORMAT_MACROS -I. -I./ -I/usr/include/postgresql/9.3/server 
-I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE 
-I/usr/include/libxml2  -I/usr/include/tcl8.5 -g -O2 -fstack-protector 
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie 
-I/usr/include/mit-krb5 -DLINUX_OOM_ADJ=0 -Wall -Wmissing-prototypes 
-Wpointer-arith -Wdeclaration-after-statement -Wendif-labels 
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv 
-fexcess-precision=standard -g -fpic prepare.o q3cube.o q3c_poly.o  -L/usr/lib 
-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib/mit-krb5 
-L/usr/lib/x86_64-linux-gnu/mit-krb5  -Wl,--as-needed -lpgport -lpgcommon 
-lxslt -lxml2 -lpam -lssl -lcrypto -lkrb5 -lcom_err -lgssapi_krb5 -lz -ledit 
-lcrypt -ldl -lm  -o prepare
/usr/bin/ld: cannot find -lxslt
/usr/bin/ld: cannot find -lxml2
/usr/bin/ld: cannot find -lpam
/usr/bin/ld: cannot find -ledit
collect2: error: ld returned 1 exit status
make: *** [prepare] Error 1

The problem is due to multiarch - most of libraries (including these causing 
the errors) have been moved from /usr/lib to e.g. /usr/lib/x86_64-linux-gnu

The problem may be fixed with the following patch:
--- q3c-1.4.19/Makefile 2013-09-29 19:12:46.000000000 +0400
+++ q3c-1.4.19.fixed/Makefile   2014-01-26 04:06:17.068028941 +0400
@@ -43,7 +43,7 @@
    ./prepare

 prepare: prepare.o q3cube.o q3c_poly.o
-   $(CC) $(CPPFLAGS) $(CFLAGS) prepare.o q3cube.o q3c_poly.o $(PG_LIBS) 
$(LDFLAGS) $(LIBS) -o $@
+   $(CC) prepare.o q3cube.o q3c_poly.o -lm -o $@

 oldclean: 
    rm -f *~ tests/*~

Original issue reported on code.google.com by karpov...@gmail.com on 26 Jan 2014 at 12:19

GoogleCodeExporter commented 9 years ago
Clearly Ubuntu doesn't have the issue. 
Initially the compilation failed with 
"/usr/bin/ld: cannot find -ledit"
which was solved by installing 
libedit-dev package. 

I don't have at the moment access to a Debian  machine with stock PG, but I'm 
wondering whether the issue could be solved by just installing the relevant 
-dev packages, 
libxml2-dev, libxslt-dev, libedit-dev, libpam-dev

Original comment by koposov on 26 Jan 2014 at 8:40

GoogleCodeExporter commented 9 years ago
Well, stupid me.
I confirm, that helps. The problem is absence of -dev packages, was confused by 
presence of all necessary libraries in runtimes, and by the fact that other 
PostgreSQL extensions like pgSphere are compiling ok.
(Still, q3c can also be compiled without these libraries - see fix in the first 
comment).

Thanks, and sorry for false alarm!

Issue solved.

Original comment by karpov...@gmail.com on 26 Jan 2014 at 10:28

GoogleCodeExporter commented 9 years ago
No problem. 
Regarding removing the requirement for packages, I'd better keep them, as q3c 
don't have control over whatever is included in PG macroses and functions, so 
they could easily have the dependencies on different system libraries. Although 
at the moment that doesn't seem to be the case. 

Original comment by koposov on 26 Jan 2014 at 11:06

GoogleCodeExporter commented 9 years ago
I have the same problem with ubuntu 12.04.
I fixed by installing the relating packages mentioned in the second comment.
Really thanks.

Original comment by zhangcha...@gmail.com on 24 Mar 2015 at 2:34