hhvm / homebrew-hhvm

Official Mac OS X Homebrew formula for HHVM
MIT License
82 stars 22 forks source link

hhvm won't install on macOS #70

Closed bsemexan closed 7 years ago

bsemexan commented 7 years ago

Description

trying to download HHVM on macOS to try out hack language.

Problem description goes here

Context and Logs

Parameter Value
OS X Version: macOS Sierra 10.12.3
Homebrew Version: Homebrew 1.1.8
Xcode Version: Xcode 8.2 Build version 8C1002

Output of clang -v: Last 15 lines from /Users/beryy/Library/Logs/Homebrew/hhvm/02.make: m_hdr.init({0,0}, HeaderKind::Ref, 1); // cow=z=0, count=1 ^~~ { } /tmp/hhvm-20170128-96944-1mi7k1c/hhvm-3.17.1/hphp/runtime/base/ref-data.h:255:17: warning: suggest braces around initialization of subobject [-Wmissing-braces] m_hdr.init({0,0}, HeaderKind::Ref, 1); // cow=z=0, count=1 ^~~ { } 6 warnings generated. 6 warnings generated. 7 warnings generated. 6 warnings generated. 6 warnings generated. 6 warnings generated. make[1]: [hphp/runtime/CMakeFiles/hphp_runtime_static.dir/all] Error 2 make: [all] Error 2

Build logs: Link to public gist created with brew gist-logs hhvm https://gist.github.com/4f9a0de02c4a806881ebaf8d62c1534a

jwatzman commented 7 years ago
[ 54%] Building CXX object hphp/runtime/CMakeFiles/hphp_runtime_static.dir/base/php-globals.cpp.o
In file included from /tmp/hhvm-20170128-96944-1mi7k1c/hhvm-3.17.1/hphp/runtime/base/object-data.cpp:32:
In file included from /tmp/hhvm-20170128-96944-1mi7k1c/hhvm-3.17.1/hphp/runtime/ext/simplexml/ext_simplexml.h:22:
/tmp/hhvm-20170128-96944-1mi7k1c/hhvm-3.17.1/hphp/runtime/ext/libxml/ext_libxml.h:23:10: fatal error: 'libxml/parser.h' file not found
#include <libxml/parser.h>

@bsemexan can you try running xcode-select --install and then a new brew install hhvm? (And if that fails, attach a new brew gist-logs hhvm.)

@aorenste this keeps coming up. I'm not sure if this is an XCode issue where headers don't always get properly installed or we're doing something weird (it's always libxml). Perhaps we should just depend on brew libxml instead of system libxml?

bsemexan commented 7 years ago

that seemed to have fixed it.

bsemexan commented 7 years ago

I don't know if there should be a separate ticket for this but, I tried to run hh_client and got this message:

For more detailed logs, try `tail -f $(hh_client --monitor-logname) $(hh_client --logname)`
Server launched with the following command:
        '/usr/local/Cellar/hhvm/3.17.1/bin/hh_server' '-d' '/Users/beryy' '--waiting-client' '5'
Spawned typechecker (child pid=72047)
Logs will go to /private/tmp/hh_server/zSUserszSberyy.monitor_log
hh_server is busy: [processing] \hh_server died unexpectedly. Maybe you recently launched a different version of hh_server. Now exiting hh_client.beryy@Macintosh:~/Deskto
p (master)$ hhvm test4hh.php

Warning: Hack typechecking failed: server not ready. Unless you have run "hh_client" manually, you may be missing Hack type errors! Once the typechecker server has starte
d up, the errors, if any, will then show up in this error log.

I was trying to run the first.php program from the hack site, and am using VSCode.

bsemexan commented 7 years ago

running sudo touch .hhconfig seemed to have fixed it

mofarrell commented 7 years ago

Note https://github.com/hhvm/homebrew-hhvm/commit/ffd78dde842d0ea7efd37bd98c059e751b883459 adds the libxml2 dependency

bsemexan commented 7 years ago

so sudo touch .hhconfig doesn't work permanently. I have to run it everytime I want to run hh_client

mofarrell commented 7 years ago

That shouldn't be the case. You should have a .hhconfig file at the root of your hack source tree. Then running hh_client on that directory should check the files.

bsemexan commented 7 years ago

when I run hh_client:

For more detailed logs, try `tail -f $(hh_client --monitor-logname) $(hh_client --logname)`
Server launched with the following command:
    '/usr/local/Cellar/hhvm/3.17.2_1/bin/hh_server' '-d' '/Users/beryy/Desktop' '--waiting-client' '5'
Spawned typechecker (child pid=1612)
Logs will go to /private/tmp/hh_server/zSUserszSberyyzSDesktop.monitor_log

I tried restarting the machine cd into the directory with the file and not run hh_client:


Warning: Hack typechecking failed: server not ready. Unless you have run "hh_client" manually, you may be missing Hack type errors! Once the typechecker server has started up, the errors, if any, will then show up in this error log.
int(42)
:~/Desktop (master)$ hh_client
No errors!
:~/Desktop (master)$ hhvm test4hh.php 
int(42)

I installed hhvm on linux and tried the same thing.
running hh_client throws the same message but then it completes with No errors! on macOs, seems I have to do Ctrl + C then run hh_client again to get the No errors message.

mofarrell commented 7 years ago

I would like to understand exactly how you are running this so it is something that I can reproduce.

In a directory, lets say ~/src/, create your hack files. Then touch ~/src/.hhconfig. Then from the ~/src/ directory run hh_client. It should spawn hh_server and report no errors. Subsequent runs should immediately return no errors. hh_server will not be restarted during a reboot, and running hh_client will require it to respawn the server.

Here is my setup:

~/src
    ~/src/.hhconfig
    ~/src/test.php

~/src/test.php:

<?hh
echo "Hello World";

Running hh_client from ~/src/ gives No errors!. If hh_server is not already running it prints information about spawning the server first.

This was tested in an Mac OS 10.12 VM with HHVM 3.17.2.

In any case it seems like you have a workaround by simply rerunning the typechecker.

bsemexan commented 7 years ago

Yup, I have a directory called hack on my Desktop dir cd Desktop/hack then I have a test.php file in there, with the getting started code from hack website

<?hh

namespace Hack\UserDocumentation\Quickstart\Examples\First;

class Box<T> {
  public function __construct(private T $elem) {
  }

  public function get(): T {
    return $this->elem;
  }
}

function get_int(): int {
  return 42;
}

function use_box(): void {
  $box = new Box(get_int());
  $i = $box->get();
  var_dump($i);
}

use_box();

I then run touch .hhconfig on my ~/hack dir then i try to run hh_client and I get this

For more detailed logs, try `tail -f $(hh_client --monitor-logname) $(hh_client --logname)`
Server launched with the following command:
    '/usr/local/Cellar/hhvm/3.17.1/bin/hh_server' '-d' '/Users/beryy/Desktop/hack' '--waiting-client' '5'
Spawned typechecker (child pid=975)
Logs will go to /private/tmp/hh_server/zSUserszSberyyzSDesktopzShack.monitor_log

but no "No Errors!" message. So then I Ctrl + C out of it and run hh_client again. That is when I get the "No errors" message. I am on a Beta Version of 10.12 if that makes any diff.

fredemmott commented 7 years ago

Probably not related to homebrew-hhvm; also seeing this, will file over at facebook/hhvm if upgrading to 3.18 doesn't fix it.

fredemmott commented 7 years ago

I don't need any repeated touching of .hhconfig - just the one checked into the repos is fine.

However, when I run hh_client when hh_server is not already running on 3.17, it never exits. ^C + re-run works fine.