Search code examples
c++visual-studiogoogle-nativeclient

Google Native Client Visual Studio Add-in: Webserver fails to start because arguments to httpd.py are invalid


I have an application that I turned into a simple Native Client App a year ago, and I've been trying to get it running again. However, when I try to run it, or any of the example VS projects, the web server fails to start, giving me usage hints for httpd.py, and saying "httpd.py: error: unrecognized arguments: 5103".

I wasn't able to find anything about this on the NaCL guide or on the net. I could probably troubleshoot the issue if I could see the script that starts the webserver, but I have no idea where this is stored.


Solution

  • The script that start the server is 'nacl_sdk\pepper_43\tools\httpd.py'. The problem is with the port argument being formated incorrectly.

    The expected format is:

    httpd.py [-h] [-C SERVE_DIR] [-p PORT] [--no-dir-check]
    

    But, the received arguments formatted by the add-in is:

    ['--no_dir_check', '5103']
    

    where the port prefix is missing and should be '-p 5103'

    For a quick fix, add the following line

    parser.add_argument('args', nargs=argparse.REMAINDER)
    

    before the parse_args(args) in the main(args) method in httpd.py.

    This will keep the unknown arguments from being parsed and will use the default value for port instead (5103).