c++fastcgi++

libfastcgipp < error while loading shared libraries


Pretty new to c++, coded a few years in other languages though. I been stuck all day with this issue that I can't seem to figure out.

When I run the code published here: http://www.nongnu.org/fastcgipp/doc/2.1/a00004.html I get the following error message:

error while loading shared libraries: libfastcgipp.so.2: cannot open shared object file: No such file or directory

Using ubuntu 13.10

I can build the code with out problem, but not run it. There is a libfastcgipp.so.2 and libfastcgipp.so in /usr/local/lib/

I tryed creating a symlink from /usr/lib/libfastcgipp.so


edit

Result from ldd command...

ldd joppli.bot.dummy 
    linux-vdso.so.1 =>  (0x00007fff497fe000)
    libboost_system.so.1.53.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.53.0 (0x00007f8b1828f000)
    libboost_thread.so.1.53.0 => /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.53.0 (0x00007f8b18079000)
    libfastcgipp.so.2 => not found
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8b17d74000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8b17b5e000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8b17795000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8b1758d000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8b17370000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8b1706b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f8b184b6000)

Solution

  • I solved the issue by creating a symlink to the file as first explained above, but added the trailing number 2, the version number, at the end.

    e.g: ln -s /usr/local/lib/libfastcgipp.so.2.0.0 /usr/lib/libfastcgipp.so.2


    UPDATE

    Ran in to this issue again and couldn't figure out the same issue again, so I'm posting a docker file that will get your fastCGI++ script running (probably only me that will use this, but anyway ...)

    The fastcgi++2.1 source: http://www.nongnu.org/fastcgipp/

    FROM ubuntu:14.04
    
    ENV DEBIAN_FRONTEND noninteractive
    
    RUN ln -snf /usr/share/zoneinfo/Europe/Stockholm /etc/localtime \
      && echo "Europe/Stockholm" > /etc/timezone
    
    ENV TERM xterm
    
    RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse" >> /etc/apt/sources.list
    RUN echo "deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse" >> /etc/apt/sources.list
    RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse" >> /etc/apt/sources.list
    RUN echo "deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse" >> /etc/apt/sources.list
    
    RUN apt-get -y update && apt-get -y install \
      build-essential \
      libboost-all-dev \
      git \
      apache2 \
      libapache2-mod-fastcgi
    
    COPY dependencies/fastcgi++-2.1.tar.bz2 /tmp/fastcgi++-2.1.tar.bz2
    
    RUN cd /tmp \
      && tar xvf fastcgi++-2.1.tar.bz2 \
      && cd fastcgi++-2.1 \
      && ./configure \
      && make \
      && make install
    
    RUN ln -s /usr/local/lib/libfastcgipp.so.2.0.0 /usr/lib/libfastcgipp.so.2
    
    COPY rep /tmp/app
    
    RUN cd /tmp/app \
      && g++ main.cpp -o example -std=gnu++11 -lfastcgipp -lboost_system -lboost_thread \
      && mv example /var/www/example
    
    COPY config/apache/default.conf /etc/apache2/sites-available/example.conf
    COPY config/apache/.htaccess /var/www/.htaccess
    RUN mkdir -p /tmp/log/apache/
    RUN a2enmod rewrite
    RUN a2dissite 000-default
    RUN a2ensite example.conf
    RUN service apache2 restart
    
    RUN apt-get autoremove -y && apt-get clean all
    
    EXPOSE 80
    
    CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
    

    config/apache/default.conf

    ServerName example
    
    <VirtualHost *:80>
        DocumentRoot /var/www
    
        <Directory />
            Options FollowSymLinks
            AllowOverride None
        </Directory>
    
        SetHandler fastcgi-script
    
        <Directory "/var/www">
            AllowOverride All
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
        </Directory>
    
        ErrorLog /tmp/log/apache/error.log
    
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
    
        CustomLog /tmp/log/apache/access.log combined
    </VirtualHost>
    

    .htaccess

    RewriteEngine On
    
    RewriteRule (.+)/$ /$1 [L,R=301]
    
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ example [NC,L]
    
    DirectoryIndex example