ibmruntimes / v8ppc

Port of Google V8 javascript engine to PowerPC®
Other
94 stars 19 forks source link

Can't compile v8ppc with nativesim=true for PowerPC 440 #127

Open sokovykh opened 8 years ago

sokovykh commented 8 years ago

Hi All,

I want to compile v8 in simulation mode, but I get strange errors:

In file included from .././src/api-arguments.h:11:0,
                 from ../src/api-arguments.cc:5:
.././src/vm-state-inl.h:67:43: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
                      "V8.ExternalCallback");
                                           ^
.././src/vm-state-inl.h:73:41: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
                    "V8.ExternalCallback");
                                         ^
In file included from ../src/api.cc:68:0:
.././src/vm-state-inl.h:67:43: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
                      "V8.ExternalCallback");

and

cc1plus: error: unrecognized command line option '-Wno-undefined-var-template' [-Werror]
cc1plus: error: unrecognized command line option '-Wno-gnu-zero-variadic-macro-arguments' [-Werror]

I use the following commands:

git clone https://github.com/ibmruntimes/v8ppc v8
gclient config --spec "solutions = [{'name': 'v8', 'url': 'https://github.com/ibmruntimes/v8ppc.git'}]"

make nativesim=true ppc.debug V=1 -j8 snapshot=off

powerpc-440-linux-gnu-g++ version:

powerpc-440-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=powerpc-440-linux-gnu-g++
COLLECT_LTO_WRAPPER=/home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/5.2.0/lto-wrapper
Target: powerpc-440-linux-gnu
Configured with: /home/user/crosstool/bin/.build/src/gcc-5.2.0/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=powerpc-440-linux-gnu --prefix=/home/user/x-tools/powerpc-440-linux-gnu --with-sysroot=/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot --enable-languages=c,c++ --with-cpu=440 --with-tune=440 --with-float=hard --with-pkgversion='crosstool-NG ' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --with-gmp=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-mpfr=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-mpc=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-isl=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-cloog=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-libelf=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-plugin --disable-nls --disable-multilib --with-local-prefix=/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot --enable-long-long
Thread model: posix
gcc version 5.2.0 (crosstool-NG ) 

Can I build nodejs with some "nativesim=true" option for build V8 engine in simulation mode?

jbajwa commented 8 years ago

Hi, You should be able to use the official google v8 repo (https://chromium.googlesource.com/v8/v8.git) to build V8 on ppc. Google V8 4.5 and up contains all the PPC changes.

You may encounter an error with gclient sync, although MAKE should still work, but you can fix that issue by disabling sysroot check for ppc. More info https://github.com/ibmruntimes/v8/issues/1 (we are in process of upstreaming this change)

sokovykh commented 8 years ago

@jbajwa

Thanks, I tried:

gclient config --spec "solutions = [{'name': 'v8', 'url': 'https://chromium.googlesource.com/v8/v8.git'}]"
gclient sync
make nativesim=true ppc.debug V=1 -j8 snapshot=off

But I get the following errors:

In file included from ../testing/gtest/src/gtest-filepath.cc:32:
../testing/gtest/include/gtest/gtest-message.h:49:10: fatal error: 'limits' file not found
#include <limits>
         ^
In file included from ../testing/gtest/src/gtest-port.cc:In file included from 32:
In file included from ../testing/gtest/include/gtest/internal/gtest-port.h:259:
In file included from /usr/include/ctype.h:25:
/usr/include/features.h:367:12: ../testing/gtest/src/gtest-death-test.cc:fatal error: 34'sys/cdefs.h' file not found
:
In file included from ../testing/gtest/include/gtest/gtest-death-test.h:41:
In file included from ../testing/gtest/include/gtest/internal/gtest-death-test-internal.h:40:
In file included from ../testing/gtest/include/gtest/internal/gtest-internal.h:40:
In file included from ../testing/gtest/include/gtest/internal/gtest-port.h:259:
In file included from /usr/include/ctype.h#  include <sys/cdefs.h>
           ^
:25:
/usr/include/features.h:367:12: fatal error: 'sys/cdefs.h' file not found
#  include <sys/cdefs.h>
           ^
In file included from ../testing/gtest/src/gtest-printers.cc:45:
../testing/gtest/include/gtest/gtest-printers.h:98:10: fatal error: 'ostream' file not found
#include <ostream>  // NOLINT
jbajwa commented 8 years ago

@zzzlodey Hi, The make command is missing "i18nsupport=off" option (since we don't have internationalization support on Big-Endian platform yet) However, that option won't fix the errors you are seeing, looks like g++ is not correctly configured, the include path is not set correctly. Can you try compiling this in verbose mode

>cat test.cpp
#include <ostream>
int main() {return 0;}

>g++ test.cpp -v

-v should emit the include path that gcc uses to lookup the header files.

sokovykh commented 8 years ago

@jbajwa Hi, I think my crosscompiler powerpc-440-linux-gnu-g++ is configured correctly, because I can build other big projects. For example (node-v4.4.7 from https://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz)

I can to compile successfully your example:

user@user-as:~/Downloads/test$ powerpc-440-linux-gnu-g++ test.cpp -v
Using built-in specs.
COLLECT_GCC=powerpc-440-linux-gnu-g++
COLLECT_LTO_WRAPPER=/home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/5.2.0/lto-wrapper
Target: powerpc-440-linux-gnu
Configured with: /home/user/crosstool/bin/.build/src/gcc-5.2.0/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=powerpc-440-linux-gnu --prefix=/home/user/x-tools/powerpc-440-linux-gnu --with-sysroot=/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot --enable-languages=c,c++ --with-cpu=440 --with-tune=440 --with-float=hard --with-pkgversion='crosstool-NG ' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-libsanitizer --with-gmp=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-mpfr=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-mpc=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-isl=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-cloog=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --with-libelf=/home/user/crosstool/bin/.build/powerpc-440-linux-gnu/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-plugin --disable-nls --disable-multilib --with-local-prefix=/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot --enable-long-long
Thread model: posix
gcc version 5.2.0 (crosstool-NG ) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=440' '-mcpu=440' '-mhard-float'
 /home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/5.2.0/cc1plus -quiet -v -D_GNU_SOURCE -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux -Asystem=unix -Asystem=posix test.cpp -quiet -dumpbase test.cpp -mtune=440 -mcpu=440 -mhard-float -auxbase test -version -o /tmp/cchUQfTL.s
GNU C++ (crosstool-NG ) version 5.2.0 (powerpc-440-linux-gnu)
    compiled by GNU C version 5.3.1 20160413, GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/../../../../powerpc-440-linux-gnu/include/c++/5.2.0
 /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/../../../../powerpc-440-linux-gnu/include/c++/5.2.0/powerpc-440-linux-gnu
 /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/../../../../powerpc-440-linux-gnu/include/c++/5.2.0/backward
 /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/include
 /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/include-fixed
 /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/../../../../powerpc-440-linux-gnu/include
 /home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/usr/include
End of search list.
GNU C++ (crosstool-NG ) version 5.2.0 (powerpc-440-linux-gnu)
    compiled by GNU C version 5.3.1 20160413, GMP version 6.0.0, MPFR version 3.1.3, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 60727f9ee043774306156770750c8896
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=440' '-mcpu=440' '-mhard-float'
 /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/../../../../powerpc-440-linux-gnu/bin/as -v -m440 -many -mbig -o /tmp/ccOFVD9Z.o /tmp/cchUQfTL.s
GNU assembler version 2.25.1 (powerpc-440-linux-gnu) using BFD version (crosstool-NG ) 2.25.1
COMPILER_PATH=/home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/5.2.0/:/home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/5.2.0/:/home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/:/home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/:/home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/:/home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/../../../../powerpc-440-linux-gnu/bin/
LIBRARY_PATH=/home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/:/home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/../../../../powerpc-440-linux-gnu/lib/:/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/lib/:/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=440' '-mcpu=440' '-mhard-float'
 /home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/5.2.0/collect2 -plugin /home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/5.2.0/liblto_plugin.so -plugin-opt=/home/user/x-tools/powerpc-440-linux-gnu/libexec/gcc/powerpc-440-linux-gnu/5.2.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccwMfFqe.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot --eh-frame-hdr -V -m elf32ppclinux -dynamic-linker /lib/ld.so.1 /home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/usr/lib/crt1.o /home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/usr/lib/crti.o /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/crtbegin.o -L/home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0 -L/home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/../../../../powerpc-440-linux-gnu/lib -L/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/lib -L/home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/usr/lib /tmp/ccOFVD9Z.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /home/user/x-tools/powerpc-440-linux-gnu/lib/gcc/powerpc-440-linux-gnu/5.2.0/crtend.o /home/user/x-tools/powerpc-440-linux-gnu/powerpc-440-linux-gnu/sysroot/usr/lib/crtn.o
GNU ld (crosstool-NG ) 2.25.1
  Supported emulations:
   elf32ppclinux
   elf32ppc
   elf32ppcsim
   elf64ppc
mhdawson commented 8 years ago

Just a clarification on the internationalization front. Its not that it is not supported in V8 for BE but that the tests are not set up to properly test as they have LE dependencies. Regardless to be able to get a clean test run you do need to disable it as @jbajwa mentioned

sokovykh commented 8 years ago

@jbajwa @mhdawson Thanks for clarification! But I can compile V8 (without snapshot and i18n, in BE and define USE_SIMULATOR in globals.h) only as part of nodejs (v.4.4.7 or 6.3.2) see issue #128.

Why I can't compile separate last version of v8?

jbajwa commented 8 years ago

@zzzlodey Hi, If you're seeing the same error as before eg:"fatal error: 'ostream' file not found", that looks like gcc not being able to find the key header files, which has nothing to do with v8. You can try the following:

make -j1 SHELL="/bin/bash -x" ...

It should print the failing g++ command, and you can run that separately with "-v" to see why gcc is not able to find for those headers.

Also, without i18nsupport=off V8 should build fine, but to get a clean test run you need it disabled. (we are in process of enabling it #109 )

barracuda156 commented 2 years ago

Hi, You should be able to use the official google v8 repo (https://chromium.googlesource.com/v8/v8.git) to build V8 on ppc. Google V8 4.5 and up contains all the PPC changes.

You may encounter an error with gclient sync, although MAKE should still work, but you can fix that issue by disabling sysroot check for ppc. More info https://github.com/ibmruntimes/v8/issues/1 (we are in process of upstreaming this change)

@jbajwa Is it still relevant? We don’t need v8ppc branch, upstream has ppc code? I am interested to build v8 for Darwin PowerPC (and bring it to Macports then hopefully).