4 Jun 2010, 8:27pm
Work:
by

5 comments

  • Compiling Node.js on Solaris – The Issues

    Disclaimer: I’m not a sysadmin, better solutions are welcome.

    Earlier today, I was trying to compile node.js on Solaris (x86, 64-bit), get it installed, and setup a simple OHAI server.

    And as usual, installing stuffs on Solaris is never straightforward and I ended up encountering several issues. I’m sure these issues (specially the errors) will bite me again in the future, hence I’m blogging this.

    First up…

    nom> ./configure
    /usr/bin/env: No such file or directory

    Oh right, I forgot to install python and all of its dependencies. From node.js home page “The build system requires Python 2.4 or better.”

    obj/release/mksnapshot obj/release/snapshot.cc --logfile "~/blah/ry-node-29ca7af/build/default/obj/release/snapshot.log" --log-snapshot-positions
    ld.so.1: mksnapshot: fatal: libstdc++.so.6: open failed: No such file or directory
    scons: *** [obj/release/snapshot.cc] Error -9
    scons: building terminated because of errors.
    Waf: Leaving directory `~/blah/ry-node-29ca7af/build'
    Build failed:  -> task failed (err #2):
            {task: libv8.a SConstruct -> libv8.a}
    *** Error code 1

    ldd is your friend every time you hit this kind of error.
    So I inspected mksnapshot…

    nom> ldd obj/release/mksnapshot
            libpthread.so.1 =>       /lib/libpthread.so.1
            libsocket.so.1 =>        /lib/libsocket.so.1
            libnsl.so.1 =>   /lib/libnsl.so.1
            librt.so.1 =>    /lib/librt.so.1
            libstdc++.so.6 =>        (file not found)
            libm.so.2 =>     /lib/libm.so.2
            libgcc_s.so.1 =>         (file not found)
            libc.so.1 =>     /lib/libc.so.1
            libmp.so.2 =>    /lib/libmp.so.2
            libmd.so.1 =>    /lib/libmd.so.1
            libscf.so.1 =>   /lib/libscf.so.1
            libaio.so.1 =>   /lib/libaio.so.1
            libdoor.so.1 =>  /lib/libdoor.so.1
            libuutil.so.1 =>         /lib/libuutil.so.1
            libgen.so.1 =>   /lib/libgen.so.1

    Turned out that both libstdc++.so.6 and libgcc_s.so.1 were installed in /usr/local/lib but not available from /lib. So I simply created symlinks for /lib/libstdc++.so.6 and libgcc_s.so.1 pointing to /usr/local/lib . Another workaround was to set LD_LIBRARY_PATH=/usr/local/lib, but I heard it’s bad.

    On to the next one…

    ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/lib/python2.6/lib-dynload/_socket.so: symbol inet_aton: referenced symbol not found

    This one was just strange, I couldn’t figure out which library dependency was missing, and it took me a while to find out that the python binary I had wasn’t built correctly (some library links were missing from _socket.so) . At the end I used the binary from Sunfreeware which had the correct links.

    I got this next error when I accidentally compiled node on a SPARC box, which I believe is not a supported architecture. c-ares only has sunos-x86 header files for Solaris.

    ../deps/c-ares/ares_expand_string.c:18:24: ares_setup.h: No such file or directory

    And another one, on the same SPARC box…

    TypeError: cannot concatenate 'str' and 'NoneType' objects:

    This is a similar issue that stevel mentioned on nodejs Google Group. Basically deps/v8/SConstruct couldn’t figure out the compiler and returns ‘None’ which can’t be concatenated to a String, this line here…

    the toolchain to use (' + TOOLCHAIN_GUESS + ')'

    After 3-4 hours, I finally got node.js installed, and a simple server up and running on Solaris.

    OHAI
    KTHXBYE

    12 Apr 2010, 10:41pm
    Projects Work:
    by

    1 comment

  • Re Hudson SiteMonitor Plugin And JSLint Violations Support

    Just a quick note about a post I made over at Shine Technologies blog re Hudson SiteMonitor Plugin and JSLint Violations support.

    My current employer, Shine Technologies, allowed me to spend a couple of days to contribute to an open source project, so naturally I chose Hudson and worked on things that are useful for the projects I’m involved with at work.

    SiteMonitor Plugin was a late follow up to this short thread on Hudson users mailing list about a year ago. JSLint support in Violations Plugin was an effort to add JSLint report handling in Hudson a la Checkstyle.

    26 Jan 2010, 10:58pm
    Work:
    by

    2 comments

  • A Guide To Stand-Up Meeting – Part 1

    people around you are not blind...

    I’ve been doing daily stand-up meetings for all but 1.5 years of my time in the software development industry, and I had plenty of chance to observe the good and bad habits during the stand-up.

    For this part, I’ll just highlight the need to keep what you say relevant to the project, to not pause too long and too often, and to not unconsciously perform politically incorrect hand movement where no one wants to pair-program with you afterward.

    The above panel was drawn this morning while waiting at Caulfield Station. I’ll do part 2 on the next down time, whenever that is.

    19 Jan 2010, 12:25am
    Work:
    by

    4 comments

  • Known Hosts Issue With Net::SSH

    This issue bit me twice within a month, and each time I had to spend a couple of hours to figure out the cause of the problem, mostly due to the obscurity of the error messages.

    So I was using net-ssh-2.0.15 and jruby-openssl-0.5.1 for a piece of code that’s supposed to perform some remote operations. The Net::SSH usage itself was straightforward…

    Net::SSH.start(@host, @username, :keys => @keys) do |ssh|
        ...
    end
    

    When I ran the above snippet on Windows XP, it gave this error message without any further information…

    The system cannot find the path specified
    

    Not exactly helpful, eh? And after some sleuthing around, it came down to add(host, key) method in lib/net/ssh/known_hosts.rb :

    def add(host, key)
      File.open(source, "a") do |file|
        blob = [Net::SSH::Buffer.from(:key, key).to_s].pack("m*").gsub(/\s/, "")
        file.puts "#{host} #{key.ssh_type} #{blob}"
      end
    end
    

    This method is trying to add an entry to the known_hosts file, which location is stored in source variable. In my case, the variable resolved to C:/.ssh/known_hosts . But the problem was that the .ssh directory didn’t exist. So I simply created it.

    Lo and behold, when I ran this piece of code on a Solaris box weeks later, I hit another error message…

    No such file or directory (IOError)
    

    which turned out to be caused by the exact same thing, but this time the location is <script_home>/.ssh/known_hosts . The workaround was the same, I simply created the .ssh directory.

    So there you go, hopefully it helps whoever else was confused by the unclear error messages.
    And in terms of a long term solution, it would be nice if add(host, key) checks or even creates the .ssh directory before attempting to write known_hosts file.

    30 Dec 2008, 4:03am
    Work:
    by

    1 comment

  • Image Saving In Watir

    So I got the chance to use Watir again on a short project at work. The last time I used it was about 1.5 years ago, and I was glad to find out that Watir is still a nice library to use. Watir simply works without much hassle.

    The only issue I had was with image saving. From Image class documentation (Watir 1.6), it wasn’t obvious that save can only be called when image element is directly contained within a browser element.

    I was trying to save the first image within a div,

    $browser.div(:id, 'foobar').images[1].save('d:\\temp')
    

    which resulted in this error

    NoMethodError: undefined method `goto' for #<Watir::Div:0x3fa5d7c>
    d:/dev/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/image.rb:113:in `save'
    

    Looking at the implementation of save in image.rb,

    def save(path)
      require 'watir/windowhelper'
      WindowHelper.check_autoit_installed
      @container.goto(src)
      begin
        thrd = fill_save_image_dialog(path)
        @container.document.execCommand("SaveAs")
        thrd.join(5)
      ensure
        @container.back
       end
    end
    

    it shows that save relies on the existence of goto and back methods within the container of the element, meaning that calling save method will tell the browser to go to the image src value, save it, and then click the back button. Hence image must be contained directly within a browser element.

    I ended up having to use XPath because the image element doesn’t have any id or class that allows me to directly reference it from a browser element.

    $browser.image(:xpath, "//div[@id='foobar']/img").save("d:\\temp")
    

    It would be nicer if @container can be replaced by something like find_root_container or something that traverses the ancestor container elements and eventually finds a browser element.

    Another nice improvement to the save method implementation would be instead of going to the image src and then clicking back, which could potentially lose the state of a page, it would be nicer to open a new window and close it afterward.

    Recent Posts

    Recent Comments

    • SIMAR PAUL SINGH: Define :global_known_hosts_file :user_known_hosts_file options with a list of valid host_file...
    • Penny: I received this book from my Grandmother 6 months before she died. She INSISTED I read it…and I kept...
    • Nicholas Orr: Hilarious ;) No need to put true, keep’em guessing. Thanks for posting this am going to have to...
    • Amy: Truly awesome! I will share it with my boys who lost their father at 4&5 they are 8&9 now. What a gift...
    • Michael Sharkey: Let the propaganda continue!

    Most Commented Posts

    Linkroll