Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
987 views
in Technique[技术] by (71.8m points)

linux - Trying to run PhantomJS on OpenShift: cannot patch GhostDriver so that it can bind on the server IP address

tl;dr

How to solve version 'GLIBCXX_3.4.15' not found when I cannot be root on the Linux server?


I'm tring to use PhantomJS on OpenShift. As explained in this article, PhantomJS GhostDriver binds on localhost only, while on OpenShift, you cannot bind anything on localhost (you need to specify the machine IP address). Paolo Bernardi (the author of the article) shares a patch that fixes PhantomJS, so that it's possible to bind on an IP address.

The problem is that the provided patch does not work on my OpenShift server: when running ./phantomjs -v on my patched PhantomJS installation, I catch a segmentation fault. So I decided to compile PhantomJS with the fix by myself on a Debian server I have, thanks to PhantomJS documentation:

sudo apt-get install build-essential g++ flex bison gperf ruby perl libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev libpng-dev libjpeg-dev python ttf-mscorefonts-installer
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
# apply the fix
./build.sh

When running ./phantomjs -v on the compiled binary, I get 1.9.8: it worked.

When copying this binary on OpenShift and running ./phantomjs -v, I catch an error:

./phantomjs: /usr/lib64/libstdc++.so.6: version 'GLIBCXX_3.4.15' not found (required by ./phantomjs)

Any idea how to solve this? What's the reason of this error? Please excuse my lack of system knownledge :)


Update (and solution):

Thanks to moleculartear, I compiled a patched binary on an RHEL OS: no error anymore!

The working PhantomJS binary: https://github.com/jrestful/server/blob/master/seo/phantomjs-1.9.8-patched.tar.gz?raw=true


More details:

I cannot update GLIBC version on OpenShift since I cannot be root (unless there are some workarounds).

I cannot compile PhantomJS on OpenShift directly since I don't have enough space for the sources on that server.

My OpenShift cartridges: Tomcat 7 (JBoss EWS 2.0) + MongoDB 2.4 + RockMongo 1.1.

On my Debian server:

$ uname -a
Linux servername 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64 GNU/Linux

$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.2
GLIBCXX_DEBUG_MESSAGE_LENGTH

On my OpenShift server:

$ uname -a
Linux servername 2.6.32-504.3.3.el6.x86_64 #1 SMP Fri Dec 12 16:05:43 EST 2014 x86_64 x86_64 x86_64 GNU/Linux

$ strings /usr/lib/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBC_2.0
GLIBC_2.3
GLIBC_2.4
GLIBC_2.1
GLIBC_2.1.3
GLIBC_2.3.2
GLIBC_2.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Since OpenShift Online runs on RHEL, you should be able to install CentOS into a VM on your local machine (or run one in the cloud somewhere) and compile a version of PhantomJS with the patch and then upload it to your OpenShift server and use it.

If you can't do that please use the contact us form at help.openshift.com and reference this stackoverflow question.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...