Juniper / contrail-vrouter

Contrail Virtual Router
BSD 2-Clause "Simplified" License
218 stars 171 forks source link

Trouble with installation #79

Closed gotoco closed 9 years ago

gotoco commented 9 years ago

Hello, I have problem with build vrouter

I started from:

$: repo init -u git@github.com:Juniper/contrail-vnc -m vrouter-manifest.xml
$: repo sync
//And build:
$ scons vrouter

But this return me followed error:

File "/..../SConstruct", line 16, in <module>
IOError: [Errno 2] No such file or directory: '/..../controller/src/base/version.info':

So the issue is that I didn't have in file contrail-controller? I downloaded it and put as a folder into vrouter dir (with changed name controller), so my project tree looks as followed:

/vrouter/.
/vrouter/build
/vrouter/config.log
/vrouter/controller [externally downloaded as a ZIP and unpacked here]
/vrouter/SConstruct
/vrouter/tools
/vrouter/vrouter

Then when I trying to build

$ scons vrouter

It give me next error:

NameError: name 'sys' is not defined:
  File "/.../vrouter/SConstruct", line 16:
    SConscript(dirs=['controller', 'vrouter', 'tools/sandesh'])
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 609:
    return method(*args, **kw)
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 546:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
    exec _file_ in call_stack[-1].globals
  File "/home/hjacker/git/vrouter/controller/SConscript", line 5:
    SConscript(dirs=['lib', 'src'])
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 609:
    return method(*args, **kw)
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 546:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
    exec _file_ in call_stack[-1].globals
  File "/home/hjacker/git/vrouter/controller/lib/SConscript", line 43:
    SConscript(dirs = dir, variant_dir = '#/build/third_party/' + dir)
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 609:
    return method(*args, **kw)
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 546:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
    exec _file_ in call_stack[-1].globals
  File "/.../vrouter/build/third_party/rapidjson/SConscript", line 19:
    sys.exit(1)

So it looked like rapidjson/SConscript didn't import sys I added to rapidjson/SConscript

import sys

and finally I got:

scons: Reading SConscript files ...
/.../vrouter/third_party/rapidjson not present

I think that I messed out with this, can You help me with this installation? I had Ubuntu with default Python 2.7.6 repo version v1.12.20 and SCons by Steven Knight et al.:
script: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep
engine: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep
engine path: ['/usr/lib/scons/SCons']

gotoco commented 9 years ago

The problem was with .repo/manifest.xml

After

repo init -u git@github.com:Juniper/contrail-vnc -m vrouter-manifest.xml

in manifest.xml are whole projects and it looks as followed:

$: cat .repo/manifest.xml
<manifest>
<remote name="github" fetch=".."/>

<default revision="R2.1" remote="github"/>

<project name="contrail-build" remote="github" path="tools/build">
  <copyfile src="SConstruct" dest="SConstruct"/>
</project>
<project name="contrail-controller" remote="github" path="controller"/>
<project name="contrail-vrouter" remote="github" path="vrouter"/>
<project name="contrail-third-party" remote="github" path="third_party"/>
<project name="contrail-generateDS" remote="github" path="tools/generateds"/>
<project name="contrail-sandesh" remote="github" path="tools/sandesh"/>
<project name="contrail-packages" remote="github" path="tools/packages">
  <copyfile src="packages.make" dest="packages.make"/>
</project>
<project name="contrail-nova-vif-driver" remote="github" path="openstack/nova_contrail_vif"/>
<project name="contrail-neutron-plugin" remote="github" path="openstack/neutron_plugin"/>
<project name="contrail-web-controller" remote="github"/>
<project name="contrail-web-core" remote="github"/>
<project name="contrail-webui-third-party" remote="github" path="contrail-webui-third-party"/>

</manifest>

but it require only: vrouter, sandesh and contrail-build

so it must be replaced with followed(from wiki):

<manifest>
<remote name="github" fetch=".."/>
<default revision="R2.1" remote="github"/>
<project name="contrail-build" remote="github" path="tools/build">
<copyfile src="SConstruct" dest="SConstruct"/>
</project>
<project name="contrail-vrouter" remote="github" path="vrouter"/>
<project name="contrail-sandesh" remote="github" path="tools/sandesh"/>
</manifest>

For me it was not obvious at first glance.

Question about sys dependencies in python scripts: -is ok that python didn't see sys package? Or it is my miss configuration?

klash commented 9 years ago

Pedro asked me to get back to you about this a few days back, just getting to it now, sorry.

The first error you saw:

File "/..../SConstruct", line 16, in <module>
IOError: [Errno 2] No such file or directory: '/..../controller/src/base/version.info':

Expecting controller to be present is a bad assumption on the part of our build infra. I have submitted a review to fix that. Once it goes through CI, it will make things easier. If you wanted to cherry-pick that diff into your workspace and test it in your setup, I'd appreciate it.

Your experiment of adding controller was a good attempt on your part, but even after fixing the issue in rapidjson/SConstruct, controller has its own large set of dependencies, as you discovered when the build complained about a missing third-party package.

Answering your last question, that's definitely an error in rapidjson/SConstruct to not have the import sys. Nothing wrong with your Python etc configuration. I've submitted a controller review to add the missing import.

Finally, the manifest issue. The .repo/manifest.xml should be a symlink into .repo/manifests, pointing to the actual manifest you specified with -m flag you passed to repo init. For example, in my workspace:

[klash@ubuntu-build02] ls -l .repo/manifest.xml
lrwxrwxrwx 1 klash ft 30 Apr  9 15:52 .repo/manifest.xml -> manifests/vrouter-manifest.xml

I suspect that a repo command you ran changed that symlink. So first check the symlink and let me know please.

One last thing, did you provide the full repo init command you passed? I'm noticing revision="R2.1" in the XML output. I would have expected to see a -b or --manifest-branch argument. Are you really trying to work with R2.1, or was there some type of glitch?

gotoco commented 9 years ago

Thank You for answer. I started with empty folder and again create repo for begin

$: repo init -u git@github.com:Juniper/contrail-vnc -m vrouter-manifest.xml
$: repo sync
$: cd tools/build 
$: git fetch... && git cherry-pick \ cd ../..
$: scons vrouter

And I got "scons: done building targets." so the path fix work

About revision, I wanted the latest rev, but when the master didn't work for me it is my habit to switch into older revision/tag to see if it give me the same issues.

I don't know if You want to merge this fix into github but I can close my github-issue if You want

klash commented 9 years ago

My two fixes have been merged into github, so I think that closing this github-issue is the right thing.