matthewlm / cbitcoin Goto Github PK
View Code? Open in Web Editor NEWA low-level bitcoin library written in standard C.
License: MIT License
A low-level bitcoin library written in standard C.
License: MIT License
Fatal error: can't create build/CBAddressBroadcast.o: No such file or directory
make: *** [build/CBAddressBroadcast.o] Error 1
Of course, it's your project, Matthew, but WorkLog.txt not very interesting for other people.
Short changelog could be more useful
Is there a way to go from an CBAddress (derived from a human readable string) to a CBScript? I have this code so far, but it is seg faulting:
CBAddress * address = CBNewAddressFromString(CBNewByteArrayFromString(addressString, true), false);
// extract script from address, get uint8_t * 20 byte ripemd 160 bit hash (equal to address without checksum bytes)?
uint8_t* addrraw = CBByteArrayGetData(CBGetByteArray(address));
CBFreeAddress(address);
CBScript * self;
CBInitScriptPubKeyHashOutput(self,addrraw);
By the way, great library!
cbitcoin-master$ ./BUILD.py
COMPILING ./build/obj/CBNetworkCommunicator.o
./src/CBNetworkCommunicator.c:25:35: fatal error: CBNetworkCommunicator.h: No such file or directory
compilation terminated.
Traceback (most recent call last):
File "./BUILD.py", line 122, in
compile(cflags + libflags,object,source,clean)
File "./BUILD.py", line 44, in compile
subprocess.check_call("gcc -c " + flags + " -o " + output + " " + source, shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 511, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'gcc -c -Wall -Wno-overflow -Wno-uninitialized -pedantic -std=c99 -I./build/include -m64 -O2 -fpic -o ./build/obj/CBNetworkCommunicator.o ./src/CBNetworkCommunicator.c' returned non-zero exit status 1
When I copy manually *.h from include to build/include the compilation continues.
Best regards
Michal Ambroz
The full node has been implemented as CBNodeFull but CBNodeHeadersOnly has not been implemented. CBNodeHeadersOnly should follow similarly to CBNodeFull.
Hi, I'm using Ubuntu, and after ./configure (disabled -Werror otherwise doesn't compile), make all, make examples, make test, I got this error, any hint?
...
Session = 1391018629i
V | cbitcoin | 29/01/2014 18:03:49 GMT | 01 | Starting network event loop.
cc -c -I/home/Unencrypted/Research/cbitcoin/library/include -I/home/Unencrypted/Research/cbitcoin/library/dependencies/threads -Wall -Wno-uninitialized -Wno-pointer-to-int-cast -pedantic -std=gnu99 -I/opt/local/ssl/include -I/opt/local/include -I/usr/local/ssl/include -DCB_HAVE_ASPRINTF -fPIC -O3 -DCB_LINUX -I/home/Unencrypted/Research/cbitcoin/library/dependencies/sockets/ -I/home/Unencrypted/Research/cbitcoin/library/dependencies/storage library/test/testCBDatabase.c -o build/testCBDatabase.o
cc build/testCBDatabase.o -L/home/Unencrypted/Research/cbitcoin/bin -lcbitcoin.2.0 -lcbitcoin-network.2.0 -lcbitcoin-storage.2.0 -lcbitcoin-threads.2.0 -lcbitcoin-logging.2.0 -lcbitcoin-crypto.2.0 -lcbitcoin.2.0 -lcbitcoin-file-ec.2.0 -lcbitcoin-rand.2.0 -L/opt/local/lib -lpthread -levent_core -levent_pthreads -lcrypto -o bin/testCBDatabase
bin/testCBDatabase
Session = 1391018630i
E | cbitcoin | 29/01/2014 18:03:53 GMT | 00 | Failed to seek to the end of a log file for reading the first overwrite entry.
| | | |
| | | | ERROR VERSION: 2.0 pre-alpha
| | | | ERROR STACK TRACE:
| | | | /home/Unencrypted/Research/cbitcoin/bin/libcbitcoin-storage.2.0.so(CBDatabaseEnsureConsistent+0x643) [0x2baa04beb403]
| | | | /home/Unencrypted/Research/cbitcoin/bin/libcbitcoin-storage.2.0.so(CBInitDatabase+0x141) [0x2baa04beb671]
| | | | /home/Unencrypted/Research/cbitcoin/bin/libcbitcoin-storage.2.0.so(CBNewDatabase+0x55) [0x2baa04bebad5]
| | | | bin/testCBDatabase() [0x403327]
| | | | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x2baa05abb76d]
| | | | bin/testCBDatabase() [0x408e7d]
| | | |
E | cbitcoin | 29/01/2014 18:03:53 GMT | 00 | The database is inconsistent and could not be recovered in CBNewDatabase
| | | |
| | | | ERROR VERSION: 2.0 pre-alpha
| | | | ERROR STACK TRACE:
| | | | /home/Unencrypted/Research/cbitcoin/bin/libcbitcoin-storage.2.0.so(CBInitDatabase+0x2f4) [0x2baa04beb824]
| | | | /home/Unencrypted/Research/cbitcoin/bin/libcbitcoin-storage.2.0.so(CBNewDatabase+0x55) [0x2baa04bebad5]
| | | | bin/testCBDatabase() [0x403327]
| | | | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x2baa05abb76d]
| | | | bin/testCBDatabase() [0x408e7d]
| | | |
E | cbitcoin | 29/01/2014 18:03:53 GMT | 00 | Could not initialise a database object.
| | | |
| | | | ERROR VERSION: 2.0 pre-alpha
| | | | ERROR STACK TRACE:
| | | | /home/Unencrypted/Research/cbitcoin/bin/libcbitcoin-storage.2.0.so(CBNewDatabase+0x98) [0x2baa04bebb18]
| | | | bin/testCBDatabase() [0x403327]
| | | | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x2baa05abb76d]
| | | | bin/testCBDatabase() [0x408e7d]
| | | |
RECOVERY INIT DATABASE FAIL
make: *** [bin/testCBDatabase] Error 1
CBNetworkCommunicator crashes in the testCBNetworkCommunicator unit test occasionally or fails to complete. There seems to be a problem with the CBAddressManager. This needs to be fixed. Anyone can help resolve this.
The new node code has problems on OSX. Please look at the following page for more information: https://bitcointalk.org/index.php?topic=313427.0
There is a 0.1BTC bounty and 100 reputation stackoverflow.com bounty available according to the information on the topic.
cc -lcbitcoin.2.0 -lcbitcoin-crypto.2.0 -lcbitcoin-network.2.0 -lcbitcoin-file-ec.2.0 -lcbitcoin-storage.2.0 -lcbitcoin-rand.2.0 -L/opt/local/lib -levent_core -levent_pthreads -L/media/sf_BitEagle_Projects/cbitcoin/bin build/testCBAddressBroadcast.o -o bin/testCBAddressBroadcast
build/testCBAddressBroadcast.o: In function `main':
testCBAddressBroadcast.c:(.text.startup+0x17e): undefined reference to `CBNewByteArrayWithDataCopy'
There is a problem during the linking of testCBAddressBroadcast. This is odd as the library is built.
I get this when I run it with valgrind and --track-origins=yes
.
==22141== Syscall param write(buf) points to uninitialised byte(s)
==22141== at 0x5B68900: __write_nocancel (syscall-template.S:82)
==22141== by 0x5AFB882: _IO_file_write@@GLIBC_2.2.5 (fileops.c:1289)
==22141== by 0x5AFB749: new_do_write (fileops.c:543)
==22141== by 0x5AFCEB4: _IO_do_write@@GLIBC_2.2.5 (fileops.c:516)
==22141== by 0x5AFDD3E: _IO_switch_to_get_mode (genops.c:189)
==22141== by 0x5AFBA96: _IO_file_seekoff@@GLIBC_2.2.5 (fileops.c:999)
==22141== by 0x5AF4F25: rewind (rewind.c:37)
==22141== by 0x567D149: CBFileAppend (CBFileEC.c:69)
==22141== by 0x5473AFA: CBDatabaseCreateDeletionIndex (CBDatabase.c:270)
==22141== by 0x5473195: CBInitDatabase (CBDatabase.c:112)
==22141== by 0x54721A1: CBNewAddressStorage (CBAddressStorage.c:37)
==22141== by 0x401F67: main (testCBAddressManager.c:226)
==22141== Address 0x402a009 is not stack'd, malloc'd or (recently) free'd
==22141== Uninitialised value was created by a stack allocation
==22141== at 0x546F750: ??? (in /media/sf_BitEagle_Projects/cbitcoin/bin/libcbitcoin-storage.2.0.so)
A make file would be a good idea for the library. The best make file would allow people to run the unit tests and configure the dependencies as they wish.
I believe I have managed to create a txinput by inputting some char arrays and simple integers for the script and prevOut info. However, I am having a tough time serializing the tx inputs and then recovering the data from a char* array. Is there an example somewhere showing how to go from a string to txinput and back?
CBTransactionInput* serializeddata_to_obj(char* datastring){
CBByteArray* data = CBNewByteArrayFromString(datastring,true);
CBTransactionInput* txinput = CBNewTransactionInputFromData(data);
//CBDestroyByteArray(data);
return txinput;
}
char* obj_to_serializeddata(CBTransactionInput * txinput){
CBTransactionInputPrepareBytes(txinput);
CBTransactionInputSerialise(txinput);
CBByteArray* serializeddata = CBGetMessage(txinput)->bytes;
//CBByteArray* data = CBNewByteArrayFromString(serializeddata,true);
CBTransactionInput* newtxinput = CBNewTransactionInputFromData(serializeddata);
printf( "Sequence:%d and prevOutIndex:%d\n", newtxinput->sequence, newtxinput->prevOut.index );
return (char *)CBByteArrayGetData(serializeddata);
}
configure ships alongside with configure.ac
But it can be easy obtained with autoconf
To protect against data corruption that may occur error correction is needed for the database system. At first this could be implemented using hamming code, but a more sophisticated error-correction method could be used.
cc -c -Wall -Wno-overflow -Wno-uninitialized -pedantic -std=c99 -I/home/r000n/fresh/cbitcoin/include -I/usr/local/ssl/include -I/opt/local/include -O3 -fPIC dependencies/sockets/CBLibEventSockets.c -o build/CBLibEventSockets.o
dependencies/sockets/CBLibEventSockets.c: In function ‘CBSocketBind’:
dependencies/sockets/CBLibEventSockets.c:45:18: error: storage size of ‘hints’ isn’t known
dependencies/sockets/CBLibEventSockets.c:48:19: error: ‘AI_PASSIVE’ undeclared (first use in this function)
dependencies/sockets/CBLibEventSockets.c:48:19: note: each undeclared identifier is reported only once for each function it appears in
dependencies/sockets/CBLibEventSockets.c:54:2: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
dependencies/sockets/CBLibEventSockets.c:57:39: error: dereferencing pointer to incomplete type
dependencies/sockets/CBLibEventSockets.c:58:30: error: dereferencing pointer to incomplete type
dependencies/sockets/CBLibEventSockets.c:58:46: error: dereferencing pointer to incomplete type
dependencies/sockets/CBLibEventSockets.c:58:63: error: dereferencing pointer to incomplete type
dependencies/sockets/CBLibEventSockets.c:63:43: error: dereferencing pointer to incomplete type
dependencies/sockets/CBLibEventSockets.c:63:57: error: dereferencing pointer to incomplete type
dependencies/sockets/CBLibEventSockets.c:69:2: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
dependencies/sockets/CBLibEventSockets.c:45:18: warning: unused variable ‘hints’ [-Wunused-variable]
make: *** [build/CBLibEventSockets.o] Error 1
Hi Matthew, compiling in Ubuntu there is a warning, and with -Werror enabled, the make aborts:
cc -c -I/home/Unencrypted/Research/cbitcoin/library/include -I/home/Unencrypted/Research/cbitcoin/library/dependencies/threads -Wall -Wno-uninitialized -Wno-pointer-to-int-cast -pedantic -std=gnu99 -I/opt/local/ssl/include -I/opt/local/include -I/usr/local/ssl/include -Werror -DCB_HAVE_ASPRINTF -fPIC -O3 -DCB_LINUX -I//home/Unencrypted/Research/cbitcoin/client-server/include client-server/src/CBRPCServer.c -o build/CBRPCServer.o
client-server/src/CBRPCServer.c: In function ‘CBRPCServerRespond’:
client-server/src/CBRPCServer.c:99:3: error: implicit declaration of function ‘asprintf’ [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
make: *** [build/CBRPCServer.o] Error 1
Source code commented in C++ style (//) and documented with doxygen style (/** */)
For unification will nicely use C style (/* */) for comments in code
For the newNetworkCode branch: https://github.com/MatthewLM/cbitcoin/tree/newNetworkCode
testCBAddressManager fails for some reason. Probably an issue with the iteration code for CBAssociativeArray.
This new branch should be the start of getting the networking code to work.
Hi after doing ./configure, make, make test, I got this error:
VERSION RECEIVE IP FAIL ERROR VERSION: 2.0 pre-alpha ERROR STACK TRACE: ...
Could you please check this issue? Thanks.
I am using Ubuntu.
PROCESSING BLOCK 99 V | cbitcoin | 31/03/2014 07:26:20 GMT | 22 | Processing block 000000009674d4bfb624b2ab6136ba44cb815f696378841fa420f2903bc8b35a V | cbitcoin | 31/03/2014 07:26:20 GMT | 22 | Block 000000009674d4bfb624b2ab6136ba44cb815f696378841fa420f2903bc8b35a finished processing. V | cbitcoin | 31/03/2014 07:26:20 GMT | 22 | Processing block 24fcc166538f80f2b479f748fb18e266b09b7fc2e3c2bd07b5363d7c00fef742 V | cbitcoin | 31/03/2014 07:26:20 GMT | 22 | Block 24fcc166538f80f2b479f748fb18e266b09b7fc2e3c2bd07b5363d7c00fef742 finished processing. V | cbitcoin | 31/03/2014 07:26:20 GMT | 22 | Processing block 9f0001cb98920a580263efc976af424f8c490136c42df930b780a008cdadc718 W | cbitcoin | 31/03/2014 07:26:20 GMT | 22 | Block 9f0001cb98920a580263efc976af424f8c490136c42df930b780a008cdadc718 is bad. V | cbitcoin | 31/03/2014 07:26:20 GMT | 22 | Processing block ccfd13c5ed7e0bd7f8445af0f3b3518aee24cb911b0436d48b21ab9a01039e96 W | cbitcoin | 31/03/2014 07:26:20 GMT | 22 | Block ccfd13c5ed7e0bd7f8445af0f3b3518aee24cb911b0436d48b21ab9a01039e96 is bad. gcc build/testCBInventory.o -L/home/username/Desktop/cbitcoin/bin -lcbitcoin.2.0 -lcbitcoin-network.2.0 -lcbitcoin-storage.2.0 -lcbitcoin-threads.2.0 -lcbitcoin-logging.2.0 -lcbitcoin-crypto.2.0 -lcbitcoin.2.0 -lcbitcoin-file-ec.2.0 -lcbitcoin-rand.2.0 -L/opt/local/lib -lpthread -levent_core -levent_pthreads -lcrypto -o bin/testCBInventory bin/testCBInventory Session = 1337544566i gcc build/testCBNetworkCommunicator.o -L/home/username/Desktop/cbitcoin/bin -lcbitcoin.2.0 -lcbitcoin-network.2.0 -lcbitcoin-storage.2.0 -lcbitcoin-threads.2.0 -lcbitcoin-logging.2.0 -lcbitcoin-crypto.2.0 -lcbitcoin.2.0 -lcbitcoin-file-ec.2.0 -lcbitcoin-rand.2.0 -L/opt/local/lib -lpthread -levent_core -levent_pthreads -lcrypto -o bin/testCBNetworkCommunicator bin/testCBNetworkCommunicator You may need to move your mouse around if this test stalls. V | cbitcoin | 31/03/2014 07:26:33 GMT | 01 | Starting network event loop. V | cbitcoin | 31/03/2014 07:27:30 GMT | 02 | Starting network event loop. V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Starting network event loop. V | cbitcoin | 31/03/2014 07:28:23 GMT | 01 | Now listening on the IPv4 network on port 45562. V | cbitcoin | 31/03/2014 07:28:23 GMT | 02 | Now listening on the IPv4 network on port 45563. V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Made a connection to peer [::ffff:127.0.0.1]:45562 V | cbitcoin | 31/03/2014 07:28:23 GMT | 02 | Accepted an incoming connection from [::ffff:0.0.0.0]:39331. 1 incoming connections. V | cbitcoin | 31/03/2014 07:28:23 GMT | 01 | Accepted an incoming connection from [::ffff:64.160.10.64]:17099. 1 incoming connections. V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Made a connection to peer [::ffff:127.0.0.1]:45563 V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Sending message of type version (0) to [::ffff:127.0.0.1]:45562. V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Did connect to [::ffff:127.0.0.1]:45562 V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Sending message of type version (0) to [::ffff:127.0.0.1]:45563. V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Did connect to [::ffff:127.0.0.1]:45563 V | cbitcoin | 31/03/2014 07:28:23 GMT | 02 | Received a message header from [::ffff:0.0.0.0]:39331 with the type version and expected size of 110. V | cbitcoin | 31/03/2014 07:28:23 GMT | 01 | Received a message header from [::ffff:64.160.10.64]:17099 with the type version and expected size of 110. V | cbitcoin | 31/03/2014 07:28:23 GMT | 02 | Processing message from [::ffff:0.0.0.0]:39331 with the type version. V | cbitcoin | 31/03/2014 07:28:23 GMT | 01 | Processing message from [::ffff:64.160.10.64]:17099 with the type version. V | cbitcoin | 31/03/2014 07:28:23 GMT | 01 | Sending message of type version (0) to [::ffff:64.160.10.64]:17099. V | cbitcoin | 31/03/2014 07:28:23 GMT | 01 | Sending message of type verack (1) to [::ffff:64.160.10.64]:17099. V | cbitcoin | 31/03/2014 07:28:23 GMT | 01 | [::ffff:127.0.0.1]:45564 sent us their version: Version = 60001 Full blocks = 1 Timestamp = 1396250903 Our addr = [::ffff:0.0.0.0]:0 User agent = /cbitcoin:2.0(pre-alpha)/ Block height = 0 V | cbitcoin | 31/03/2014 07:28:23 GMT | 02 | Sending message of type version (0) to [::ffff:0.0.0.0]:39331. V | cbitcoin | 31/03/2014 07:28:23 GMT | 02 | Sending message of type verack (1) to [::ffff:0.0.0.0]:39331. V | cbitcoin | 31/03/2014 07:28:23 GMT | 02 | [::ffff:127.0.0.1]:45564 sent us their version: Version = 60001 Full blocks = 1 Timestamp = 1396250903 Our addr = [::ffff:0.0.0.0]:0 User agent = /cbitcoin:2.0(pre-alpha)/ Block height = 0 V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Received a message header from [::ffff:127.0.0.1]:45562 with the type version and expected size of 110. V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Processing message from [::ffff:127.0.0.1]:45562 with the type version. V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | Sending message of type verack (1) to [::ffff:127.0.0.1]:45562. V | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | [::ffff:127.0.0.1]:45562 sent us their version: Version = 60001 Full blocks = 1 Timestamp = 1396250903 Our addr = [::ffff:64.160.10.64]:17099 User agent = /cbitcoin:2.0(pre-alpha)/ Block height = 0 E | cbitcoin | 31/03/2014 07:28:23 GMT | 03 | VERSION RECEIVE IP FAIL | | | | | | | | ERROR VERSION: 2.0 pre-alpha | | | | ERROR STACK TRACE: | | | | bin/testCBNetworkCommunicator(onMessageReceived+0x296) [0x80495dd] | | | | /home/zhumabekuly/Desktop/cbitcoin/bin/libcbitcoin.2.0.so(CBNetworkCommunicatorOnMessageReceived+0x67e) [0x40043817] | | | | /home/zhumabekuly/Desktop/cbitcoin/bin/libcbitcoin.2.0.so(CBNetworkCommunicatorOnCanReceive+0x2e3) [0x40042310] | | | | /home/zhumabekuly/Desktop/cbitcoin/bin/libcbitcoin-network.2.0.so(CBCanReceive+0x7b) [0x400775c4] | | | | /usr/lib/i386-linux-gnu/libevent_core-2.0.so.5(event_base_loop+0x3ba) [0x402b5e4a] | | | | /usr/lib/i386-linux-gnu/libevent_core-2.0.so.5(event_base_dispatch+0x23) [0x402b6fa3] | | | | /home/zhumabekuly/Desktop/cbitcoin/bin/libcbitcoin-network.2.0.so(CBStartEventLoop+0x44) [0x40077001] | | | | /home/zhumabekuly/Desktop/cbitcoin/bin/libcbitcoin-threads.2.0.so(CBRunThread+0x51) [0x400a7f8f] | | | | /lib/i386-linux-gnu/libpthread.so.0(+0x6d78) [0x400e0d78] | | | | /lib/i386-linux-gnu/libc.so.6(clone+0x5e) [0x401eafee] | | | | make: *** [bin/testCBNetworkCommunicator] Error 1
There are cases in the code where NOT is used in place of == 0. This may be misleading and should therefore be changed.
COMPILING ./build/obj/CBAssociativeArray.o
./src/CBAssociativeArray.c: In function ‘CBAssociativeArrayDelete’:
./src/CBAssociativeArray.c:154:4: error: unknown type name ‘IMPLEMENT’
./src/CBAssociativeArray.c:154:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘!’ token
./src/CBAssociativeArray.c:156:3: error: expected ‘}’ before ‘else’
./src/CBAssociativeArray.c: In function ‘CBAssociativeArrayInsert’:
./src/CBAssociativeArray.c:210:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c:214:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c:218:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c:220:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c:236:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c:242:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c:246:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c:250:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c:252:5: warning: multi-line comment [-Wcomment]
./src/CBAssociativeArray.c: In function ‘CBAssociativeArrayDelete’:
./src/CBAssociativeArray.c:167:1: warning: control reaches end of non-void function [-Wreturn-type]
Traceback (most recent call last):
File "./BUILD.py", line 122, in
compile(cflags + libflags,object,source,clean)
File "./BUILD.py", line 44, in compile
subprocess.check_call("gcc -c " + flags + " -o " + output + " " + source, shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 511, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'gcc -c -Wall -Wno-overflow -Wno-uninitialized -pedantic -std=c99 -I./build/include -m64 -O2 -fpic -o ./build/obj/CBAssociativeArray.o ./src/CBAssociativeArray.c' returned non-zero exit status 1
Tried compilation on Fedora 17
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.7.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --disable-build-with-cxx --disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
Was attempting to compile for MIPS, but there's a check only allowing x86 or x64 arch and --prefix doesn't do anything.
On line 272, CBFileEC.c fread() fails for the append operation made at line 660, CBDatabase.c. This happens with testCBFullValidator.c and testCBAddressManager.c
I do not know how to resolve this problem which I think has to do with weak linking. I solved it with the python script but can't get it to work with the makefile for some reason.
cc -L/opt/local/lib -L/usr/local/ssl/lib -shared -ldl -L/lib/x86_64-linux-gnu/ -o bin/libcbitcoin-crypto.so.2.0 build/CBOpenSSLCrypto.o -lcrypto -lssl
/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(sha1_one.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [crypto] Error 1
I was able to compile successfully on OS X but ran into some issues, so thought I would document them here.
First, I installed libcrypto and libevent using homebrew:
brew install openssl
brew install libevent
Which installs to /usr/local
Here's how I configure and make:
CC=/usr/bin/gcc LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" ./configure
CC=/usr/bin/gcc LFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make
Note: the second command requires LFLAGS instead of LDFLAGS, otherwise it fails here:
/usr/bin/gcc -L/opt/local/lib -L/usr/local/ssl/lib -flat_namespace -dynamiclib -undefined dynamic_lookup -install_name @executable_path/libcbitcoin-network.2.0.dylib -o bin/libcbitcoin-network.2.0.dylib build/CBLibEventSockets.o build/CBCallbackQueue.o -levent_core
since the paths are hardcoded to /opt/local in the ./configure script, but my libraries reside in /usr/local and the ./configure script only looks in LDFLAGS, not LFLAGS, to test for the existence of libevent.
CONFIGFLAGS="-Wall -Wextra -Wno-uninitialized -Wno-pointer-to-int-cast -pedantic -std=gnu99 -D_GNU_SOURCE -I/opt/local/ssl/include -I/opt/local/include -I/usr/local/ssl/include"
CONFIGFLAGS+=" $CFLAGS"
CONFIGLFLAGS=" $LFLAGS"
I'm not very familiar with autoconf... but I suppose I could also edit the CONFIGFLAGS in configure.ac. Can I also add $LDFLAGS in addition to $LFLAGS? What's the difference?
After getting past setting correct lib and include paths, I failed here:
/usr/bin/gcc build/CBRPCServer.o build/asprintf.o build/main.o -L/Users/Donald/Development/Repositories/cbitcoin/bin -Wl,-rpath=/Users/Donald/Development/Repositories/cbitcoin/bin -lcbitcoin.2.0 -lcbitcoin-network.2.0 -lcbitcoin-storage.2.0 -lcbitcoin-threads.2.0 -lpthread -lcbitcoin-logging.2.0 -lcbitcoin-crypto.2.0 -lcrypto -lcbitcoin.2.0 -lcbitcoin-file-ec.2.0 -lcbitcoin-rand.2.0 -L/opt/local/lib -levent_core -levent_pthreads -o bin/cbitcoin
ld: unknown option: -rpath=/Users/Donald/Development/Repositories/cbitcoin/bin
I found out that Apple's gcc compiler does not support -rpath, but you can instead use:
DYLD_LIBRARY_PATH=$(BINDIR)
More info here: https://dev.lsstcorp.org/trac/wiki/LinkingDarwin
After that, everything compiles!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.