When installing python3.3 for the first time, it looks like this ↓ (See some site.)
$ ./configure --prefix=/usr/local
$ make
$ make altinstall
I was trying to create a pyramid project by putting virtualenv in this environment, so I tried to build apache + mod_wsgi again for deployment.
For the time being, recompile python3.3 with additional parameters
$ cd /path/to/Python-3.3.0
$ ./configure CFLAGS=-fPIC --enable-shared --prefix=/usr/local
$ make
$ make install
$ echo $?
It seemed like there was no problem so far ... but
$ python3.3
python3.3: error while loading shared libraries: libpython3.3m.so.1.0: cannot open shared object file: No such file or directory
$
It says that the so file cannot be found.
It was certainly in / usr / local / lib, so this time I added the path to /etc/ld.so.conf
and escaped with ldconfig.
$ wget http://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz
$ tar zxvf mod_wsgi-3.4.tar.gz
$ cd mod_wsgi-3.4
$ ./configure CFLAGS=-fPIC --with-python=/usr/local/bin/python3.3
$ make
(Omission)
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la -rpath /usr/lib64/httpd/modules -module -avoid-version mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.3/config -lpython3.3 -lpthread -ldl -lutil -lm
/usr/bin/ld: cannot find -lpython3.3
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
$
I got an unexpected error and stopped. I checked what the file status is after reinstalling python.
$ ls -lt /usr/local/lib/python3.3/
(Abbreviation)
drwxr-xr-x 4 root root 4096 Feb 3 23:57 concurrent
drwxr-xr-x 2 root root 4096 Feb 3 23:57 config-3.3m
-rw-r--r-- 1 root root 49499 Feb 3 23:57 configparser.py
(Abbreviation)
I'm not sure if the build was special, apparently in the form /usr/local/lib/python3.3/config-3.3m
instead of /usr/local/lib/python3.3/config
It seems that a directory will be created.
So next
$ ls -lt /usr/local/bin/
(Abbreviation)
lrwxrwxrwx 1 root root 16 Feb 3 23:57 python3-config -> python3.3-config
lrwxrwxrwx 1 root root 17 Feb 3 23:57 python3.3-config -> python3.3m-config
lrwxrwxrwx 1 root root 9 Feb 3 23:57 python3 -> python3.3
-rwxr-xr-x 1 root root 1970 Feb 3 23:57 python3.3m-config
(Abbreviation)
-rwxr-xr-x 2 root root 13347 Feb 3 23:57 python3.3
-rwxr-xr-x 2 root root 13347 Feb 3 23:57 python3.3m
(Abbreviation)
Since python3.3 and python3.3m existed and -config was finally looking at python3.3m-config, I guess that the specification of -lpython3.3
is bad.
So, finally I decided to rewrite the Makefile generated at configure like this
< LDFLAGS = -L/usr/local/lib -L/usr/local/lib/python3.3/config
< LDLIBS = -lpython3.3 -lpthread -ldl -lutil -lm
---
> LDFLAGS = -L/usr/local/lib -L/usr/local/lib/python3.3/config-3.3m
> LDLIBS = -lpython3.3m -lpthread -ldl -lutil -lm
$ make
(Abbreviation)
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_wsgi.la -rpath /usr/lib64/httpd/modules -module -avoid-version mod_wsgi.lo -L/usr/local/lib -L/usr/local/lib/python3.3/config-3.3m -lpython3.3m -lpthread -ldl -lutil -lm
$
$ make install
Oh, make finished normally. So install it as it is above. I was able to restart apache without any problems.
I haven't confirmed if mod_wsgi works well yet.
Recommended Posts