5

I have been trying to compile geos on my restrcited(no root) environment and I am having some difficulties...

I did the following

wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
tar jxf geos-3.4.2.tar.bz2
cd geos-3.4.2
nano ~/.bash_profile
# I added PATH=$PATH:$HOME/local/bin export PATH
./configure --enable-php --prefix=$HOME/local/ && make clean && make

And Im getting the following errors

Making all in php
make[2]: Entering directory `/home/myname/test/geos-3.4.2/php'
Making all in .
make[3]: Entering directory `/home/myname/test/geos-3.4.2/php'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../include -I../include/geos   `/usr/local/bin/php-config --includes` -DCOMPILE_DL_GEOS -I../capi -I../include -I./opt/alt/php53/usr/include/ -pedantic -Wall -ansi -Wno-long-long  -ffloat-store -std=gnu99 -g -O2 -MT geos_la-geos.lo -MD -MP -MF .deps/geos_la-geos.Tpo -c -o geos_la-geos.lo `test -f 'geos.c' || echo './'`geos.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../include -I../include/geos -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DCOMPILE_DL_GEOS -I../capi -I../include -I./opt/alt/php53/usr/include/ -pedantic -Wall -ansi -Wno-long-long -ffloat-store -std=gnu99 -g -O2 -MT geos_la-geos.lo -MD -MP -MF .deps/geos_la-geos.Tpo -c geos.c  -fPIC -DPIC -o .libs/geos_la-geos.o
geos.c:26:17: error: php.h: No such file or directory
geos.c:27:54: error: ext/standard/info.h: No such file or directory
geos.c:28:72: error: Zend/zend_exceptions.h: No such file or directory

According to some github, this happens with MAMP too

This happens because GEOS requires PHP header files from the original PHP source, and MAMP does not include those.

EDIT 1:

I have also added this in ~/local/share/config.site

CPPFLAGS=-I./opt/alt/php53/usr/include/
LDFLAGS=-L$HOME/local/lib

php.h is located here: ./opt/alt/php53/usr/include/php/main/php.h

info.h: ./opt/alt/php53/usr/include/php/ext/standard/info.h

zend_exceptions.h: ./opt/alt/php53/usr/include/php/Zend/zend_exceptions.h

EDIT 2:

Last thing: my ./configure tells me this

checking for php-config... /usr/local/bin/php-config
checking for php... /usr/local/bin/php

So my question, if Im on the right track for solving this, is how do I include my php header files while compiling geos in a non root evnironment in centOs ?

Im quite lost to be honest !

delmalki
  • 1,326
  • 1
  • 13
  • 31
  • `PATH='$HOME/local/bin:$PATH'` with single quotes is an error and will break things. Luckily, `~/.bash_rc` is not the correct file for that so you didn't see that breakage (but if you `echo "$PATH"` you'll also see that your addition didn't work, unless it happened to be there already). You need double quotes on the assignment for the variables to expand. – Etan Reisner Jul 17 '15 at 01:33
  • it was an error in my explanation, I in fact added this in .bash_profile `PATH=$PATH:$HOME/local/bin export PATH` – delmalki Jul 17 '15 at 01:36
  • On one line that's an error also but for a different reason. On one line that assignment only applies to the `export` call... but actually that happens to work coincidentally enough but it still isn't correct. That should be on two lines. Anyway, that's not related to your problem in any way. – Etan Reisner Jul 17 '15 at 01:43
  • We can't give you a generally applicable answer here, as the details will depend heavily on the web host you are using and the way they've configured their systems. Have you asked them for assistance? –  Jul 22 '15 at 20:44
  • Ya, and their only answer is you need root access to compile and install php extensions not provided. Please consider upgrading to a dedicated server or VPS. (which means 15 to 80$ month) Its godaddy btw. – delmalki Jul 23 '15 at 21:43

1 Answers1

1

I'm fairly certain the path to your PHP installation does not start with a . - not from inside the geos-3.4.2 folder anyway, and certainly not from inside an arbitrary source folder.
You should make that path absolute.

I'm assuming the opt folder is in your user folder, so the full path would be $HOME/opt/alt/php53/usr/. Thanks for the clarification, the full path should then be /opt/alt/php53/usr/.
You need to add the bin folder to your PATH variable, the include folder to CPPFLAGS and the lib folder to LDFLAGS.
With $HOME/local/ this is not necessary, since that is the PREFIX, and will be added automatically.
Also note that when adding stuff to your PATH variable, you should add it to the beginning instead of the end, so that it will take precedence over system binaries.

I also suggest you undo the changes you made to ~/local/share/config.site (or remove the file, if it didn't exist), as options there will affect all automake-based projects.
You should rather pass CPPFLAGS and LDFLAGS as arguments to configure.

After all that, your command block should look something like:

wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
tar jxf geos-3.4.2.tar.bz2
cd geos-3.4.2
export PATH="/opt/alt/php53/usr/bin:$PATH"
./configure --enable-php --prefix="$HOME/local" CPPFLAGS="-I/opt/alt/php53/usr/include" LDFLAGS="/opt/alt/php53/usr/lib" && make clean && make
Siguza
  • 21,155
  • 6
  • 52
  • 89
  • Currently, trying and compiling your solution. The `.` was found using the `find` command. And the php installation is in the root folder meaning `/opt/alt/php53/user/bin`. Modified your solution in consequence. Still waiting for the end of the compilation. Thanks for the heads up though. And Yes I created the config.site based on my google research lol. I'm not used compiling stuff – delmalki Jul 23 '15 at 21:46
  • Alright, updated my answer. Just fyi, paths beginning with `./` are relative to the current directory, so you have to recalculate them when using them in another directory - or just make them absolute, as most build system (I've encountered) can't handle relative paths anyway. – Siguza Jul 24 '15 at 06:26