hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

[ 66%] Building ASM object — /usr/bin/as: unrecognized option '-HHVM'

Open ohohoreilly opened this issue 13 years ago • 22 comments

[ 66%] Building ASM object hphp/CMakeFiles/hphp_runtime_static.dir/runtime/vm/translator/translator-asm-helpers.S.o /usr/bin/as: unrecognized option '-HHVM' make[2]: *** [hphp/CMakeFiles/hphp_runtime_static.dir/runtime/vm/translator/translator-asm-helpers.S.o] Error 1 make[1]: *** [hphp/CMakeFiles/hphp_runtime_static.dir/all] Error 2 make: *** [all] Error 2

cmake -D CMAKE_PREFIX_PATH:PATH=/usr -D LIBINOTIFY_LIBRARY:FILEPATH=/usr/lib64/libnotify.so.1 -D LIBICONV_LIBRARY:FILEPATH=/usr/local/lib/libiconv.so .

cat /etc/centos-release CentOS release 6.4 (Final)

gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ./configure --prefix=/usr/local/gcc -enable-threads=posix -disable-checking -disable-multilib -enable-languages=c,c++ -with-gmp=/usr/local/gmp -with-mpfr=/usr/local/mpfr/ -with-mpc=/usr/local/mpc/ Thread model: posix gcc version 4.6.3 (GCC)

g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/gcc/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ./configure --prefix=/usr/local/gcc -enable-threads=posix -disable-checking -disable-multilib -enable-languages=c,c++ -with-gmp=/usr/local/gmp -with-mpfr=/usr/local/mpfr/ -with-mpc=/usr/local/mpc/ Thread model: posix gcc version 4.6.3 (GCC)

git describe src-hphp-588-gcc0ef7c

printenv | egrep "(LD_LIBRARY_PATH|CMAKE_PREFIX_PATH|HPHP_HOME|HPHP_LIB|USE_HHVM)" HPHP_LIB=/home/dev/centos/buildhhvm/../hhvmsrc/hiphop-php/bin LD_LIBRARY_PATH=:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib/:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib/:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib/:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib/ HPHP_HOME=/home/dev/centos/buildhhvm/../hhvmsrc/hiphop-php USE_HHVM=1 CMAKE_PREFIX_PATH=/home/dev/centos/buildhhvm/../usr

uname -a Linux hhvm 2.6.32-358.2.1.el6.x86_64 #1 SMP Wed Mar 13 00:26:49 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

ohohoreilly avatar Apr 16 '13 16:04 ohohoreilly

+1 happening with latest git.

Problematic cmake generation is in this make file

./hphp/CMakeFiles/hphp_runtime_static.dir/flags.make:

ASM_FLAGS = -DHHVM -DHHVM_BINARY=1 -DHHVM_PATH="/usr/lib64/hiphop-php/hphp/hhvm/hhvm"

nareshv avatar Apr 17 '13 08:04 nareshv

+1

alexhancock avatar Apr 17 '13 20:04 alexhancock

This is still happening for me on: src-hphp-619-g98466ea

ohohoreilly avatar Apr 17 '13 20:04 ohohoreilly

+1

tenorviol avatar Apr 17 '13 21:04 tenorviol

+1

mgregoro avatar Apr 18 '13 19:04 mgregoro

Still not working on src-hphp-641-g34fdda1 :-1:

ohohoreilly avatar Apr 19 '13 20:04 ohohoreilly

Even if I remove the -D options from the ASM_FLAGS I get: [ 66%] Building ASM object hphp/CMakeFiles/hphp_runtime_static.dir/runtime/vm/translator/translator-asm-helpers.S.o /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S: Assembler messages: /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:0: Warning: end of file in comment; newline inserted /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:24: Error: bad expression /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:24: Warning: division by zero /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:24: Error: junk at end of line, first unrecognized character is o' /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:25: Error: bad expression /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:25: Warning: division by zero /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:25: Error: junk at end of line, first unrecognized character isW' /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:35: Error: junk //rVmSp' after register /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:36: Error: junk//rVmTl' after register /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:37: Error: junk //rVmFp' after register /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:38: Error: junk//rStashedAR saved across service requests' after register /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:48: Error: junk //kReservedRSPScratchSpace' after register /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:66: Error: junk//kReservedRSPScratchSpace' after register /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:104: Error: symbol enterTCHelper' is already defined /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S:105: Error: no such instruction:brk 0' make[2]: *** [hphp/CMakeFiles/hphp_runtime_static.dir/runtime/vm/translator/translator-asm-helpers.S.o] Error 1 make[1]: *** [hphp/CMakeFiles/hphp_runtime_static.dir/all] Error 2 make: *** [all] Error 2

ohohoreilly avatar Apr 19 '13 21:04 ohohoreilly

This is because the normal assembler doesn't support trailing // comments and also doesn't have a preprocessor, so #ifdef stuff won't work. Not quite sure which assembler can do this stuff, but to get around it just fix those two issues. See https://gist.github.com/anonymous/5453435

rlerdorf avatar Apr 24 '13 23:04 rlerdorf

Thanks @rlerdorf that works for me. I'm just curious how it ever worked for anybody else.

ohohoreilly avatar Apr 24 '13 23:04 ohohoreilly

I've submitted a Pull Request https://github.com/facebook/hiphop-php/pull/744 to fix this issue based on @rlerdorf gist.

ohohoreilly avatar Apr 26 '13 20:04 ohohoreilly

Hrm, ubuntu's assembler had no issue, but as this seems to fix other builds I'll get owen to split the the x86/arm implementations into separate files which we can switch on in the build system.

sgolemon avatar Apr 28 '13 14:04 sgolemon

@sgolemon — That sounds good to me. So will you be merging my PR or taking a different approach?

ohohoreilly avatar Apr 28 '13 16:04 ohohoreilly

Your PR ignores AARCH64 (which in fairness, does nothing) so it'll have to be modified. :)

sgolemon avatar Apr 28 '13 20:04 sgolemon

@sgolemon I am suspicious about Ubuntu having an assembler that can handle that file.

The build line that gets generated by cmake in ./hphp/CMakeFiles/hphp_runtime_static.dir/build.make looks like this for me:

cd /home/rlerdorf/hiphop-php/hphp && /usr/bin/as  $(ASM_FLAGS) -o CMakeFiles/hphp_runtime_static.dir/runtime/vm/translator/translator-asm-helpers.S.o /home/rlerdorf/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S

So it is being passed directly to /usr/bin/as

If I try to run that directly on my Ubuntu box without any flags I get this:

3:14pm x220:~/hiphop-php/hphp/runtime/vm/translator> /usr/bin/as translator-asm-helpers.S 
translator-asm-helpers.S: Assembler messages:
translator-asm-helpers.S: Warning: end of file in comment; newline inserted
translator-asm-helpers.S:24: Error: bad expression
translator-asm-helpers.S:24: Warning: division by zero
translator-asm-helpers.S:24: Error: junk at end of line, first unrecognized character is `o'
translator-asm-helpers.S:25: Error: bad expression
translator-asm-helpers.S:25: Warning: division by zero
translator-asm-helpers.S:25: Error: junk at end of line, first unrecognized character is `W'
translator-asm-helpers.S:35: Error: junk `//rVmSp' after register
translator-asm-helpers.S:36: Error: junk `//rVmTl' after register
translator-asm-helpers.S:37: Error: junk `//rVmFp' after register
translator-asm-helpers.S:38: Error: junk `//rStashedAR saved across service requests' after register
translator-asm-helpers.S:48: Error: junk `//kReservedRSPScratchSpace' after register
translator-asm-helpers.S:66: Error: junk `//kReservedRSPScratchSpace' after register
translator-asm-helpers.S:104: Error: symbol `enterTCHelper' is already defined
translator-asm-helpers.S:105: Error: no such instruction: `brk 0'

And my /usr/bin/as is pretty current:

3:15pm x220:~/hiphop-php/hphp/runtime/vm/translator> /usr/bin/as --version
GNU assembler (GNU Binutils for Ubuntu) 2.23.2
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.

So it definitely does not handle trailing // comments on the lines there. And testing the other parts. The -DHHVM command line flags:

3:19pm x220:~/hiphop-php/hphp/runtime/vm/translator> /usr/bin/as -DHHVM translator-asm-helpers.S
/usr/bin/as: unrecognized option '-HHVM'

And same goes for the #ifdef stuff inside the file. They are just treated like comments. What I suspect is happening is that your cmake build line is quite different and you aren't running /usr/bin/as directly so that is probably where we should be looking for a fix.

rlerdorf avatar Apr 28 '13 22:04 rlerdorf

Indeed, my cmake is producing a build line of: gcc -o hphp/CMakeFiles/hphp_runtime_static.dir/runtime/vm/translator/translator-asm-helpers.S.o -c hphp/runtime/vm/translator/translator-asm-helpers.S

What version of cmake is everyone running?

sgolemon avatar Apr 29 '13 02:04 sgolemon

cmake version 2.6-patch 4

rlerdorf avatar Apr 29 '13 03:04 rlerdorf

cmake --version cmake version 2.6-patch 4

ohohoreilly avatar Apr 29 '13 03:04 ohohoreilly

on cat /etc/redhat-release CentOS release 6.4 (Final)

I also have GNU assembler version 2.23.51.0.3-1.el6 20120918.

ohohoreilly avatar Apr 29 '13 03:04 ohohoreilly

My comment got eaten. :(

Anyway, think I found the problem. ASM support in cmake was "experimental" up through 2.8.4. I'm using 2.8.7 where it makes the decision to use gcc which handles the ifdefs and the trailing comments and all that goodness.

Could either of you try updating your cmake to 2.8.5 (or higher) to see if that fixes things? I'll make that the minimum version if so.

sgolemon avatar Apr 29 '13 04:04 sgolemon

@sgolemon — I've updated to cmake version 2.8.8 and now I see:

cd /home/dev/centos/hhvmsrc/hiphop-php/hphp && /opt/centos/devtoolset-1.1/root/usr/bin/gcc  $(ASM_DEFINES) $(ASM_FLAGS) -o CMakeFiles/hphp_runtime_static.dir/runtime/vm/translator/translator-asm-helpers.S.o -c /home/dev/centos/hhvmsrc/hiphop-php/hphp/runtime/vm/translator/translator-asm-helpers.S

in: ./hphp/CMakeFiles/hphp_runtime_static.dir/build.make on line 10813

ohohoreilly avatar Apr 29 '13 21:04 ohohoreilly