Hey ron!
Interestingly enough, I've been having a very similar issue while trying to compile a test derivative of the litecoin master. I'm willing to bet the previous poster does have libmemenv.a and liblevel.a included in the directory.
I'm having a similar issue with this, and having done the old "copy and replace" from both Litecoin and Maxcoin from the leveldb path inside of src. I've looked through all the calls in leveldb.cpp and then followed them to the respective files(env, filterpolicy, status) and they're all there... Definitely seems like an include problem, but what the heck it could be is beyond me! Any thoughts?
./build\leveldb.o:leveldb.cpp:(.text+0x425): undefined reference to `leveldb::Ne
wBloomFilterPolicy(int)'
./build\leveldb.o:leveldb.cpp:(.text+0x6a3): undefined reference to `leveldb::En
v::Default()'
./build\leveldb.o:leveldb.cpp:(.text+0x768): undefined reference to `leveldb::St
atus::ToString() const'
./build\leveldb.o:leveldb.cpp:(.text+0x913): undefined reference to `leveldb::St
atus::ToString() const'
c:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bi
n/ld.exe: ./build\leveldb.o: bad reloc address 0x2 in section `.text$_ZN13leveld
b_errorD1Ev[__ZN13leveldb_errorD1Ev]'
collect2.exe: error: ld returned 1 exit status
Makefile.Release:287: recipe for target 'release\Altcoin-qt.exe' failed
mingw32-make: *** [release\Altcoin-qt.exe] Error 1
Hello GivecoinDan
Looking at message #466 (
https://bitcointalksearch.org/topic/m.5627966), note that g++ is looking to link leveldb stuff using
-L"C:/testcoin/src/leveldb", which is what I hi-lited in message #470.
If you "mix" leveldb "src" trees from MAXCoin, Litecoin etc., are you sure you have the same versions (of leveldb) among the sources and libraries? I don't think that the code has changed from levelDB 1.9 to 1.12 to 1.15 but I'm not sure.
Also, note that the "include" lines in the bitcoin
leveldb.h &
leveldb.cpp sources are like this:
#include
#include
and
#include
#include
#include
#include
which means that the "include path" the
gcc needs to see is
-IC:/testcoin/src/leveldb/include -IC:/testcoin/src/leveldb/helpers as in message #466
But if you are creating those libraries, then you need an additional path of
-IC:/testcoin/src/leveldb so that the leveldb source files can "find each other" in their includes! See
block_builder.cc for example, which looks like:
#include "table/block_builder.h"
#include
#include
#include "leveldb/comparator.h"
#include "leveldb/table_builder.h"
#include "util/coding.h"All pretty long-winded, but the idea is that if one builds the libleveldb.a & libmemenv.a with some code, one should check what it is compiling and what it is putting where?
Of course, all of this nonsense vanishes when one just compiles and links one's Bitcoin or *coin sources in MSVC++
I have a set of multi-threaded static libraries placed where I please, and I just point MSVS at them and it figures out all the details! I will announce here that I have compiled and ran daemons successfully for Bitcoin, Maxcoin, Auroracoin and YACoin all using the same libraries, that were built once and then one basically forgets about them. Ah, full screen debugging
Here's a hint:
Consider the line of code from bitcoin's (*coin's?) CScriptCompressor class member function
Serialize() in
script.h:
s << CFlatData(&script[0], &script[script.size()]);What happens, or should happen, when:
1. one references &
script[0] and script.size() is 0?
2. one references
script[script.size()] when script.size() is any value including 0?
The answer is that what happens is unknown!!!
At least according to my reading on vector templates. And sure enough,
P.J. Plauger agrees when running in debug mode (LOL). How many years has "loose" vector<> (especially), list<> and map<> code been in the Bitcoin sources? Four years. I think it is time to make the code correct, don't you think?
Ron