artemp/tickets2issues — Issue #95: Installing in a non-standard location as non-root user (PREFIX not working)
Author: artemp
Created: 2011-10-11 14:55:30+00:00
State: open
Labels: Scons_Build_Scripts

This ticket describes problems installing in a non-standard location as a non-root user; /tmp/mapnik fills in for the real installation location.

The desired installation would be as follows, and it should obtainable by specifying a single parameter (preferably "prefix" since that is what other build systems use).

{{{
xx [reid@magnify mapnik-src]$ find /tmp/mapnik -xtype d
/tmp/mapnik
/tmp/mapnik/bin
/tmp/mapnik/include
/tmp/mapnik/include/mapnik
/tmp/mapnik/lib
/tmp/mapnik/lib/mapnik
/tmp/mapnik/lib/mapnik/input
/tmp/mapnik/lib/mapnik/fonts
/tmp/mapnik/lib/python2.4
/tmp/mapnik/lib/python2.4/site-packages
/tmp/mapnik/lib/python2.4/site-packages/mapnik
/tmp/mapnik/lib/python2.4/site-packages/mapnik/ogcserver
}}}

(a) With ''python scons/scons.py PREFIX=/tmp/mapnik install'', the build fails. (Note also that the error message is misleading: a missing file is only a symptom; the real reason the build failed is that I don't have permission to write to the directory it's trying to install into.)

{{{
63 [reid@magnify mapnik-src]$ python scons/scons.py PREFIX=/tmp/mapnik install
scons: Reading SConscript files ...
Checking for main() in C library m... yes
Checking for main() in C library ltdl... yes
Checking for main() in C library png... yes
Checking for main() in C library tiff... yes
Checking for main() in C library z... yes
Checking for main() in C library jpeg... yes
Checking for main() in C library proj... yes
Checking for main() in C library pq... no
Checking for main() in C++ library boost_thread... yes
Checking for main() in C++ library boost_filesystem... yes
Checking for main() in C++ library boost_regex... yes
Checking for main() in C++ library boost_program_options... yes
Bindings Python version... 2.4
Python 2.4 prefix... /usr
scons: done reading SConscript files.
scons: Building targets ...
Install file: "bindings/python/mapnik/paths.py" as "/usr/lib/python2.4/site-packages/mapnik/paths.py"
scons: *** [/usr/lib/python2.4/site-packages/mapnik/paths.py] Exception
Traceback (most recent call last):
File "/tmp/mapnik-src/scons/scons-local-0.96.1/SCons/Taskmaster.py", line 101, in execute
self.targets[0].build()
File "/tmp/mapnik-src/scons/scons-local-0.96.1/SCons/Node/__init__.py", line 201, in build
apply(executor, (self, errfunc), kw)
File "/tmp/mapnik-src/scons/scons-local-0.96.1/SCons/Executor.py", line 115, in __call__
apply(action, (self.targets, self.sources, env, errfunc), kw)
File "/tmp/mapnik-src/scons/scons-local-0.96.1/SCons/Action.py", line 243, in __call__
stat = self.execute(target, source, env)
File "/tmp/mapnik-src/scons/scons-local-0.96.1/SCons/Action.py", line 512, in execute
return self.execfunction(target=target, source=rsources, env=env)
File "/tmp/mapnik-src/scons/scons-local-0.96.1/SCons/Environment.py", line 82, in installFunc
return install(target[0].path, source[0].path, env)
File "/tmp/mapnik-src/scons/scons-local-0.96.1/SCons/Defaults.py", line 219, in copyFunc
shutil.copy2(source, dest)
File "/usr/lib/python2.4/shutil.py", line 92, in copy2
copyfile(src, dst)
File "/usr/lib/python2.4/shutil.py", line 48, in copyfile
fdst = open(dst, 'wb')
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.4/site-packages/mapnik/paths.py'
scons: building terminated because of errors.
}}}

(c) With ''python scons/scons.py DESTDIR=/tmp/mapnik install'', the build succeeds, but the installation has extra ''/usr'' and ''/usr/local'' subpaths:

{{{
67 [reid@magnify mapnik-src]$ find /tmp/mapnik -xtype d
/tmp/mapnik
/tmp/mapnik/usr
/tmp/mapnik/usr/lib
/tmp/mapnik/usr/lib/python2.4
/tmp/mapnik/usr/lib/python2.4/site-packages
/tmp/mapnik/usr/lib/python2.4/site-packages/mapnik
/tmp/mapnik/usr/lib/python2.4/site-packages/mapnik/ogcserver
/tmp/mapnik/usr/local
/tmp/mapnik/usr/local/bin
/tmp/mapnik/usr/local/lib
/tmp/mapnik/usr/local/lib/mapnik
/tmp/mapnik/usr/local/lib/mapnik/input
/tmp/mapnik/usr/local/lib/mapnik/fonts
/tmp/mapnik/usr/local/include
/tmp/mapnik/usr/local/include/mapnik
}}}

(c) With ''python scons/scons.py PREFIX=/tmp/mapnik DESTDIR=/ install'', the build fails in the same way as (a).

(d) With ''python scons/scons.py PREFIX=/ DESTDIR=/tmp/mapnik install'', the build succeeds, but the extra ''/usr'' subpaths are still present:

{{{
72 [reid@magnify mapnik-src]$ find /tmp/mapnik -xtype d
/tmp/mapnik
/tmp/mapnik/usr
/tmp/mapnik/usr/lib
/tmp/mapnik/usr/lib/python2.4
/tmp/mapnik/usr/lib/python2.4/site-packages
/tmp/mapnik/usr/lib/python2.4/site-packages/mapnik
/tmp/mapnik/usr/lib/python2.4/site-packages/mapnik/ogcserver
/tmp/mapnik/bin
/tmp/mapnik/lib
/tmp/mapnik/lib/mapnik
/tmp/mapnik/lib/mapnik/input
/tmp/mapnik/lib/mapnik/fonts
/tmp/mapnik/include
/tmp/mapnik/include/mapnik
}}}