Giving manual CXXFLAGS to make results in errors when compiling #7411

issue jarret opened this issue on January 25, 2016
  1. jarret commented at 4:38 AM on January 25, 2016: contributor

    I am compiling v0.12.0rc2 for Raspbian Jessie on a Raspberry Pi 2. Since it only has 1 GB of memory and no swap, I am following Luke-jr's workaround in issue 6658 to make gcc use less memory by options for more aggressive garbage collecting.

    When I invoke make:

    $ make CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
    

    It solves the memory use problem for the first part of the build, however it gets to compiling leveldb objects and errors:

    Building LevelDB ...
    make[3]: Entering directory '/home/jarret/git/bitcoin/src/leveldb'
    g++ --param ggc-min-expand=1 --param ggc-min-heapsize=32768 -c helpers/memenv/memenv.cc -o helpers/memenv/memenv.o
    helpers/memenv/memenv.cc:5:35: fatal error: helpers/memenv/memenv.h: No such file or directory
    #include "helpers/memenv/memenv.h"
                                   ^
    

    I see that g++ is getting invoked here without the full set of normal flags including the '-I.' to find the memenv.h header in this error.

    If I reissue the make in debug mode without specifying any manual CXXFLAGS:

    $ make -d
    

    I see that the normal compilation of this source file looks like this:

    g++ -I. -I./include -std=c++0x -fno-builtin-memcmp -pthread -DOS_LINUX -DLEVELDB_PLATFORM_POSIX -DLEVELDB_ATOMIC_PRESENT -Wstack-protector -fstack-protector-all -fPIE --param ggc-min-expand=1 --param ggc-min-heapsize=32768 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS -c helpers/memenv/memenv.cc -o helpers/memenv/memenv.o
    

    For which I find that it now doing this correctly, and it successfully builds. Somehow, it gets the ggc-min-expand and ggc-min-heapsize parameters in there too, which must be residual from the first invocation - strange.

    Workaround 1:

    Once leveldb is done building, I can Ctrl-C the build and then go back to the manual CXXFLAGS. This builds fine until the end without running out of memory.

    Workaround 2:

    Specify the CXXFLAGS at configure time:

    $ ./configure --disable-wallet CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768"
    
  2. luke-jr commented at 4:52 AM on January 25, 2016: member

    I think this is typical/expected for automake?

  3. jonasschnelli added the label Build system on Jan 25, 2016
  4. laanwj commented at 4:20 PM on January 25, 2016: member

    I always pass my custom CXXFLAGS, CPPFLAGS, CFLAGS to ./configure instead of make. Maybe that works better? At least I've never had issues.

  5. jarret commented at 7:11 PM on January 25, 2016: contributor

    Yes, I can confirm that giving the flags to './configure' works as expected. Giving them to 'make' only trips up at the leveldb part as described.

  6. theuni commented at 7:23 PM on January 25, 2016: member

    Yep, what they said. Pass them to configure so they persist.

  7. laanwj commented at 11:39 AM on January 27, 2016: member

    Ok, closing this issue then.

  8. laanwj closed this on Jan 27, 2016

  9. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-29 03:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me