facebook / hhvm

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

Can't build 3.3.0 in Arch Linux #3798

Closed pouar closed 9 years ago

pouar commented 10 years ago
/home/pouar/Downloads/ABS/aur-hhvm/src/hhvm/hphp/runtime/base/zend-pack.cpp: In member function ‘HPHP::Variant HPHP::ZendPack::pack(const HPHP::String&, const HPHP::Array&)’:
/home/pouar/Downloads/ABS/aur-hhvm/src/hhvm/hphp/runtime/base/zend-pack.cpp:297:56: error: ‘MAX’ was not declared in this scope
       int arg_cp = (code != 'Z') ? arg : MAX(0, arg - 1);
                                                        ^
hphp/runtime/CMakeFiles/hphp_runtime_static.dir/build.make:1135: recipe for target 'hphp/runtime/CMakeFiles/hphp_runtime_static.dir/base/zend-pack.cpp.o' failed
make[2]: *** [hphp/runtime/CMakeFiles/hphp_runtime_static.dir/base/zend-pack.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
jrborbars commented 10 years ago

I'm experienced the same thing (message), with an "error 2". See below: [ 49%] Building CXX object hphp/compiler/CMakeFiles/hphp_analysis.dir/analysis/emitter.cpp.o /home/ricardo/Downloads/hhvm/hphp/compiler/analysis/emitter.cpp: In member function ‘void HPHP::Compiler::SymbolicStack::push(char)’: /home/ricardo/Downloads/hhvm/hphp/compiler/analysis/emitter.cpp:803:63: error: ‘MAX’ was not declared in this scope (int)m_actualStack.size()); ^ /home/ricardo/Downloads/hhvm/hphp/compiler/analysis/emitter.cpp: In member function ‘void HPHP::Compiler::SymbolicStack::pushFDesc()’: /home/ricardo/Downloads/hhvm/hphp/compiler/analysis/emitter.cpp:1013:64: error: ‘MAX’ was not declared in this scope _m_fdescHighWaterPtr = MAX(_m_fdescHighWaterPtr, m_fdescCount); ^ hphp/compiler/CMakeFiles/hphp_analysis.dir/build.make:2124: recipe for target 'hphp/compiler/CMakeFiles/hphp_analysis.dir/analysis/emitter.cpp.o' failed make[2]: * [hphp/compiler/CMakeFiles/hphp_analysis.dir/analysis/emitter.cpp.o] Error 1 CMakeFiles/Makefile2:1226: recipe for target 'hphp/compiler/CMakeFiles/hphp_analysis.dir/all' failed make[1]: * [hphp/compiler/CMakeFiles/hphp_analysis.dir/all] Error 2 Makefile:117: recipe for target 'all' failed make: *\ [all] Error 2

Arch linux 3.16.2-1-ARCH gcc (GCC) 4.9.1 latest hhvm (cloned today from github). 3GB RAM, 30GB Free HD;

pouar commented 10 years ago

managed to get past this using a patch now I got another error

[ 72%] Building CXX object hphp/runtime/CMakeFiles/hphp_runtime_static.dir/vm/debug/jit_symbol.cpp.o                                                                                                                                                                                                                   
[ 72%] Building CXX object hphp/runtime/CMakeFiles/hphp_runtime_static.dir/vm/debug/debug.cpp.o                                                                                                                                                                                                                        
[ 72%] Building CXX object hphp/runtime/CMakeFiles/hphp_runtime_static.dir/vm/debug/gdb-jit.cpp.o                                                                                                                                                                                                                      
[ 72%] Building CXX object hphp/runtime/CMakeFiles/hphp_runtime_static.dir/vm/verifier/util.cpp.o                                                                                                                                                                                                                      
[ 73%] Building CXX object hphp/runtime/CMakeFiles/hphp_runtime_static.dir/vm/verifier/check_func.cpp.o                                                                                                                                                                                                                
[ 73%] Building CXX object hphp/runtime/CMakeFiles/hphp_runtime_static.dir/vm/verifier/check_unit.cpp.o                                                                                                                                                                                                                
/home/pouar/Downloads/ABS/aur-hhvm/src/hhvm-HHVM-3.3.0/hphp/runtime/vm/debug/elfwriter.cpp: In member function ‘bool HPHP::Debug::ElfWriter::initDwarfProducer()’:
/home/pouar/Downloads/ABS/aur-hhvm/src/hhvm-HHVM-3.3.0/hphp/runtime/vm/debug/elfwriter.cpp:133:11: error: invalid conversion from ‘int (*)(char*, int, Dwarf_Unsigned, Dwarf_Unsigned, Dwarf_Unsigned, Dwarf_Unsigned, Dwarf_Unsigned*, Dwarf_Ptr, int*) {aka int (*)(char*, int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int*, void*, int*)}’ to ‘Dwarf_Callback_Func {aka int (*)(const char*, int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int*, void*, int*)}’ [-fpermissive]
     &error);
           ^
In file included from /home/pouar/Downloads/ABS/aur-hhvm/src/hhvm-HHVM-3.3.0/hphp/runtime/vm/debug/dwarf.h:23:0,
                 from /home/pouar/Downloads/ABS/aur-hhvm/src/hhvm-HHVM-3.3.0/hphp/runtime/vm/debug/elfwriter.h:20,
                 from /home/pouar/Downloads/ABS/aur-hhvm/src/hhvm-HHVM-3.3.0/hphp/runtime/vm/debug/elfwriter.cpp:16:
/usr/include/libdwarf/libdwarf.h:2336:5: note: initializing argument 2 of ‘int dwarf_producer_init(Dwarf_Unsigned, Dwarf_Callback_Func, Dwarf_Handler, Dwarf_Ptr, void*, const char*, const char*, const char*, Dwarf_P_Debug_s**, Dwarf_Error_s**)’
 int dwarf_producer_init(
     ^
hphp/runtime/CMakeFiles/hphp_runtime_static.dir/build.make:7575: recipe for target 'hphp/runtime/CMakeFiles/hphp_runtime_static.dir/vm/debug/elfwriter.cpp.o' failed
make[2]: *** [hphp/runtime/CMakeFiles/hphp_runtime_static.dir/vm/debug/elfwriter.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 73%] Building CXX object hphp/runtime/ext_hhvm/CMakeFiles/ext_hhvm_static.dir/__/ext/CMakeFiles/hphp_runtime_ext.dir/ext_file.cpp.o.ext_hhvm.cpp.o
[ 73%] Building CXX object hphp/runtime/ext_hhvm/CMakeFiles/ext_hhvm_static.dir/__/ext/CMakeFiles/hphp_runtime_ext.dir/ext_mb.cpp.o.ext_hhvm.cpp.o                                                                                                                                                                     
[ 73%] Building CXX object hphp/runtime/ext_hhvm/CMakeFiles/ext_hhvm_static.dir/__/ext/CMakeFiles/hphp_runtime_ext.dir/ext_thread.cpp.o.ext_hhvm.cpp.o                                                                                                                                                                 
[ 73%] Building CXX object hphp/runtime/ext_hhvm/CMakeFiles/ext_hhvm_static.dir/__/ext/CMakeFiles/hphp_runtime_ext.dir/pdo_driver.cpp.o.ext_hhvm.cpp.o                                                                                                                                                                 
[ 73%] Building CXX object hphp/runtime/ext_hhvm/CMakeFiles/ext_hhvm_static.dir/__/ext/CMakeFiles/hphp_runtime_ext.dir/ext_process.cpp.o.ext_hhvm.cpp.o                                                                                                                                                                
[ 73%] Building CXX object hphp/runtime/ext_hhvm/CMakeFiles/ext_hhvm_static.dir/__/ext/CMakeFiles/hphp_runtime_ext.dir/ext_ipc.cpp.o.ext_hhvm.cpp.o                                                                                                                                                                    
CMakeFiles/Makefile2:1482: recipe for target 'hphp/runtime/CMakeFiles/hphp_runtime_static.dir/all' failed
make[1]: *** [hphp/runtime/CMakeFiles/hphp_runtime_static.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
clojens commented 10 years ago

I've got the exact same problem... also Arch stock kernel, fresh install. Fedora users also report the same issue:

/home/acme/build/hhvm/hphp/compiler/analysis/emitter.cpp: In member function ‘void HPHP::Compiler::SymbolicStack::push(char)’:
/home/acme/build/hhvm/hphp/compiler/analysis/emitter.cpp:803:63: error: ‘MAX’ was not declared in this scope
                                      (int)m_actualStack.size());
                                                               ^
/home/acme/build/hhvm/hphp/compiler/analysis/emitter.cpp: In member function ‘void HPHP::Compiler::SymbolicStack::pushFDesc()’:
/home/acme/build/hhvm/hphp/compiler/analysis/emitter.cpp:1013:64: error: ‘MAX’ was not declared in this scope
   *m_fdescHighWaterPtr = MAX(*m_fdescHighWaterPtr, m_fdescCount);
                                                                ^
hphp/compiler/CMakeFiles/hphp_analysis.dir/build.make:1940: recipe for target 'hphp/compiler/CMakeFiles/hphp_analysis.dir/analysis/emitter.cpp.o' failed
make[2]: *** [hphp/compiler/CMakeFiles/hphp_analysis.dir/analysis/emitter.cpp.o] Error 1
CMakeFiles/Makefile2:1223: recipe for target 'hphp/compiler/CMakeFiles/hphp_analysis.dir/all' failed
make[1]: *** [hphp/compiler/CMakeFiles/hphp_analysis.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
arjenschol commented 10 years ago

I'm not sure, but the "‘MAX’ was not declared in this scope" error could be caused by a custom double-conversion library. Make sure to remove the package from your system, as hhvm now includes a compatible version.

The libdwarf issues is because of an old libdwarf version, grab the PKGBUILD from https://aur.archlinux.org/packages/libdwarf/ and update it to 20140805.

FindLibDwarf.cmake also has some issues, see https://github.com/arjenschol/hhvm/commit/649d05c4377daa9912062c3332033878213a7cce (this is just the quickfix for ArchLinux, so no pullrequest here)

Last thing is to remove the pfff dependency and hacktool build step in PKGBUILD from https://aur.archlinux.org/packages/hhvm

I'll try to upload a new PKGBUILD tarball with all fixes.

pouar commented 10 years ago

One thing, when installing, it conflicts with the system pcre.

yan12125 commented 10 years ago

I'm just curious, but why not use std::max instead of MAX? Affected files: hphp/compiler/analysis/emitter.cpp hphp/runtime/base/zend-pack.cpp After fix these files I successfully compile hhvm with libdwarf-git, google-glog, ocaml and oniguruma

yan12125 commented 10 years ago

I've uploaded an hhvm-git [1] package, which enables successful builds on my Arch box.

[1] https://aur.archlinux.org/packages/hhvm-git/

clojens commented 10 years ago

@arjenschol Thanks, that seemed to be it at first. I now downloaded the Google hosted double conversion library, compiled it after scons on the required folly file and did a autoreconf -vfi successfully. The using automake on folly after configure with the required library locations keeps failing on build/generate_escape_tables.py which I thought first might be the Python v2 vs v3 discrepancy some Arch packages still experience but seemed to be python version 3 is required since I didn't get that far. Reset the whole shebang and folly keeps failing me on the generated escape tables:

build/generate_escape_tables.py
Traceback (most recent call last):
  File "build/generate_escape_tables.py", line 113, in <module>
    main()
  File "build/generate_escape_tables.py", line 109, in main
    generate(f)
  File "build/generate_escape_tables.py", line 84, in generate
    range(ord('a'), ord('z')) +
TypeError: unsupported operand type(s) for +: 'range' and 'range'
Makefile:1492: recipe for target 'EscapeTables.cpp' failed
make[2]: *** [EscapeTables.cpp] Error 1

Then trying to look that up I found this stackoverflow article which says it indeed is a Python v2 versus v3 issue. Not so sure how to solve now though but I guess I should begin by trying to modify the shebang to python2 explicit, if that doesn't do the trick have the escape tables wrap ranges in lists and then, if that doesn't work, try again to switch via PATH shim to swap python3 for python2 symlink.

clojens commented 10 years ago

Note the first option didn't work and generated a

Traceback (most recent call last):
  File "build/generate_format_tables.py", line 79, in <module>
    main()
  File "build/generate_format_tables.py", line 75, in main
    generate(f)
  File "build/generate_format_tables.py", line 60, in generate
    generate_conv_table(f, "formatOctal", octal_values())
  File "build/generate_format_tables.py", line 36, in octal_values
    return (tuple("{0:03o}".format(x)) for x in xrange(512))
NameError: name 'xrange' is not defined

I'm not really hard-core python coder and it seems a bit ambiguous to me which Python version this stuff is intended for anyway. Any got some answers / a structural solution for this?

paulbiss commented 10 years ago

The xrange function was removed in python 3.

jrborbars commented 10 years ago

I'm started with a new environment and download the hhvm-git tarball. Solve the dependencies and still not compile. The error: ##################################################################### Submodule path 'thrift/src': checked out '378e954ac82a00ba056e6fccd5e1fa3e76803cc8' patching file hphp/compiler/analysis/emitter.cpp Hunk #1 FAILED at 799. Hunk #2 FAILED at 1010. 2 out of 2 hunks FAILED -- saving rejects to file hphp/compiler/analysis/emitter.cpp.rej patching file hphp/runtime/base/zend-pack.cpp ==> ERROR: A failure occurred in prepare(). Aborting... #####################################################################

Content of emitter.cpp.rej:

##################################################################### --- hphp/compiler/analysis/emitter.cpp +++ hphp/compiler/analysis/emitter.cpp @@ -799,7 +799,7 @@ if (sym != StackSym::W && sym != StackSym::K && sym != StackSym::L && sym != StackSym::T && sym != StackSym::I && sym != StackSym::H) { m_actualStack.push_back(m_symStack.size());

Looks like the error still with the MAX function. Arch 3.16.4.1, x86_64. Python3 (3.4.2) + Python2 (2.7.8). Any ideas?

Best regards,

yan12125 commented 10 years ago

In commit 8207a31c26cc42fee79363a14c4a8f4fcbfffe63, MAX/MIN issue is fixed in hphp/compiler/analysis/emitter.cpp, so patches are no longer needed. However, hphp/runtime/base/zend-pack.cpp remains the same. I've commented on the commit mentioned above, and by the day everything fixed, PKGBUILD requires update again. I've uploaded currently working PKGBUILD to AUR, please try it again.

clojens commented 9 years ago

@yan12125 Works like a charm! Thanks :+1: Did require additionally imagemagick-no-hdri and icu52 installed, might be something to depend upon.

paulbiss commented 9 years ago

Can this be closed now?

pouar commented 9 years ago

probably

clojens commented 9 years ago

It was missing icu53. All is running fine now

jrborbars commented 9 years ago

@yan12125 THANKS A LOT! The app compile smoothly (5h in my 3GB RAM dual core 2GHz CPU) and installs whitout ANY error. Thank you very much for your attention.

yan12125 commented 9 years ago

@clojens hhvm-git depends on imagemagick and boost-libs, while boost-libs depends on icu 54.1-1. I've successfully built it up on a fresh installed Arch Linux box.

paulbiss commented 9 years ago

Please take a moment to update the wiki with some troubleshooting advice. Thanks!

glensc commented 9 years ago

can 8207a31 be cherry picked to 3.3 LTS branch. thanks!

domenkozar commented 9 years ago

+1 for backport

ghost commented 9 years ago

maybe another issue should be opened to request a backport.

paulbiss commented 9 years ago

Please open a pull-request against the 3.3 branch with this commit if you'd like to see it in the next LTS update.