ActiveState Community

Build Error-OSError: [Errno 2] No such file or directory

Posted by dragonflii on 2009-03-18 05:03

After obtaining the Open Komodo source files, upon running:

python build.py configure -k 5.1 --moz-src=cvs --release --no-strip --tools

I get this output / error:

target: configure
Traceback (most recent call last):
  File "build.py", line 3120, in 
    sys.exit( main(sys.argv) )
  File "build.py", line 3116, in main
    return build(args)
  File "build.py", line 2940, in build
    newArgv = targetFunc(argv)
  File "build.py", line 1210, in target_configure
    pi = platinfo.PlatInfo()
  File "../util/platinfo.py", line 178, in __init__
    self._init_linux()
  File "../util/platinfo.py", line 404, in _init_linux
    self._set_linux_distro_info()
  File "../util/platinfo.py", line 669, in _set_linux_distro_info
    d = self._get_linux_lsb_release_info()
  File "../util/platinfo.py", line 564, in _get_linux_lsb_release_info
    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib/python2.6/subprocess.py", line 595, in __init__
    errread, errwrite)
  File "/usr/lib/python2.6/subprocess.py", line 1106, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

The build is being attempted on Arch Linux-i686. I did some basic tracking but can't seem to understand what is happening here. It's likely to turn out to be something I'm going to feel stupid about. :)

Any help would be appreciated.

toddw | Wed, 2009-03-18 10:20

This is a message that the process executable that was launched did not exist. Unfortunately Python's subprocess does not provide you with what that executable name was... urgh!

Checking the code at:
File "../util/platinfo.py", line 564
to find out the executable name... which turns out to be lsb_release --all, from:

p = subprocess.Popen(["lsb_release", "--all"],
             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.Popen(["lsb_release", "--all"],
             stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Note: It is a bug with Komodo's build script in that it does not deal with the missing lsb_release executable, I've logged a bug on it here:
http://bugs.activestate.com/show_bug.cgi?id=82403

Wrapping the code with a try/except should fix the problem:

# Wrapped code:
            try:
                p = subprocess.Popen(["lsb_release", "--all"],
                        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                stdout, stderr = p.communicate()
                retval = p.wait()
            except OSError:
                # Can happen if "lsb_release" did not exist.
                retval = 1 # an error
# Wrapped code:
            try:
                p = subprocess.Popen(["lsb_release", "--all"],
                        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                stdout, stderr = p.communicate()
                retval = p.wait()
            except OSError:
                # Can happen if "lsb_release" did not exist.
                retval = 1 # an error

By the way, what OS is this your trying to build on?

Cheers,
Todd

dragonflii | Wed, 2009-03-18 14:45

As noted in my initial post:

The build is being attempted on Arch Linux-i686.

Arch doesn't use an lsb-release file (containing distro info) so it therefore doesn't use the lsb_release executable. Arch installs 'arch-release' in '/etc', but it's empty (there really aren't releases since it's a rolling-release distro).

By the way, in doing the minimal troubleshooting that I mentioned in my first post, I created an 'lsb-release' file based on the Ubuntu format and placed it in '/etc'. However, as you well know, that did nothing because there is no 'lsb_release' executable (I overlooked the fact that 'platinfo.py' wasn't parsing the data itself at the failure point, but was relying on an external utility).

I came back to the forum to report that I successfully built Komodo and created the install image using Ubuntu Hardy, but your modded code for 'platinfo.py' works, so 'mozilla' is building on Arch Linux as I type. :)

Thank you very much for the quick response and the posted fix.

toddw | Wed, 2009-03-18 15:20

Heh, I though that was just a shortcut for "Architecture is" :)