PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue May 23, 2017 3:34 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Building a CGI
PostPosted: Sun Jan 27, 2013 6:01 pm 
Offline
DevNet Resident

Joined: Sun Jun 14, 2009 3:13 pm
Posts: 1146
I have one binary running fine on my host environment but it causes a segmentation fault on the server. All the other bins with their shared libraries run fine, except this one. There was just no output. I had the tech support run it in a shell and they can see the segmentation fault. So I realized I'm not seeing the stderr output...

Is there anyway to get the stderr output on a shared host?

BTW does a segmentation fault mean there is some kind of difference between my host and the target? I know the kernel looks slightly different patch levels. Can binaries be built remotely on a shared host? I guess that's my next step.

EDIT: I found I can pipe them with 2> error.txt with bash to capture stderr. This will save me a lot of configuration guessing.


Top
 Profile  
 
 Post subject: Re: Building a CGI
PostPosted: Mon Jan 28, 2013 11:07 am 
Offline
DevNet Resident

Joined: Sun Jun 14, 2009 3:13 pm
Posts: 1146
Since I don't often build from source, the solutions to my problems weren't obvious. So I'll share what ended up working. I was surprised to find that I could access gcc though the bash shell and this allowed me to build the bins on the server itself.

The tricks required to compile everything remotely were two switches:
--prefix and --exec-prefix

These allow one to define where the bins and info/library will be installed. Here's an example bash install script that you would run in your $HOME/cgi-bin/ directory.
Syntax: [ Download ] [ Hide ]
#!/bin/bash
#Your full absolute path is required
HOME="/home/user/public_html";
#what you want to reference this application as (creates subdirectory too)
APP="grib-api";
echo "Content-type: text/html";
echo "";
echo '<html>';
echo '<head>';
echo "<title>Build $APP Program</title>";
echo '</head>';
echo '<body>';
echo '<h2>Downloading, Expanding, Building</h2>';
echo "<pre>";
curl -LO -k https://software.ecmwf.int/wiki/downloa ... 0.0.tar.gz
gunzip grib_api-1.10.0.tar.gz
tar -xvf grib_api-1.10.0.tar
mkdir $APP
chmod 777 $APP
cd grib_api-1.10.0
chmod 755 configure
./configure --prefix=$HOME/cgi-bin/grib_api/ --exec-prefix=$HOME/cgi-bin/$APP/ --disable-jpeg 2>config-$APP-errors.txt
make 2> make-$APP-errors.txt
make install 2> install-$APP-errors.txt
echo ""
echo "CONFIG ERRORS:"
cat config-$APP-errors.txt
echo ""
echo "MAKE ERRORS:"
cat make-$APP-errors.txt
echo ""
echo "INSTALL ERRORS:"
cat install-$APP-errors.txt
echo "</pre></body></html>"

Once it is installed you can go back and set the permission levels to the necessary settings and remove the source and tarballs. Building additional binaries that require shared libraries is easier too with everything in one location on the server.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group