C++相当新,尽管用其他语言编写了几年。
我整天都被这个问题困扰,似乎无法解决。
当我运行此处发布的代码时:http://www.nongnu.org/fastcgipp/doc/2.1/a00004.html
我收到以下错误消息:
使用ubuntu 13.10
我可以毫无问题地构建代码,但不能运行它。 libfastcgipp.so.2
中有一个libfastcgipp.so
和/usr/local/lib/
我尝试从/usr/lib/libfastcgipp.so
创建一个符号链接(symbolic link)
编辑
ldd命令的结果...
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)
最佳答案
如上所述,我通过创建到文件的符号链接(symbolic link)来解决此问题,但在末尾添加了结尾编号2
(版本号)。
例如:ln -s /usr/local/lib/libfastcgipp.so.2.0.0 /usr/lib/libfastcgipp.so.2
更新
再次遇到这个问题,无法再次发现相同的问题,所以我发布了一个docker文件,它将使您的fastCGI ++脚本运行(可能只有我会使用它,但是无论如何...)
fastcgi ++ 2.1来源: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