gpt4 book ai didi

c++ - libfastcgipp < 加载共享库时出错

转载 作者:太空宇宙 更新时间:2023-11-04 11:24:48 24 4
gpt4 key购买 nike

对 c++ 很陌生,虽然用其他语言编写了几年代码。我整天都被这个问题困住了,我似乎无法弄清楚。

当我运行此处发布的代码时:http://www.nongnu.org/fastcgipp/doc/2.1/a00004.html我收到以下错误消息:

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

使用 ubuntu 13.10

我可以毫无问题地构建代码,但无法运行它。 /usr/local/lib/

中有一个 libfastcgipp.so.2和一个 libfastcgipp.so

我尝试从 /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

关于c++ - libfastcgipp < 加载共享库时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27080554/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com