Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NDK:15.2.4203891 i686-linux-android-g++: internal compiler error: Killed (program cc1plus) #520

Closed
dmxraj opened this issue Sep 14, 2017 · 17 comments

Comments

@dmxraj
Copy link

dmxraj commented Sep 14, 2017


Description

Compiling Boost version 1.65.1 using e15c
by using https://github.com/dec1/Boost-for-Android

2.893859 sec system; 15.497457 sec user; 42.000000 sec clock
Using shell: /bin/sh -c
argv[0] = '/bin/sh'
argv[1] = '-c'
argv[2] = '
"g++" -O3 -finline-functions -Wno-inline -Wall -march=i686 -m32 -fno-strict-aliasing -ftemplate-depth-1024 -fvisibility=hidden -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_STATIC_LINK=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_LOG_SETUP_BUILDING_THE_LIB=1 -DBOOST_LOG_USE_AVX2 -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_USE_SSSE3 -DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DDATE_TIME_INLINE -DNDEBUG -D__STDC_CONSTANT_MACROS -I"." -I"libs/log/src" -c -o "/tmp/ndk-rajesh/tmp/build-2906/build-boost/x86/gnu-4.9/build/boost/bin.v2/libs/log/build/gcc-x86/release/link-static/target-os-android/threading-multi/setup/init_from_settings.o" "libs/log/src/setup/init_from_settings.cpp"
'
0.557912 sec system; 1.142598 sec user; 8.000000 sec clock
Using shell: /bin/sh -c
argv[0] = '/bin/sh'
argv[1] = '-c'
argv[2] = '
"g++" -O3 -finline-functions -Wno-inline -Wall -march=i686 -m32 -fno-strict-aliasing -ftemplate-depth-1024 -fvisibility=hidden -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_STATIC_LINK=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_LOG_SETUP_BUILDING_THE_LIB=1 -DBOOST_LOG_USE_AVX2 -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_USE_SSSE3 -DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DDATE_TIME_INLINE -DNDEBUG -D__STDC_CONSTANT_MACROS -I"." -I"libs/log/src" -c -o "/tmp/ndk-rajesh/tmp/build-2906/build-boost/x86/gnu-4.9/build/boost/bin.v2/libs/log/build/gcc-x86/release/link-static/target-os-android/threading-multi/setup/settings_parser.o" "libs/log/src/setup/settings_parser.cpp"
'
0.855468 sec system; 2.520263 sec user; 12.000000 sec clock
Using shell: /bin/sh -c
argv[0] = '/bin/sh'
argv[1] = '-c'
argv[2] = '
"g++" -O3 -finline-functions -Wno-inline -Wall -march=i686 -m32 -fno-strict-aliasing -ftemplate-depth-1024 -fvisibility=hidden -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_STATIC_LINK=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_LOG_SETUP_BUILDING_THE_LIB=1 -DBOOST_LOG_USE_AVX2 -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_USE_SSSE3 -DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DDATE_TIME_INLINE -DNDEBUG -D__STDC_CONSTANT_MACROS -I"." -I"libs/log/src" -c -o "/tmp/ndk-rajesh/tmp/build-2906/build-boost/x86/gnu-4.9/build/boost/bin.v2/libs/log/build/gcc-x86/release/link-static/target-os-android/threading-multi/setup/filter_parser.o" "libs/log/src/setup/filter_parser.cpp"
'
i686-linux-android-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See http://source.android.com/source/report-bugs.html for instructions.
2.795918 sec system; 24.039788 sec user; 164.000000 sec clock
4.178712 sec system; 15.509828 sec user; 154.000000 sec clock
3.149930 sec system; 20.580098 sec user; 164.000000 sec clock
5.026637 sec system; 18.907997 sec user; 164.000000 sec clock
4.350685 sec system; 19.760434 sec user; 160.000000 sec clock
1.586547 sec system; 16.374114 sec user; 143.000000 sec clock
1.834531 sec system; 16.824280 sec user; 142.000000 sec clock
2.400844 sec system; 26.753648 sec user; 160.000000 sec clock
...failed updating 1 target...
ERROR: Couldn't build Boost 1.65.1 x86 libraries

Environment Details

Not all of these will be relevant to every bug, but please provide as much
information as you can.

  • NDK Version: Pkg.Desc = Android NDK
    Pkg.Revision = 15.2.4203891

  • Build sytem: custom

  • Host OS: Ubuntu 14.04

  • Compiler: If GCC, check Clang before filing. GCC is no longer supported.

  • ABI: x86

  • STL:

  • NDK API level: 9

  • Device API level:

@enh
Copy link
Contributor

enh commented Sep 14, 2017

Compiler: If GCC, check Clang before filing. GCC is no longer supported.

did you try clang?

@enh
Copy link
Contributor

enh commented Sep 14, 2017

https://gist.github.com/enh/b2dc8e2cbbce7fffffde2135271b10fd modified to say 1.65.1 instead of 1.64.0 builds fine for me.

@enh enh closed this as completed Sep 14, 2017
@dmxraj
Copy link
Author

dmxraj commented Sep 14, 2017

It is working for me now.

i.e
Compiling Boost version 1.65.1 using e15c
by using https://github.com/dec1/Boost-for-Android

Earlier I was building from a shared folder between host(windows 7) and guest (Ubuntu) of Virtual Machine. It was failing.

Now I shifted that directory inside a non shared directory in Ubuntu, and the build succeed.

Thanks for your help.

@dmxraj
Copy link
Author

dmxraj commented Sep 15, 2017

I tried your boost scriptp

got this error:

dmxraj@ubuntu: ~/android_builds/newBoost1$ ./build-boost-for-android.sh
Building boost 1.65.1...
Toolchain already built
Archive boost_1_65_1.tar.bz2 already downloaded
Extracting...
Archive boost_1_65_1.tar.bz2 already unpacked into boost_1_65_1
Generating config...
Bootstrapping...
Building Boost.Build engine with toolset clang...
Failed to build Boost.Build build engine
Consult 'bootstrap.log' for more details
dmxraj@ubuntu: ~/android_builds/newBoost1$ ./orig_build-boost-for-android.sh ^C
dmxraj@ubuntu: ~/android_builds/newBoost1$ cat boost_1_65_1/bootstrap.log

Using 'clang' toolset.

rm -rf bootstrap
mkdir bootstrap
clang -Wno-unused -Wno-format -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c pathunix.c
./build.sh: 17: ./build.sh: clang: not found
dmxraj@ubuntu:~/android_builds/newBoost1$

Also,
In the paths below, darwin-x86_64 is not present. There is linux-x86_64 instead.
$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar
$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ranlib

Please help.

@enh
Copy link
Contributor

enh commented Sep 15, 2017

yeah, your linux box probably doesn't have a clang. it's probably clang-3.5 or something? if you make a symbolic link or alias and put that on your path, that'll work.

@dmxraj
Copy link
Author

dmxraj commented Sep 15, 2017

Thanks, I installed clang for my ubuntu 14.04. It is clang-3.5.

It is building fine now. Only compilation error though:

clang-linux.compile.c++.without-pth bin.v2/libs/filesystem/build/clang-linux-android/release/link-static/runtime-link-static/target-os-android/threading-multi/operations.o
In file included from libs/filesystem/src/operations.cpp:44:
In file included from ./boost/filesystem/operations.hpp:25:
In file included from ./boost/filesystem/path.hpp:25:
In file included from ./boost/filesystem/path_traits.hpp:23:
In file included from ./boost/system/error_code.hpp:19:
In file included from /home/dmxraj/android_builds/newBoost1/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/ostream:138:
In file included from /home/dmxraj/android_builds/newBoost1/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/ios:216:
In file included from /home/dmxraj/android_builds/newBoost1/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/__locale:15:
In file included from /home/dmxraj/android_builds/newBoost1/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/string:440:
/home/dmxraj/android_builds/newBoost1/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/cstdio:137:9: error: no member named 'fgetpos' in the global namespace
using ::fgetpos;

~~^
/home/dmxraj/android_builds/newBoost1/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../include/c++/4.9.x/cstdio:139:9: error: no member named 'fsetpos' in the global namespace
using ::fsetpos;

~~^
2 errors generated.

@DanAlbert
Copy link
Member

That was #480. This is fixed in r16, but if you don't care about _FIEL_OFFSET_BITS=64 then you can disable that and it will work on r15.

@enh
Copy link
Contributor

enh commented Sep 15, 2017

i've fixed my gist too, so you no longer need to have a host clang at all (and definitely don't need to mess around with symbolic links), and to fix the darwin nonsense. thanks for pointing those out! i've also updated the default version to 1.65.1.

https://gist.github.com/enh/b2dc8e2cbbce7fffffde2135271b10fd should now work out of the box for building boost for Android for more people!

@dmxraj
Copy link
Author

dmxraj commented Sep 16, 2017

I care about _FIEL_OFFSET_BITS=64.

I guess the current download link of r16 (https://dl.google.com/android/repository/android-ndk-r16-beta1-linux-x86_64.zip), doesn't has this fix. Please let me know when this fix is available in that link.

Till then, will API 24 remove this compile error in r15c?

Thanks

@enh
Copy link
Contributor

enh commented Sep 16, 2017

I care about _FIEL_OFFSET_BITS=64.

i don't think you do... you've never had an NDK with _FILE_OFFSET_BITS before r15. you've always had off_t be 32-bit.

@dmxraj
Copy link
Author

dmxraj commented Sep 16, 2017

I started caring about it.
Can you answer my other two queries.

Thanks

@enh
Copy link
Contributor

enh commented Sep 18, 2017

r15c builds boost 1.65.1 for me with my script (which targets API 21). it seems from comment 1 that you're targeting API 9, which didn't have enough functions to support _FILE_OFFSET_BITS=64. you got away with this previously because _FILE_OFFSET_BITS was ignored in every NDK until r15 (unless you opted in to unified headers in r14).

@4ntoine
Copy link

4ntoine commented Nov 26, 2018

I'm still having the issue with NDK 17b, 17c and 18b (compiling llvm/clang for android). Since it seems to be solved for you, what's the solution?

@DanAlbert
Copy link
Member

Which problem? The bug here is an internal compiler error with GCC. You can't have that issue with NDK r18 because it doesn't contain GCC.

If you're having _FILE_OFFSET_BITS issues, stop setting _FILE_OFFSET_BITS. If you actually need _FILE_OFFSET_BITS=64 support, raise your minSdkVersion.

@alexeikh
Copy link

@4ntoine @dmxraj : If you still have compilation issues with Boost.Filesystem, upgrade to Boost 1.68 and do not define _FILE_OFFSET_BITS explicitly. Boost.Filesystem will define it automatically if you are compiling for Android API 24 or above. See this pull request for more information: boostorg/filesystem#69 . The patch has a good explanation (in C++ comments) of why the fix is as it is; and the pull request comments contain many links to other relevant issue reports and pull requests.

@4ntoine
Copy link

4ntoine commented Nov 27, 2018

@alexeikh @DanAlbert Sorry for my comment being unclear. I'm compiling LLVM/Clang for Android (ARM) and having the same issue. So it's not about Boost. I've found where _FILE_OFFSET_BITS is set in LLVM and solved it by just commenting it. However this thread was helpful to get the rootcause of the issue. Thanks, guys.

@DanAlbert
Copy link
Member

I've found where _FILE_OFFSET_BITS is set in LLVM and solved it by just commenting it.

Where's that? If that's something we've shipped it's a problem and needs to be fixed (please file a new bug rather than piling onto this GCC bug), but I don't really see how that could be the case since we'd have run in to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants