Posts Tagged ‘error while loading shared libraries’

Extracting pages and page ranges, protect with password and remove password from PDF on GNU / Linux with QPDF – Linux Manipulating PDF files from command line

Friday, August 8th, 2014

qpdf-logo-extract-pages-page-ranges-protect-pdf-with-password-remove-password-from-pdf-linux-qpdf-manipulating-pdf-files-on-gnu-linux-and-bsd
If're a Linux user and you need to script certain page extraction from PDF files, crypt protect with password a PDF file or decrypt (remote password protection from PDF) or do some kind of structural transformation of existing PDF file you can use a QPDF command line utility. qpdf is in active development and very convenient tool for Website developers (PHP / Perl / Python), as often on websites its necessery to write code to cut / tailer / restructure PDFs.

1. Install QPDF from deb / rpm package

qpdf is instalalble by default in deb repositories on Debian / Ubuntu GNU / (deb derivative) Linux-es to install it apt-get it

apt-get install –yes qpdf

On RPM based distribution CentOS / SuSE / RHEL / Fedora Linux to install qpdf, fetch the respective distribution binary from rpmfind.net or to install latest version of qpdf build it from source code.

2. Install QPDF from source

To build latest qpdf from source

  • on RPM based distributions install with yum fullowing packages:

yum -y install zlib-devel pcre-devel gcc gcc-c++

  • on Deb based Linuces, you will need to install

apt-get install –yes build-essential gcc dpkg-dev g++ zlib1g-dev


Then to build gather latest qpdf source from here

 

cd /usr/local/src
wget -q https://www.pc-freak.net/files/qpdf-5.1.2.tar.gz
tar -zxvf qpdf-5.1.2.tar.gz
cd qpdf-5.1.2/
./configure
make
make install


Once it is installed, if you get error on qpdf runtime:
 

/usr/local/bin/qpdf: error while loading shared libraries: libqpdf.so.13: cannot open shared object file: No such file or directory

To solve the error find in your compile directory libqpdf.so.13 and copy it to /usr/lib or /usr/local/lib

 cp -rpf ./libqpdf/build/.libs/libqpdf.so.13 /usr/local/lib


3. Decrypt password encrypted (protected) PDF file

if you have time and you like reading be sure to check the extensive qpdf-manual.

To remove password from a PDF file protected with a password with qpdf

qpdf –password=SECRET-PASSWORD –decrypt input-file.pdf output-file.pdf

QPDF has a vast range of split and merge features. It can combine all the files in a folder (*.pdf), you can use it to try to recover damaged pdf files, extract individual pages from PDF, dump and reverse page range, make new created PDF with old PDF's reversed pages (pages 1,2,3,4 to become in order 4,3,2,1), apply some single pdf file metadata to multiple files.

4. Try to Recover damaged PDF file


To try to recover some damaged file with qpdf:
 

qpdf file-to-repair.pdf repaired-file.pdf

5. Extract certain pages or page range from PDF

It is recommended to use the version built from source to extract certain page range from PDF
 

/usr/local/bin/qpdf –empty –pages input-file.pdf 1-5 — outfile-file.pdf


If you wanted to take pages 1–5 from file1.pdf and pages 11–15 from file2.pdf in reverse, you would run
 

qpdf file1.pdf –pages file1.pdf 1-5 file2.pdf 15-11 — outfile.pdf

 

How to solve qmail /usr/local/bin/tcpserver: libc.so.6: failed to map segment from shared object: Cannot allocate memory

Saturday, April 30th, 2011

If you’re building (compiling) a new qmail server on some Linux host and after properly installing the qmail binaries and daemontools, suddenly you notice in readproctitle service errors: or somewhere in in qmail logs for instance in/var/log/qmail/current the error:

/usr/local/bin/tcpserver: error while loading shared libraries:
libc.so.6: failed to map segment from shared object: Cannot allocate memory

then you have hit a bug caused by insufficient memory assigned for tcpserver in your /var/qmail/supervise/qmail-smtpd/run daemontools qmail-smtpd initialize script:

This kind of issue is quite common especially on hardware architectures that are 64 bit and on Linux installations that are amd65 (x86_64) e.g. run 64 bit version of Linux.

It relates to the 64 bit architecture different memory distribution and thus as I said to solve requires increase in memory softlimit specified in the run script an example good qmail-smtpd run script configuration which fixed the libc.so.6: failed to map segment from shared object: Cannot allocate memory I use currently is as follows:

#!/bin/shQMAILDUID=`id -u vpopmail`NOFILESGID=`id -g vpopmail`MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`# softlimit changed from 8000000exec /usr/local/bin/softlimit -m 32000000 /usr/local/bin/tcpserver -v -H -R -l 0 -x /home/vpopmail/etc/tcp.smtp.cdb -c "$MAXSMTPD"
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp
/var/qmail/bin/qmail-smtpd
/home/vpopmail/bin/vchkpw /bin/true 2>&1

The default value which was for softlimit was:

exec /usr/local/bin/softlimit -m 8000000

A good softlimit raise up values which in most cases were solving the issue for me are:

exec /usr/local/bin/softlimit -m 3000000

orexec /usr/local/bin/softlimit -m 4000000

The above example run configuration fixed the issue on a amd64 debian 5.0 lenny install, the server hardware was:

CPU: Intel(R) Core(TM)2 Duo CPU @ 2.93GHz
System Memory: 4GB
HDD Disk space: 240GB

The softlimit configuration which I had to setup on another server with system parameters:

Intel(R) Core(TM) i7 CPU (8 CPUS) @ 2.80GHz
System Memory: 8GB
HDD Disk Space: 1.4Terabytes

is as follows:

#!/bin/sh
QMAILDUID=`id -u vpopmail`
NOFILESGID=`id -g vpopmail`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
exec /usr/bin/softlimit -m 64000000
/usr/local/bin/tcpserver -v -H -R -l 0
-x /home/vpopmail/etc/tcp.smtp.cdb -c "$MAXSMTPD"
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp
/var/qmail/bin/qmail-smtpd
/home/vpopmail/bin/vchkpw /bin/true 2>&1

If none of the two configurations pointed out in the post works, for you just try to manually set up the exec /usr/bin/softlimit -m to some high value.

To assure that the newly set value is not producing the same error you will have to, reload completely the daemontools proc monitor system.
To do so open /etc/inittab comment out the line:

SV:123456:respawn:/command/svscanboot
to
#SV:123456:respawn:/command/svscanboot

Save again /etc/inittab and issue te cmd:

linux:~# init q

Now again open /etc/inittab and uncomment the commented line:

#SV:123456:respawn:/command/svscanbootto
SV:123456:respawn:/command/svscanboot

Lastly reload the inittab script once again with command:

linux:~# init q

To check if the error has disappeared check the readproctitle process, like so:

linux:~# ps ax|grep -i readproctitle

The command output should produce something like:

3070 ? S 0:00 readproctitle service errors: .......................................

Hope that helps.

Linux release of the game Savage Wheels (Destruction Derby like game) is out!

Friday, September 17th, 2010

Savage Wheels Game for Linux

A close friend of mine Pro-Xex (a.k.a. Necroleak) has released Savage Wheels game for Linux.

The Savage Wheels game is a recreation of a game in a way similar to the good old Destruction Derby that most of the hard code old school arcade know very well.

The Savage Wheels has been an existant for a long time for a free download. However for a couple of years the Pro-XeX decided not to publish it’s code publicly, his considerations were that the code is too messy and not ready to go public.

For almost 2 years now the game source code has been existent openly for download from a source repository at google code

Though the source was there for download, until recently, the game source code was not ready to compile on Linux, though the game’s programming style used is 100% compatible with the Linux / BSD platform.

Right now the game is licensed under the MIT free software license
A few weeks before Peter (Pro-Xex) has contacted me and shared and told me the good news, that he has finally ported the game for the Linux platform and asked me to help him a bit with the game testing!
I thought this is pretty cool, but I was busy until this very day that I actually downloaded the compiled binary of Savage Wheels on my Debian Testing/Unstable (Squeeze/Sid) and gave it a try.

I’m running the 64 bit Debian release, featuring kernel version:

Linux noah 2.6.32-5-amd64 #1 SMP Wed Aug 25 13:59:41 UTC 2010 x86_64 GNU/Linux

Installing the game was a really easy all I had to do is download the archived binary of the game and untar it into a new directory I’ve created for the game.

hipo@noah:~$ mkdir savagewheels
hipo@noah:~$ cd savagewheels
hipo@noah:~/savagewheels$ wget -c http://savagewheels.googlecode.com/files/savagewheels-1.4-linux-x86.tar.gz
hipo@noah:~/savagewheels$ tar -zxvf savagewheels-1.4-linux-x86.tar.gz

It will take like few secs until the game source gets extracted:

To go and start up the game I directly tried executing the game main binary file savagewheels , like you can see below

hipo@noah:~/savagewheels$ ./savagewheels
./savagewheels: error while loading shared libraries: libfmod-3.75.so: cannot open shared object file: No such file or directory

The error in loading library was pretty unexpected, but counting the fact that I’m one of the first people that test the game on Linux I guess it’s pretty normal.
In order to resolve the missing shared library on game execution It was necessary to copy the libfmod-3.75.so to /usr/local/lib/

To do so I issued as a root user:

hipo@noah:/home/hipo/savagewheels# cp -rpf libfmod-3.75.so /usr/local/lib

In case if you don’t want to copy the libfmod-3.75.so into /usr/local/lib, it’s also possible to use the shell export command to specify the exact location of libfmod-3.75.so to your current known systemlibraries.

If you prefer it that way issue command:


hipo@noah:~/savagewheels$ export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH

Now when I invoked the savagewheels game binary once again:
hipo@noah:~/savagewheels$ ./savagewheels

the game poped up in a window.

As I’ve red in the Readme.html file it’s already noted there that by default the game would run in window mode instead of full screen due to some bugs or video drivers etc.
Happily it was indicated in the Readme file that in order to run it in fullscreen, it’s necessary to invoke the game binary with the -force-fullscreen option included, e.g. running it in fullscreen comes to:

hipo@noah:~/savagewheels$ ./savagewheels -force-fullscreen

At first I was a bit confused when the game poped up before I notice the left side menu which appears could be only reached with the mouse pointer. So I warn you that if you go to give the game a try you will probably wonder how to start up the game after the game entry window with menus appears.

Since the game is so new with Linux it has several bugs to be fixed, one of the bugs is that the Window in which the game pops up by default couldn’t be closed if you press the close window button.

Another thing I do notice is that when I play sometimes during a I crash another car, my car gets stucked for a while.

Another thing which is not very intuitive about the game is the player keys, they could be fount expolained in Readme.html

But I’ll post them here as well to facilitate my dear readers who might be willing to play the game immediately without reading boring docs 🙂

So Player 1 keys are:

arrow keys to move
UP (accelerate up)
LEFT (turn left) RIGHT (turn right)
DOWN (back gear)
RIGHT CTRL - to place landmines
DELETE - self destruction

I think giving the player 1 keys are enough for the player 2 control keys take a quick look in Readme.html

Here is the time to tell you that the game music is absolutely awesome!! So the game is worthy to play just because Pro-Xex has present the user with the wonderful soundtrack that is.

For some further general information related to the game you can read the Savage Wheels game Readme online from here

I would place the game among one of the best car crash games available currently for Linux, so if you’re a arcade game maniac you would probably have a great time with the game.