Thanks Graham. i have rebuilt my virtualenv. The first thing that I am 
doing is:

    ./configure --prefix=$PYTHON_INSTALL_DIR --enable-shared

So now my python 2.7.2 is built with enable-shared. I have the problem that 
now I need to tell the system where to find the python library. I do it 
like this:

    export LD_LIBRARY_PATH=/usr/local/python/2.7.2/lib:$LD_LIBRARY_PATH

Without this, I can not even run python (which I suppose is expected). 
There is probably a better way than setting LD_LIBRARY_PATH here and there, 
but I do not know it.

So this is working, everywhere, *except* within apache: the python started 
by apache can not find the libpython library. I have modified 
the /etc/init.d/apache2 apache, adding the export LD_LIBRARY_PATH command 
at the top of the file, but apache is still unable to find it. I get this 
error:

$ sudo /etc/init.d/apache2 restart
 * Restarting web server apache2
apache2: Syntax error on line 204 of /etc/apache2/apache2.conf: Syntax 
error on line 1 of /etc/apache2/mods-enabled/wsgi.load: Cannot load 
/usr/lib/apache2/modules/mod_wsgi.so into server: libpython2.7.so.1.0: 
cannot open shared object file: No such file or directory
   ...fail!



/usr/lib/apache2/modules/mod_wsgi.so exists, and has just been created:

$ ls -l /usr/lib/apache2/modules/mod_wsgi.so
-rw-r--r-- 1 root root 214591 2012-08-02 14:29 
/usr/lib/apache2/modules/mod_wsgi.so


Do you know why apache can not find the libpython library? Can you suggest 
a workaround?

Thanks,
Daniel

On Wednesday, August 1, 2012 11:47:44 PM UTC+2, Graham Dumpleton wrote:
>
> It falls into this class of problem. 
>
>
> http://code.google.com/p/modwsgi/wiki/InstallationIssues#Mixing_32_Bit_And_64_Bit_Packages
>  
>
> You need to ensure that your Python installation was configured with 
> the --enable-shared option when it was built and installed. 
>
> Graham 
>
> On 2 August 2012 07:19, Daniel Gonzalez <[email protected]> wrote: 
> > Hi, 
> > 
> > Coming from here, I am trying to build mod_wsgi-3.3 but I get a very 
> strange 
> > error: 
> > 
> > 
> > /tmp/mod_wsgi-3.3 # ./configure 
> > checking for apxs2... /usr/bin/apxs2 
> > checking Apache version... 2.2.14 
> > checking for python... /home/myuser/.virtualenvs/python2.7.2/bin/python 
> > configure: creating ./config.status 
> > config.status: creating Makefile 
> > /tmp/mod_wsgi-3.3 # make 
> > /usr/bin/apxs2 -c -I/usr/local/python/2.7.2/include/python2.7 -DNDEBUG 
> > mod_wsgi.c -L/usr/local/python/2.7.2/lib 
> > -L/usr/local/python/2.7.2/lib/python2.7/config  -lpython2.7 -lpthread 
> -ldl 
> > -lutil -lm 
> > /usr/share/apr-1.0/build/libtool --silent --mode=compile 
> > --tag=disable-static x86_64-linux-gnu-gcc -prefer-pic -DLINUX=2 
> > -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -I/usr/include/apr-1.0 
> > -I/usr/include/openssl -I/usr/include/xmltok -pthread 
> > -I/usr/include/apache2  -I/usr/include/apr-1.0   -I/usr/include/apr-1.0 
> > -I/usr/local/python/2.7.2/include/python2.7 -DNDEBUG  -c -o mod_wsgi.lo 
> > mod_wsgi.c && touch mod_wsgi.slo 
> > In file included from 
> /usr/local/python/2.7.2/include/python2.7/Python.h:8, 
> >                  from mod_wsgi.c:135: 
> > /usr/local/python/2.7.2/include/python2.7/pyconfig.h:1155:1: warning: 
> > "_POSIX_C_SOURCE" redefined 
> > In file included from /usr/include/sys/types.h:27, 
> >                  from /usr/include/apr-1.0/apr.h:131, 
> >                  from /usr/include/apache2/ap_config.h:25, 
> >                  from /usr/include/apache2/httpd.h:43, 
> >                  from mod_wsgi.c:34: 
> > /usr/include/features.h:158:1: warning: this is the location of the 
> previous 
> > definition 
> > In file included from 
> /usr/local/python/2.7.2/include/python2.7/Python.h:8, 
> >                  from mod_wsgi.c:135: 
> > /usr/local/python/2.7.2/include/python2.7/pyconfig.h:1177:1: warning: 
> > "_XOPEN_SOURCE" redefined 
> > In file included from /usr/include/sys/types.h:27, 
> >                  from /usr/include/apr-1.0/apr.h:131, 
> >                  from /usr/include/apache2/ap_config.h:25, 
> >                  from /usr/include/apache2/httpd.h:43, 
> >                  from mod_wsgi.c:34: 
> > /usr/include/features.h:160:1: warning: this is the location of the 
> previous 
> > definition 
> > /usr/share/apr-1.0/build/libtool --silent --mode=link 
> --tag=disable-static 
> > x86_64-linux-gnu-gcc -o mod_wsgi.la  -rpath /usr/lib/apache2/modules 
> -module 
> > -avoid-version    mod_wsgi.lo -L/usr/local/python/2.7.2/lib 
> > -L/usr/local/python/2.7.2/lib/python2.7/config -lpython2.7 -lpthread 
> -ldl 
> > -lutil -lm 
> > /usr/bin/ld: /usr/local/python/2.7.2/lib/libpython2.7.a(abstract.o): 
> > relocation R_X86_64_32 against `.rodata.str1.8' can not be used when 
> making 
> > a shared object; recompile with -fPIC 
> > /usr/local/python/2.7.2/lib/libpython2.7.a: could not read symbols: Bad 
> > value 
> > collect2: ld returned 1 exit status 
> > apxs:Error: Command failed with rc=65536 
> > . 
> > make: *** [mod_wsgi.la] Error 1 
> > 
> > 
> > Just for reference, I am building with this fabfile, but this is 
> actually 
> > not very related to the problem: 
> > 
> > from fabric.api        import env, run, sudo, cd 
> > from fabric.decorators import roles 
> > 
> > env.roledefs.update({ 
> >     'portal'   : ['host1'], 
> > }) 
> > 
> > env.use_ssh_config = True 
> > env.user           = 'myuser' 
> > 
> > @roles('portal') 
> > def install_wsgi(): 
> >     sudo('apt-get install apache2-prefork-dev') # For apxs2 
> >     e = dict(wsgi_version = '3.3', python_location = 
> > '/home/myuser/.virtualenvs/python2.7.2/bin/python') 
> > 
> >     with cd('/tmp'): 
> >         run('wget -nv 
> > 
> http://modwsgi.googlecode.com/files/mod_wsgi-{wsgi_version}.tar.gz'.format(**e))
>  
>
> >         run('tar xvfz mod_wsgi-{wsgi_version}.tar.gz'.format(**e)) 
> >     with cd('/tmp/mod_wsgi-{wsgi_version}'.format(**e)): 
> >         run('./configure --with-python={python_location}'.format(**e)) 
> >         #run('./configure') 
> >         run('make') 
> >         sudo('make install') 
> >         sudo('echo "LoadModule wsgi_module modules/mod_wsgi.so" > 
> > {apachedir}/conf.d/wsgi.conf'.format(**env)) 
> > 
> > 
> > Can somebody provide some guidance? 
> > 
> > Thanks, 
> > Daniel Gonzalez 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "modwsgi" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/modwsgi/-/ylx5OpoZf68J. 
> > To post to this group, send email to [email protected]. 
> > To unsubscribe from this group, send email to 
> > [email protected]. 
> > For more options, visit this group at 
> > http://groups.google.com/group/modwsgi?hl=en. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/modwsgi/-/eCtFMVhx69EJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to