facebook / hhvm

A virtual machine for executing programs written in Hack.
https://hhvm.com
Other
18.21k stars 3k forks source link

Running Hacklang scripts using HHVM on Secure Shell throws exception #5029

Closed raj-nt closed 9 years ago

raj-nt commented 9 years ago

I did a setup of Ubuntu 14.04+HHVM on a virtual machine. When I try to execute a hacklang script using a secure shell (ssh) hhvm fails to execute and returns below message

(unknown exception was thrown)

The same script executes when i run it in terminal of virtual machine.

This is the script

<?hh

echo "Hello World\n";

If I use a php script instead of hacklang

<?php

echo "Hello World\n";

The PHP script executes as expected both in terminal of virtual machine as well as in the secure shell.

image

the shell on left in above screenshot is terminal in the vm and the one on right is access via ssh

raj-nt commented 9 years ago

BTW HHVM version is 3.6.0 installed using prebuilt package

r3wt commented 9 years ago

You need to create a .hhconfig file for your project, then you need to run the hacklang type checker, hh_client. http://docs.hhvm.com/manual/en/install.hack.bootstrapping.php

img

raj-nt commented 9 years ago

@r3wt .hhconfig exists. If .hhconfig was not present hhvm would return below error


Fatal error: /home/vagrant/test.hh appears to be a Hack file, but you do not appear to be running the Hack typechecker. See the documentation at http://docs.hhvm.com/manual/en/install.hack.bootstrapping.php for information on getting it running. You can also set Hack.Lang.LookForTypechecker=0 to disable this check (not recommended).
raj-nt commented 9 years ago

Figured it out. Not a HHVM Issue. Locale Variable LC_ALL was not set on VM.

SiebelsTim commented 9 years ago

That's the second time this issue appears here. Maybe a better warning would do it?

raj-nt commented 9 years ago

@SiebelsTim Agree with you. To figure out the issue, had to compile HHVM from source with catch (...) blocks commented. Better warning should do or a line in installation doc would be helpful.

gui-com-pt commented 8 years ago

I had this problem in the past, always with VM. The easiest way for debian derivative is to completely purge the locales, install again and reconfigure with dpkg. I guess the problem comes also from the SSH client trying to set the locales with AcceptEnv LANG LC_* on /etc/ssh/sshd_config.