I'm on CentOS and trying to configure Apache to use mod_wsgi compiled against Anaconda Python 3.5. Compiling mod_wsgi seems to go OK:
sudo yum install httpd-devel
sudo ./configure --with-python=/opt/anaconda/anaconda3/bin/python
sudo make
ls -l /etc/httpd/modules/mod_wsgi.so
-rwxr-xr-x. 1 root root 702205 Mar 2 23:12 /etc/httpd/modules/mod_wsgi.so
But when I start the web server it can't seem to find its libraries:
sudo service httpd start
Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf:
Syntax error on line 1 of /etc/httpd/conf.d/wsgi.conf: Cannot load
/etc/httpd/modules/mod_wsgi.so into server: libpython3.5m.so.1.0: cannot
open shared object file: No such file or directory
libpython3.5m.so.1.0 is definitely in /opt/anaconda/anaconda3/lib, so I suppose the mod_wsgi.so module doesn't know where to look for it. Yet the mod_wsgi config.status seems to confirm that
S["LDFLAGS"]=" -L/opt/anaconda/anaconda3/lib -L/opt/anaconda/anaconda3/lib/python3.5/config-3.5m "
so I'm at a loss... Can anyone point me in the right direction?
EDIT: OK, thanks to #mata, I think I've compiled mod_wsgi against the correct libraries. But now the server logs just fill up with the same repeated message:
Current thread 0x00007f60d68d07e0 (most recent call first):
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
So I'm guessing apache is looking in the wrong place for the python libraries. The 00-wsgi.conf file giving all the trouble reads:
WSGIPythonHome /opt/anaconda/anaconda3
WSGIPythonPath /opt/anaconda/anaconda3/lib/python3.5/site-packages
LoadModule wsgi_module modules/mod_wsgi.so
so I thought (from what I've read on other threads about this) that I'd told it where to look for my Python install.
That means that the library libpython3.5m.so.1.0 can't be found at runtime because the directory /opt/anaconda/anaconda3/lib is not a place where the dynamic linker would look for it.
You can try to rebuild mod_wsgi using:
./configure LDFLAGS='-Wl,-rpath=/opt/anaconda/anaconda3/lib' --with-python=/opt/anaconda/anaconda3/bin/python
That will save the library path within the generated binary.
The other option would be to set the LD_LIBRARY_PATH environment variable for the apache process, which is not really a good method.
Or add the directory /opt/anaconda/anaconda3/lib to the library search path using a conf file in /etc/ld.so.conf.d/, that would be a global setting tough. See man ld-linux for more info.
Also, don't forget to correctly set the WSGIPythonHome directive in your config file.
edit:
I've done some experimenting and I could reproduce your second error message when the python3 binary is not found on the PATH.
In that case it seems setting the WSGIPythonHome directive is not enough, you need to set the PYTHONHOME environment variable before apache is started, or change PATH so the interpreter can be found. On CentOS changing /etc/sysconfig/httpd should do the trick, just add:
export PYTHONHOME=/opt/anaconda/anaconda3
# alternatively this should also work:
export PATH="$PATH:/opt/anaconda/anaconda3/bin"
Or create a symlink to the interpreter in a directory on the path, e.g. /usr/local/bin...
For reference, an extended explanation why this is needed can be found here
Related
I am working with Ubuntu 16.04.2 LTS.
I have been following a guide
How To Set Up uWSGI and Nginx to Serve Python Apps on Ubuntu 14.04. Once I have set up the virtualenv I follow the instructions:
pip install uwsgi
You can verify that it is now available by typing:
uwsgi --version
If it returns a version number, the uWSGI server is available for use.
However when I do this I get:
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open
shared object file: No such file or directory
If I push on and work further through the guide things fall over when I try use uwsgi.
My research tells me that PCRE is Perl Compatible Regular Expressions and several people have asked questions online with libpcre.so.1 issues with other applications.
For example a response to a similar issue relating to nginx:
The message means what it says. The nginx executable was compiled to
expect the PCRE (Perl-compatible Regular Expression) shared library to
be available somewhere on LD_LIBRARY_PATH or specified in
/etc/ld.so.conf or whatever equivalent library-locating mechanisms
apply to your operating system, and it cannot find the library.
You will need to install PCRE - or configure your environment so that
nginx will look for the PCRE library where it is installed.
But I can't find much relevant to installing PCRE or configuring it. Most install instructions use: apt-get install libpcre3 libpcre3-dev and then reinstalling uwsgi pip install uwsgi -I. As in this example. Where I have tried everything posted and got nowhere.
I think my principle issue is that I don't understand the problem very well or how to do the things mentioned in the nginx example above.
Any insight or guidance would be much appreciated.
Even though my context may be different, the following steps should help you as well.
I did pip install uwsgi into my environment created by conda create -yn <env_name> python. Note, that one wouldn't even need to install PCRE into the environment, because it is included with Anaconda. We can see this issue in the environment, after source activate <env_name>:
# uwsgi --version
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open...
With root/sudo access you can find where libpcre.so.1 is/will be:
# find / -name libpcre.so.1
/opt/anaconda3/lib/libpcre.so.1
Now let Linux know how to access it:
# ldconfig /opt/anaconda3/lib/
That's all you need to make it work. You can see the change you are making:
# find / -name uwsgi
/opt/anaconda3/envs/<env_name>/bin/uwsgi
# ldd -d /opt/anaconda3/envs/<env_name>/bin/uwsgi
linux-vdso.so.1 => (0x00007fff2d1ba000)
...
/lib64/ld-linux-x86-64.so.2 (0x00007ff98dbc5000)
undefined symbol: pcre_free (/opt/anaconda3/envs/cts/bin/uwsgi)
PS Turned out ldconfig above populates global cache /etc/ld.so.cache, which, in my case, clashed with system library (/lib/x86_64-linux-gnu/libdbus-1.so.3). So I had to revert the change by running ldconfig without parameters and resort to runtime linking = starting uwsgi as
# LD_LIBRARY_PATH=/opt/anaconda3/lib uwsgi --version
I'm using apache httpd on SUSE 12.2 and want to enable mod_heartbeat. However it does't seem to have mod_heartbeat module file in any of the module directories. When I try to enable the module I get an error that the module cannot be found.
I installed apache via zypper install apache2 which installs version 2.2.2 but doesn't include the module. I also tried to search for additional mods using zypper search apache but didn't find the heartbeat mod there either.
Finally I downloaded the sources for apache 2.4 and compiled them. I didn't get any compile errors and the files were compiled to /usr/local/apache2. The Directory /usr/local/apache2/modules contains several mods but no mod_heartbeat.
Any ideas what I'm doing wrong or how I can compile or obtain the missing module file?
The source for several modules including mod_heartbeat can be obtained at https://github.com/omnigroup/Apache/tree/master/httpd/modules/cluster
I have kept libawesomium.1.6.5.so and libawesomium.1.6.5.so.0 files in /usr/lib/awesomium.1.6.5 folder, and given the path for this .so library in ld.co.config.d, in a new .conf file, but when I run my project it gives me a
System.dll not found exception for libawesomium.1.6.5.so.0 at (wrapper managed-to-native).
How to solve this error.
when i check the existence of this library through
sudo ldconfig -p | grep libawesomium-1.6.5.so
command, it gives me the following output:
libawesomium-1.6.5.so.0 (libc6) => /usr/lib/awesomium-1.6.5/libawesomium-1.6.5.so.0
It means it exists. But still at run-time my project is giving this error :
System.dllnotfoundexception libawesomium-1.6.5.so.0
I am working on monodevelop, so can someone suggest me please what is the thing that i am missing. Is there some addon i have to install or some terminal command i have to follow. Hoping for quick responses.
Regards
Rohit
You should be able to add LIBDIR=/lib to /etc/ld.so.conf and then issue ldconfig. If not, then you might be using a VMX or other type of setup that would require to you use the linker with -W/lib for example.
i have need 2 days to find a solution for this problem!
On Linux Wheezy 32bit you need to install libjpeg62 ...
apt-get install libjpeg62
this will fix the problem! ...
In Windows, using Cygwin: How can I get the shebang line in a shell file to load the PHP interpreter?
I am using the prggmr library.
By default, in the shell file this is what I have
#!/usr/bin/php
And it works if I type this into Cygwin:
php c:/path/to/file
I have PHP and this Library setup in my environment paths so I can just type prggmr. So by typing "prggmr" it should work, but i keep getting
/cygdrive/c/lib/prggmr/bin/prggmr: /cygdrive/c/wamp/bin/php/php5.4.3:
bad interpreter: Permission denied
I have tried these with no luck, the same error as above:
#!/c/wamp/bin/php/php5.4.3
#!/cygdrive/c/wamp/bin/php/php5.4.3
If I'm reading your Paths right you have a Win32 PHP installed that you want to use with PHP. Normally, I'd say don't do it this way as things are going to get confused. Better to install PHP in Cygwin directly imo. There are a few resources out there, check out
this one for a good starting point.
I am trying to install Code::Blocks 10.05 from (non-SVN) sources (codeblocks-10.05-src.tar.bz2). My OS is Ubuntu 11.04. I needed to download and install wxWidgets first (I now have wxGTK-2.8.12), which seemed to work. I compiled it according to these instructions:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux
Then I configured C::B with
./configure --with-wx-config=/opt/wx/2.8/bin/wx-config
and ran
export LDFLAGS="-Wl,-R /opt/wx/2.8/lib"
make
sudo -i
make install
When trying to run C::B, I get the following error:
codeblocks: error while loading shared libraries: libwx_gtk2u-2.8.so.0: cannot open shared object file: No such file or directory
The same question was asked here: error while loading shared libraries, but the suggested solution (namely adding the wxWidgets config to the options passed to configure) didn't work for me.
The output of wx-config --prefix is /opt/wx/2.8,
The output of wx-config --libs is -L/opt/wx/2.8/lib -pthread -lwx_gtk2u-2.8,
and that of which wx-config is /opt/wx/2.8/bin/wx-config.
I looked for the library and found /opt/wx/lib/libwx_gtk2u-2.8.so.0 to be a link to libwx_gtk2u-2.8.so.0.8.0 in the same folder.
What might be wrong here?
The problem is that the program cannot find the WX widgets libraries at run time. You will need to set your LD_LIBRARY_PATH variable to include the location of wxWidgets like this:
LD_LIBRARY_PATH=/opt/wx/2.8/lib ./codeblocks
The reason why its failing is because you compiled codeblocks against wxWidgets found in /opt/ and not the one installed in /usr/; the program doesn't know to look in /opt for the wx libraries.
Probably the easiest way to get code::blocks up and running on Ubuntu is to just install it via the Synaptic Package Manager. Just type in codeblocks into 'Quick search'. Find codeblocks on the list and just right-click to mark for install. Any dependencies and missing libraries needed will automatically be handled and installed by Synaptic as necessary.
If you're interested in trying the C::B nightly builds on Ubuntu then you'll want to checkout Jens' unofficial debian-repository here.
You can visit Why do I have to define LD_LIBRARY_PATH with an export every time I run my application? for a more generic case. For a particular case like yours you can follow the below given steps
If you had installed wxGTK then you would see the file in /usr/local/lib. You would get this error when the the above path is not as part of the makefile. I received this error while starting wxFormBuilder after building from source on CentOS. There are 2 approaches.
Approach 1: Putting the path in .bashrc
gedit /home/{your-username}/.bashrc
Then after the line # User specific aliases and functions paste the following
export $LD_LIBRARY_PATH=/usr/local/lib.
This would work for fine but for the current login, but for other users like root you might have to do the same in the respective .bashrc files.
Approach 2: Creating your own conf files
cd /etc/ld.so.conf.d
gedit wxformbuilder.conf
Give the path /usr/local/lib and save the file.
ldconfig (To update the library path).