| Summary: | python-scons-native: invoke scons failed on Fedora-17 while the destro didn't install scons | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Hongxu Jia <hongxu.jia> |
| Component: | devtools / tool chain | Assignee: | Hongxu Jia <hongxu.jia> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Medium | CC: | hongxu.jia, kai.kang, liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher, ning.zhang, Qi.Chen, sen.zhang, sgw, yi.zhao |
| Version: | 1.5 | ||
| Target Milestone: | 1.5 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | --- | |
*env Build Configuration: BB_VERSION = "1.19.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "Fedora-17" TARGET_SYS = "i586-poky-linux" MACHINE = "emenlow" DISTRO = "poky" DISTRO_VERSION = "1.4+snapshot-20130527" TUNE_FEATURES = "m32 core2" TARGET_FPU = "" meta meta-yocto meta-yocto-bsp = "hongxu-0524:e8197722de1f6006ceae0d4266de91c1db7278e3" meta-intel meta-emenlow = "master:2c9fb03aad0108f3ff2713de568632a117227c10" *problem 1, The destro didn't install scons: $ which scons /usr/bin/which: no scons in (/buildarea2/hongxujia/poky/scripts:/buildarea2/hongxujia/poky/bitbake/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin) 2, build python-scons-native $bitbake python-scons-native 3, start a devshell $bitbake gzip-native -cdevshell 4, invoke scons in the previous shell, import module `SCons.Script' failed: $bash-4.2$ scons -h Traceback (most recent call last): File "/buildarea2/hongxujia/build-20130520-udev-emenlow/tmp/sysroots/x86_64-linux/usr/bin/scons", line 188, in <module> import SCons.Script ImportError: No module named SCons.Script *analysis: 1, While building scons as default, scons's lib will be install in the dir of `scons' or `scons-2.3.0' if the option `--install-lib' is not set explicitly. See tmp/work/x86_64-linux/python-scons-native/2.3.0-r0/scons-2.3.0/setup.py, line 241: 241 if not set_explicitly("lib", args): 242 # They didn't explicitly specify the installation 243 # directory for libraries... 244 is_win32 = sys.platform == "win32" or args[0] == 'bdist_wininst' 245 prefix = get_scons_prefix(self.install_dir, is_win32) 246 if Options.standalone_lib: 247 # ...but they asked for a standalone directory. 248 self.install_dir = os.path.join(prefix, "scons") 249 elif Options.version_lib or not Options.standard_lib: 250 # ...they asked for a version-specific directory, 251 # or they get it by default. 252 self.install_dir = os.path.join(prefix, "scons-%s" % Version) 2, While build python-scons-native, `--install-lib' is explicitly set, and scons's lib was not installed in the dir of `scons' or `scons-2.3.0'. See meta/classes/distutils.bbclass, line 41: 35 distutils_do_install() { ... 41 ${STAGING_BINDIR_NATIVE}/python-native/python setup.py install --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} 3, While invoke scons-native, the scons searches the lib in ${STAGING_DIR_HOST}/${PYTHON_SITEPACKAGES_DIR}/scons, ${STAGING_DIR_HOST}/${PYTHON_SITEPACKAGES_DIR}/scons-2.3.0 rather than ${STAGING_DIR_HOST}/${PYTHON_SITEPACKAGES_DIR}. See tmp/sysroots/x86_64-linux/usr/bin/scons, line 175: 175 # Look first for 'scons-__version__' in all of our preference libs, 176 # then for 'scons'. 177 libs.extend([os.path.join(x, scons_version) for x in prefs]) 178 libs.extend([os.path.join(x, 'scons') for x in prefs]) 179 180 sys.path = libs + sys.path *solution Uses create_wrapper to relocate scons-native to add `${STAGING_DIR_HOST}/${PYTHON_SITEPACKAGES_DIR}' to PYTHONPATH, so scons-native could find out the lib.