>compiling a toolchain for my phone
>compiling gcc
wtf, i have like 8GB RAM and 32GB Swap on an SSD
>rerun make w/o clean
>continues, no segfault
>segfault a few minutes later

rinse and repeat like 30 times


  • 4
    Because GCC is in C++ and has a monolithic architecture. Of course this gives insane compile times and build resource requirements.

    If you're targeting Android, you could just use Google's ready-made NDK, based on LLVM.
  • 4
    @Fast-Nop i'm trying to compile a single C file and NDK is a bitch to get set up on Debian because you have to manually set everything up, it's basically a "here's the binaries, you fucking figure it out" when installed through apt.

    also I have 4GB RAM and all 32GB Swap free when it segfaults, so it's using 3.7GB or so and segfaulting. Smells like a 32-bit RAM boundary, but it's an AMD64 toolchain building the toolchain, so...
  • 2
    @Parzi dunno about Debian, but getting the NDK up and running under Windows is pretty easy. You have to "generate" your NDK anyway using the make_standalone_toolchain.py script. The NDK as downloaded won't compile stuff directly.
  • 7
    Because segfaults aren't caused by lack of memory. They can be, but they're illegal memory accesses.

    Are you using a makefile? Or just kinda winging it? There's probably a compiler option you're missing.
  • 3
    @deadPix3l Buildroot. I'm using Buildroot.

    i'm a fucking plebian

    oheeeeey it finished while i was typing this
  • 3
    *could* be memory corruption. I saw the linaro toolchains legit segfault a couple times though so I don't know anymore lol. Usually you can trust the compiler.
  • 3
    Are you compiling 64 bit on 32 bit ? If so that's your issue.
  • 1
    Having trouble seeing what any of this has to do with segfaults. You can produce a segfault with a couple of lines of code.
  • 4
    Wrong libs' versions, faulty DIMM, faulty SSD/HDD, faulty lib files, etc etc. Afaik lack of memory itself does not cause sigsegv - it just gives you a malloc error saying it could not allocate requested memory.

    C devs, correct me if I'm wrong.
  • 3
    @netikras I could be wrong but I believe if you try to allocate too much memory, it fails, sets errno, and returns a null pointer. Now if you fail to check errno and try to dereference that pointer anyways, there's your segfault.

    I haven't done C in a long time, and I've never tried to allocate enough to trigger that. So grain of salt. But I think so.
  • 1
    @ltlian because it's happening when compiling gcc.
Your Job Suck?
Get a Better Job
Add Comment