pluto icon indicating copy to clipboard operation
pluto copied to clipboard

Failure to Build from Source on Raspberry Pi 3, Because 900MiB RAM is not Enough

Open martinvahi opened this issue 7 years ago • 7 comments

After a slightly modified version of the get_polly_libpluto.sh has run for about 10h, the GCC process that tries to build the LLVM, gets killed, because the Raspberry Pi 3 runs out of RAМ, despite the fact that it has about 900MiB of RAM available for the build job as a whole. Cross compilation on a more powerful machine would be very tedious, because the configure scripts (probably, I do not know for sure) need to have access to the actual Raspberry Pi 3 package collection.

The directory, with all logs and ARM binaries and the rest in it MIGHT be available from

https://temporary.softf1.com/2017/bugs/2017_05_19_GCC_Crash_on_Raspberry_Pi_3_Raspbian.tar.xz

martinvahi avatar May 19 '17 13:05 martinvahi

Sorry about the delay - had missed this. Would reducing the number of make jobs help? You can lose the "-j4" in the line below. Also, at which particular step does the memory get exhausted? Is it the final linking or some specific source file build?

$ cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=${LLVM_INSTALL} -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" ${LLVM_GIT} -DPLUTO_INSTALL_DIR=${PLUTO_INSTALL_DIR} $ make -j4 install

bondhugula avatar Jun 15 '17 14:06 bondhugula

The aforementioned blob, the tar.xz, contains everything, including the logs. I add the following excerpt from the new try:

-- Performing Test HAVE_UINT8T
-- Performing Test HAVE_UINT8T - Failed
-- Performing Test HAVE_SYS_INTTYPES_H
-- Performing Test HAVE_SYS_INTTYPES_H - Failed
-- PPCG version: ppcg-0.04
-- Could NOT find Z3 (missing:  Z3_LIBRARIES Z3_INCLUDE_DIR) (Required is at least version "4.5")
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Clang version: 5.0.0
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    PLUTO_INSTALL_DIR


-- Build files have been written to: /home/tunnelcreator/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build
Scanning dependencies of target LLVMDemangle
[  0%] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o
[  0%] Linking CXX static library ../libLLVMDemangle.a
[  0%] Built target LLVMDemangle
Scanning dependencies of target LLVMSupport
[  0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/AMDGPUCodeObjectMetadata.cpp.o

During the posting of the current comment I'm running the re-built to see, whether the tweak that You suggested is a workaround.

martinvahi avatar Jun 15 '17 17:06 martinvahi

Have you been able to build any other version of LLVM or Polly with LLVM (without worrying about libpluto) on this system? I assume you aren't running the whole script now to check, but just

$ cd llvm_build $ make

to see if it works.

bondhugula avatar Jun 15 '17 18:06 bondhugula

I'll try.

An excerpt from the previous build, where I used a single thread to build the Pluto:

[ 47%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerTracePC.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerTraceState.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtil.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtilDarwin.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtilLinux.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtilPosix.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtilWindows.cpp.o
[ 49%] Built target LLVMFuzzerNoMainObjects
Scanning dependencies of target LLVMFuzzerNoMain
[ 49%] Linking CXX static library ../libLLVMFuzzerNoMain.a
[ 49%] Built target LLVMFuzzerNoMain
Scanning dependencies of target LLVMFuzzer
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzer.dir/FuzzerMain.cpp.o
[ 49%] Linking CXX static library ../libLLVMFuzzer.a
[ 49%] Built target LLVMFuzzer
Scanning dependencies of target LLVMPasses
[ 49%] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
lib/Passes/CMakeFiles/LLVMPasses.dir/build.make:62: recipe for target 'lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o' failed
make[2]: *** [lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o] Error 4
CMakeFiles/Makefile2:5704: recipe for target 'lib/Passes/CMakeFiles/LLVMPasses.dir/all' failed
make[1]: *** [lib/Passes/CMakeFiles/LLVMPasses.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1 $ uname -a
Linux acstorage3334 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1 $ echo $CXX
g++
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1 $ echo $CC
gcc
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1 $ echo $CFLAGS
-ftree-vectorize
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1 $ echo $CXXFLAGS
-ftree-vectorize
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1 $ date
Fri 16 Jun 06:14:47 EEST 2017
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1 $

martinvahi avatar Jun 16 '17 03:06 martinvahi

The building of the LLVM failed, as You suspected, but that leaves the problem still unsolved, despite the fact that the LLVM building seems to be an upstream issue.

What regards to the thought that may be hardware like the Raspberry Pi should not even matter, then my answer is that given the built-in security flaws of the AMD and Intel and probably also ARM CPU-s

microcode upgradability, 

the various "Trusted Zones" trends,

the fact that x86 CPU-s run Linux kernel thanks to the 
mercy of the Microsoft that signs the Linux kernel for the CPU-s, 

etc.

the Raspberry Pi like computers, specially those with some CPU other than the ARM CPUs, are the only widely available hardware type, where any kind of data security, operating system level security, effort to guarantee end user privacy, makes any sense at all. FPGA-based computers are more secure, but they tend to have even less RAM, generally only 256MiB or less (archival copy). Usually less.

A few links to back up my claims:

Explanation of the whole "Trusted Zone" issue., which is a nice introduction to the topic and talks about the Intel version of it. The AMD has a publicly documented ARM CPU for running the back doors., which in turn has its own, publicly documented, backdoor running mode. The ARM guys were clever by giving its main CPU multiple execution modes in stead of putting an extra CPU hardware on the die, but that also raises the question that if the ARM people can create the backdoor running "virtual CPU" on the cheap, in terms of hardware, then how many undocumented execution modes have they added in addition to the documented modes? In the terms of logic gates 2000 (two thousand) "virtual CPUs" would be dirt-cheap for them. Docs about how Debian Linux will not boot on AMD64 without the mercy of the Microsoft (archival copy) and the Microsoft's collaboration with the NSA (archival copy).

The console output of the last, failed, build:

[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerTraceState.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtil.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtilDarwin.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtilLinux.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtilPosix.cpp.o
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzerNoMainObjects.dir/FuzzerUtilWindows.cpp.o
[ 49%] Built target LLVMFuzzerNoMainObjects
[ 49%] Linking CXX static library ../libLLVMFuzzerNoMain.a
[ 49%] Built target LLVMFuzzerNoMain
[ 49%] Building CXX object lib/Fuzzer/CMakeFiles/LLVMFuzzer.dir/FuzzerMain.cpp.o
[ 49%] Linking CXX static library ../libLLVMFuzzer.a
[ 49%] Built target LLVMFuzzer
Scanning dependencies of target LLVMPasses
[ 49%] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
lib/Passes/CMakeFiles/LLVMPasses.dir/build.make:62: recipe for target 'lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o' failed
make[2]: *** [lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o] Error 4
CMakeFiles/Makefile2:5704: recipe for target 'lib/Passes/CMakeFiles/LLVMPasses.dir/all' failed
make[1]: *** [lib/Passes/CMakeFiles/LLVMPasses.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

real	399m3.367s
user	273m44.980s
sys	6m38.800s
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build $ pwd
/home/tunnelcreator/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build $ echo $CXXFLAGS
-ftree-vectorize
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build $ echo $CFLAGS
-ftree-vectorize
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build $ echo $CC
gcc
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build $ echo $CXX
g++
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build $ uname -a
Linux acstorage3334 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build $ echo "The build command was: time nice -n20 make " 
The build command was: time nice -n20 make 
tunnelcreator@acstorage3334:~/large_files/pluto_testbuilds/tb_1/2017_06_15_T_19h_31min_29s_LLVM_with_PLUTO_support/llvm_build $

martinvahi avatar Jun 16 '17 12:06 martinvahi

On the other hand, the ParaSail compiler, version 7.0, also uses the LLVM and that I can build on the Raspberry Pi. A link to my ParaSail packages page.

martinvahi avatar Jun 16 '17 12:06 martinvahi

An excerpt from the previous build, where I used a single thread to build the Pluto:

I assume you used a single make job for the LLVM build; the Pluto build isn't the problem here. You'll have to try to resolve the LLVM build issue separately, perhaps by adjusting the build configuration / CFLAGS.

bondhugula avatar Jun 16 '17 20:06 bondhugula