Install PhantomJS 1.6 on Centos 5.8

2

I'm trying to get PhantomJS v1.6 installed on my Centos 5.8 server. I'm running into the following error when trying to run phantomjs:

phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by phantomjs)
phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by phantomjs)
phantomjs: /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libc.so.6: version `GLIBC_2.7' not found (required by phantomjs)
phantomjs: /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libc.so.6: version `GLIBC_2.7' not found (required by /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libQtGui.so.4)
phantomjs: /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libc.so.6: version `GLIBC_2.11' not found (required by /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libQtGui.so.4)
phantomjs: /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libc.so.6: version `GLIBC_2.9' not found (required by /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libQtGui.so.4)
phantomjs: /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libc.so.6: version `GLIBC_2.10' not found (required by /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libQtNetwork.so.4)
phantomjs: /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libc.so.6: version `GLIBC_2.9' not found (required by /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libQtCore.so.4)
phantomjs: /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libc.so.6: version `GLIBC_2.11' not found (required by /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libfreetype.so.6)
phantomjs: /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libc.so.6: version `GLIBC_2.7' not found (required by /usr/phantomjs-1.6.0-linux-x86_64-dynamic/bin/../lib/libfontconfig.so.1)

Some research leads me to believe that these are pretty low level system files that I'm not sure I should mess with. Any ideas how to get this running on my server?

starsinmypockets

Posted 2012-07-03T18:28:55.413

Reputation: 121

Answers

3

It's looking for versioned symbols in glibc and libstdc++. The versions in the libs on your system are older so don't match, which makes sense, since CentOS tracks RedHat AdvancedServer, which is pretty conservative when it comes to new software.

You can check the symbols in your libstdc++ this way:

nm -D /usr/lib64/libstdc++.so.6 | grep GLIBC

nm dumps named symbols, -D for dynamic libs, and grep for your names

Hmm, these are pretty core libs. libstdc++ is used by any app that uses C++ on your OS. glibc is used by pretty much everything. You probably don't want to update these in place, and even if you did, you'd probably lose your updates on the next system update.

I had a similar issue with Firefox, you can deal with it this way:

  • Find a Fedora RPM repository. This site seems useful.
  • Pick a version. Don't worry too much about which one; if it doesn't work, we'll try again
  • Find the libc and libstdc++ x86_64 RPMs for the version you picked. Download it.
  • Go to a tmp dir and uncompress it: rpm2cpio libstdc++WHATEVER.rpm | cpio -iv --make-directories
  • make another directory, this one needs to stay around a bit. Find a place in /usr/local or your home dir. I'd say, maybe, $HOME/lib/lib64 just to give it a name. Replace name as needed. mkdir $HOME/lib/lib64
  • Find the libstdc++.so.6 file and copy to $HOME/lib/lib64.

Now you have the lib you need in $HOME/lib/lib64 (or wherever you stuck it). Now when you run your app, you need to tell it how to look for the new lib.

  • LD_LIBRARY_PATH=$HOME/lib/lib64:$LD_LIBRARY_PATH appThatNeedsNewLib arg1 arg2

Be prepared to do this multiple times - when I did this getting the right libstdc++ version exposed other old files that I needed to download updates to as well.

Rich Homolka

Posted 2012-07-03T18:28:55.413

Reputation: 27 121

3

Applies to: PhantomJS 1.6. And Tested on Centos 5.6

You can compile it from source and it will work as charm.

./build.sh

After building do deploy which you can run anywhere you want simply copy and replace files where its giving you that error.

I had same issue i compiled it from source, and copied required file. (i am assuming as i did: complied in diff server and copied files across but you can always do that in same server aswell)

Downloaded into usr/local/src and compiled. copied required file to original place

cp -rP /usr/local/src/phantomjs-1.6.0-linux-x86_64-dynamic/bin/phantomjs* /data/phantomjs/bin/
cp -rP /usr/local/src/phantomjs-1.6.0-linux-x86_64-dynamic/lib/l* /data/phantomjs/lib/

Warnning: Compiling PhantomJS from source takes a long time, mainly due to thousands of files in the WebKit module. With 4 parallel compile jobs on a modern machine, the entire process takes roughly 30 minutes. It is highly recommended to install the ready-made binary package if it is available. Linux

Note 1: build.sh by default will launch 4 (four) parallel compile jobs. When building on a virtual machine/server or other limited environment, reduce the jobs by passing a number, e.g ./build.sh --jobs 1 to set only one compile job at a time.

tike

Posted 2012-07-03T18:28:55.413

Reputation: 151