Problem occurs when building GCC-based toolchain

552 views
Skip to first unread message

Tiancheng Yi

unread,
Jul 15, 2015, 7:03:13 AM7/15/15
to native-cli...@googlegroups.com
Greetings,

I am recently trying to look inside the source code of nacl compiler. I followed the instructions on


and try to build the toolchain. There were always some errors:

make[6]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools/BUILD/build-binutils-x86_64-nacl/ld'
Makefile:1713: recipe for target 'all-recursive' failed
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools/BUILD/build-binutils-x86_64-nacl/ld'
Makefile:952: recipe for target 'all' failed
make[4]: *** [all] Error 2
make[4]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools/BUILD/build-binutils-x86_64-nacl/ld'
Makefile:7103: recipe for target 'all-ld' failed
make[3]: *** [all-ld] Error 2
make[6]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools/BUILD/build-binutils-x86_64-nacl/gprof'
make[5]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools/BUILD/build-binutils-x86_64-nacl/gprof'
make[4]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools/BUILD/build-binutils-x86_64-nacl/gprof'
make[3]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools/BUILD/build-binutils-x86_64-nacl'
Makefile:829: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools/BUILD/build-binutils-x86_64-nacl'
Makefile:348: recipe for target 'BUILD/stamp-x86_64-nacl-binutils' failed
make[1]: *** [BUILD/stamp-x86_64-nacl-binutils] Error 2
make[1]: Leaving directory '/home/tyi/Desktop/nacl/native_client/tools'
Makefile:917: recipe for target 'build-with-newlib' failed
make: *** [build-with-newlib] Error 2

Platform I used is ubuntu 15 run inside VirtualBox, 4G memory.

Things I have tried:
-use another PC containing VMware Player runnning ubuntu 15
-copy my colleague's makefile and try again to sync the source code under native_client/tools
-re-install native client source code and toolchain source code completely

and the problem is still there. Could you help me figure out what is wrong with it?

Many thanks in advance.

Tiancheng


Victor Khimenko

unread,
Jul 15, 2015, 7:32:29 AM7/15/15
to Native Client Discuss
On Wed, Jul 15, 2015 at 2:03 PM, Tiancheng Yi <tianche...@gmail.com> wrote:
Greetings,

I am recently trying to look inside the source code of nacl compiler. I followed the instructions on


and try to build the toolchain. There were always some errors:

"Some errors" is not very helpful message. Actual text of an error would help. Log below just includes six recursive makes and says that make#1 failed because make#2 failed which failed because make#3 failed which failed because make#4 failed which failed because make#5 failed which failed because make#6 failed... and that's where log ends.
The problem is, most likely, that you've not installed some usual GNU tools: texinfo is most often the culprint, but you could also forget to install gcc-multilib or something like that. Actual error message of failed step will help, but without it these are shots in the dark.

Tiancheng Yi

unread,
Jul 16, 2015, 9:59:06 AM7/16/15
to native-cli...@googlegroups.com
Many thanks for the reply. After I installed flex and bison, it seems that the building can proceed through the previous position, but there are other errors:

libtool: compile:  g++ -m32 -DHAVE_CONFIG_H -I. -I../../../SRC/.gcc-extra-ppl/src -I.. -I.. -I../../../SRC/.gcc-extra-ppl/src -fexceptions -I/home/tyi/Desktop/nc/native_client/tools/BUILD/.gcc-extra-install-gmp/include -g -O2 -frounding-math -W -Wall -MT Grid_Generator.lo -MD -MP -MF .deps/Grid_Generator.Tpo -c ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.cc -o Grid_Generator.o
In file included from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator_System.defs.hh:28:0,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.defs.hh:29,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.cc:26:
../../../SRC/.gcc-extra-ppl/src/Generator_System.defs.hh:253:7: error: 'ptrdiff_t' was not declared in this scope
       ptrdiff_t,
       ^
../../../SRC/.gcc-extra-ppl/src/Generator_System.defs.hh:253:7: note: suggested alternatives:
In file included from /usr/include/c++/4.9/iostream:38:0,
                 from ../../../SRC/.gcc-extra-ppl/src/checked.defs.hh:27,
                 from ../../../SRC/.gcc-extra-ppl/src/Checked_Number.defs.hh:28,
                 from ../../../SRC/.gcc-extra-ppl/src/Coefficient.types.hh:16,
                 from ../../../SRC/.gcc-extra-ppl/src/Coefficient.defs.hh:27,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.defs.hh:28,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.cc:26:
/usr/include/x86_64-linux-gnu/c++/4.9/32/bits/c++config.h:189:28: note:   'std::ptrdiff_t'
   typedef __PTRDIFF_TYPE__ ptrdiff_t;
                            ^
/usr/include/x86_64-linux-gnu/c++/4.9/32/bits/c++config.h:189:28: note:   'std::ptrdiff_t'
In file included from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator_System.defs.hh:28:0,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.defs.hh:29,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.cc:26:
../../../SRC/.gcc-extra-ppl/src/Generator_System.defs.hh:255:23: error: template argument 3 is invalid
       const Generator&> {
                       ^
In file included from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.defs.hh:29:0,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.cc:26:
../../../SRC/.gcc-extra-ppl/src/Grid_Generator_System.defs.hh:270:7: error: 'ptrdiff_t' was not declared in this scope
       ptrdiff_t,
       ^
../../../SRC/.gcc-extra-ppl/src/Grid_Generator_System.defs.hh:270:7: note: suggested alternatives:
In file included from /usr/include/c++/4.9/iostream:38:0,
                 from ../../../SRC/.gcc-extra-ppl/src/checked.defs.hh:27,
                 from ../../../SRC/.gcc-extra-ppl/src/Checked_Number.defs.hh:28,
                 from ../../../SRC/.gcc-extra-ppl/src/Coefficient.types.hh:16,
                 from ../../../SRC/.gcc-extra-ppl/src/Coefficient.defs.hh:27,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.defs.hh:28,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.cc:26:
/usr/include/x86_64-linux-gnu/c++/4.9/32/bits/c++config.h:189:28: note:   'std::ptrdiff_t'
   typedef __PTRDIFF_TYPE__ ptrdiff_t;
                            ^
/usr/include/x86_64-linux-gnu/c++/4.9/32/bits/c++config.h:189:28: note:   'std::ptrdiff_t'
In file included from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.defs.hh:29:0,
                 from ../../../SRC/.gcc-extra-ppl/src/Grid_Generator.cc:26:
../../../SRC/.gcc-extra-ppl/src/Grid_Generator_System.defs.hh:272:28: error: template argument 3 is invalid
       const Grid_Generator&>,
                            ^
Makefile:1159: recipe for target 'Grid_Generator.lo' failed
make[6]: *** [Grid_Generator.lo] Error 1
make[6]: Leaving directory '/home/tyi/Desktop/nc/native_client/tools/BUILD/.gcc-extra-build-ppl/src'
Makefile:1288: recipe for target 'install' failed
make[5]: *** [install] Error 2
make[5]: Leaving directory '/home/tyi/Desktop/nc/native_client/tools/BUILD/.gcc-extra-build-ppl/src'
Makefile:478: recipe for target 'install-recursive' failed
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory '/home/tyi/Desktop/nc/native_client/tools/BUILD/.gcc-extra-build-ppl'
Makefile:283: recipe for target 'BUILD/.gcc-extra-install-ppl' failed
make[3]: *** [BUILD/.gcc-extra-install-ppl] Error 2
make[3]: Leaving directory '/home/tyi/Desktop/nc/native_client/tools'
Makefile:201: recipe for target 'gcc-extras' failed
make[2]: *** [gcc-extras] Error 2
make[2]: Leaving directory '/home/tyi/Desktop/nc/native_client/tools'
Makefile:449: recipe for target 'BUILD/stamp-x86_64-nacl-pregcc' failed
make[1]: *** [BUILD/stamp-x86_64-nacl-pregcc] Error 2
make[1]: Leaving directory '/home/tyi/Desktop/nc/native_client/tools'
Makefile:906: recipe for target 'build-with-newlib' failed
make: *** [build-with-newlib] Error 2

Cheers,
Tiancheng

Victor Khimenko

unread,
Jul 16, 2015, 12:22:13 PM7/16/15
to Native Client Discuss
Looks like your system does not have all the required 32-bit packages installed. Something like g++-4.9-multilib (not sure about exact name of the package since I don't have Ubuntu 15.04).

Could you compile a "Hello, world" program?

$ cat test.cc
#include <iostream>
int main() {
  std::cout << "Hello, world!" << std::endl;
}
$ g++ -m32 test.cc -o test
$ ./test
Hello, world!

Note -m32 in the example above: default installation of Ubuntu often does not include required files for 32-bit development and that's what fails for you here.

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-di...@googlegroups.com.
To post to this group, send email to native-cli...@googlegroups.com.
Visit this group at http://groups.google.com/group/native-client-discuss.
For more options, visit https://groups.google.com/d/optout.

Tiancheng Yi

unread,
Jul 17, 2015, 8:05:12 AM7/17/15
to native-cli...@googlegroups.com
Yes, I can compile the test and I have the newest version of g++-4.9-multilib as I just checked.

Victor Khimenko

unread,
Jul 17, 2015, 11:02:36 AM7/17/15
to Native Client Discuss
On Fri, Jul 17, 2015 at 3:05 PM, Tiancheng Yi <tianche...@gmail.com> wrote:
Yes, I can compile the test and I have the newest version of g++-4.9-multilib as I just checked.

This is bad: this means you'll need to investigate probem on your own. Most likely it means that version of ppl used by NaCl toolchain is not compatible with GCC 4.9. You'll need do add some defines or #include's to make it compatible.

As you could see in the error output simple "#include <iosteam>" does not work when used by ppl. Since it works by itself it's clear that some other headers or defines interfere. Your goal is to investigate and find out what went wrong. gcc -E is your friend. Also -dD and/or -dI options could make output of "gcc -E" easier to understand.

Sorry that I couldn't give you a simpler answer, but ppl is compileable on Ubuntu 14.04 thus I couldn't offer anything else.

Victor Khimenko

unread,
Jul 17, 2015, 12:33:39 PM7/17/15
to Native Client Discuss
Or you could try to build GCC without PPL. Just download standalone NaCl binutils build:

You'll need tiny patch (attached), but otherwise it works fine (just tested on Ubuntu 14.04). That version uses system-provided GlooG and PPL (if they are present) or just disables few optimizations (most of these are disabled on NaCl anyway).
download_SRC.sh.patch

Tiancheng Yi

unread,
Jul 20, 2015, 10:31:03 AM7/20/15
to native-cli...@googlegroups.com
Many thanks for your reply. Eventually I install another Ubuntu 14.04 system and it works.

Again thanks for your help!

Regards,
Tiancheng

Steven Anderson

unread,
Jul 21, 2015, 9:40:58 AM7/21/15
to native-cli...@googlegroups.com
try building with Canary, got same advice from someone else and although it had errors it got a lot further by using this version

good luck!
Reply all
Reply to author
Forward
0 new messages