Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: linz on September 29, 2022, 12:19:54 PM



Title: make: *** [Makefile:2018: cxx_db.o] Error 1
Post by: linz on September 29, 2022, 12:19:54 PM
hello friends,i install
sudo make install in ubuntu 20 . 
it show error as follow
```
 make: *** [Makefile:2018: cxx_db.o] Error 1
```
how can i fix that


Title: Re: make: *** [Makefile:2018: cxx_db.o] Error 1
Post by: NotATether on September 29, 2022, 01:34:02 PM
1. Please post the full error message including source code if it is given.
2. Please tell us what program you are compiling (Bitcoin Core?)


Title: Re: make: *** [Makefile:2018: cxx_db.o] Error 1
Post by: linz on September 29, 2022, 02:18:28 PM
1. Please post the full error message including source code if it is given.
2. Please tell us what program you are compiling (Bitcoin Core?)
i solved this error by enter dbinc and atomic.h and edit atomic_compare_exchange to atomic_compare_exchange_db in atomic.h . 
Now I compile bitcoin core by following commands
```
cd bitcoin

./autogen.sh

sudo chmod -R 775 /root/bitcoin/

./autogen.sh

./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/"

make


```
when command make , it show error again . this is
```
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [Makefile:9605: libbitcoin_node_a-init.o] Error 1
make[2]: Leaving directory '/root/bitcoin/src'
make[1]: *** [Makefile:18946: all-recursive] Error 1
make[1]: Leaving directory '/root/bitcoin/src'
make: *** [Makefile:821: all-recursive] Error 1


```

why this happen ?


Title: Re: make: *** [Makefile:2018: cxx_db.o] Error 1
Post by: NotATether on September 29, 2022, 02:33:55 PM
You seem to be running out of memory during compilation. How much RAM do you have, and how are you calling make (e.g. make -j4)? A single thread requires about 2GB of memory for compiling Bitcoin Core.

If you are just using make with one thread (no -j argument), you can try adding temporary swap space (https://stackoverflow.com/questions/30887143/make-j-8-g-internal-compiler-error-killed-program-cc1plus), but I don't recommend this.


Title: Re: make: *** [Makefile:2018: cxx_db.o] Error 1
Post by: linz on September 29, 2022, 02:38:20 PM
You seem to be running out of memory during compilation. How much RAM do you have, and how are you calling make (e.g. make -j4)? A single thread requires about 2GB of memory for compiling Bitcoin Core.

If you are just using make with one thread (no -j argument), you can try adding temporary swap space (https://stackoverflow.com/questions/30887143/make-j-8-g-internal-compiler-error-killed-program-cc1plus), but I don't recommend this.

RAM 1GB cannot handle bitcoin core. Right ? just simply call by ``` make ``` . if increase RAM GB , it will be ok . right?


Title: Re: make: *** [Makefile:2018: cxx_db.o] Error 1
Post by: n0nce on September 29, 2022, 04:34:16 PM
1. Please post the full error message including source code if it is given.
2. Please tell us what program you are compiling (Bitcoin Core?)
i solved this error by enter dbinc and atomic.h and edit atomic_compare_exchange to atomic_compare_exchange_db in atomic.h . 
Um... No. Don't modify the Bitcoin source code to fix compiling errors.. :D
It compiles just fine providing your setup (dependencies, hardware, ...) is good. Working around such issues by modifying the source is not the way to go.

Now I compile bitcoin core by following commands
Code:
cd bitcoin
./autogen.sh
sudo chmod -R 775 /root/bitcoin/
First of all, I wouldn't recommend running Bitcoin Core as root user, nor installing it as user root.

Code:
./autogen.sh
./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/"
make
Why don't you use the default build commands from the documentation?
https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md

when command make , it show error again . this is
Code:
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[2]: *** [Makefile:9605: libbitcoin_node_a-init.o] Error 1
make[2]: Leaving directory '/root/bitcoin/src'
make[1]: *** [Makefile:18946: all-recursive] Error 1
make[1]: Leaving directory '/root/bitcoin/src'
make: *** [Makefile:821: all-recursive] Error 1
why this happen ?
This is again not the complete error message, though, right.

You seem to be running out of memory during compilation. How much RAM do you have, and how are you calling make (e.g. make -j4)? A single thread requires about 2GB of memory for compiling Bitcoin Core.

If you are just using make with one thread (no -j argument), you can try adding temporary swap space (https://stackoverflow.com/questions/30887143/make-j-8-g-internal-compiler-error-killed-program-cc1plus), but I don't recommend this.
RAM 1GB cannot handle bitcoin core. Right ? just simply call by ``` make ``` . if increase RAM GB , it will be ok . right?
It is recommended to have 1.5GB at the very least, but you can tune compiler flags.
C++ compilers are memory-hungry. It is recommended to have at least 1.5 GB of memory available when compiling Bitcoin Core. On systems with less, gcc can be tuned to conserve memory with additional CXXFLAGS:
[...]