Got an issue compiling

0

1

After working my way through many errors compiling an alt-coin windows qt.

Everything compiles fine right until the final stage when the system is putting together the exe.

You can find the error below. leveldb is installed and libleveldb.a and libmemenv.a files are correctly in src/leveldb ... Any help resolving this issue would be appreciated.

uuid -lgdi32 -lboost_system-mgw48-mt-1_54 -lboost_filesystem-mgw48-mt-1_54 -lboo
st_program_options-mgw48-mt-1_54 -lboost_thread-mgw48-mt-1_54 -lboost_chrono-mgw
48-mt-1_54 -lQtGui4 -lQtCore4
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x433): undefined reference to `l
eveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x73f): undefined reference to `l
eveldb::Status::ToString() const'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x866): undefined reference to `l
eveldb::WriteBatch::~WriteBatch()'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x89f): undefined reference to `l
eveldb::WriteBatch::WriteBatch()'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x921): undefined reference to `l
eveldb::WriteBatch::~WriteBatch()'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x944): undefined reference to `l
eveldb::Status::ToString() const'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0xac4): undefined reference to `l
eveldb::WriteBatch::Iterate(leveldb::WriteBatch::Handler*) const'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0xaf5): undefined reference to `l
eveldb::WriteBatch::Handler::~Handler()'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0xb24): undefined reference to `l
eveldb::Status::ToString() const'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x14a9): undefined reference to `
leveldb::Status::ToString() const'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x176f): undefined reference to `
leveldb::WriteBatch::Put(leveldb::Slice const&, leveldb::Slice const&)'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x18b2): undefined reference to `
leveldb::Status::ToString() const'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x1a57): undefined reference to `
leveldb::Options::Options()'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x1ae0): undefined reference to `
leveldb::Options::Options()'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x1b35): undefined reference to `
leveldb::NewLRUCache(unsigned int)'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x1b44): undefined reference to `
leveldb::NewBloomFilterPolicy(int)'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x1b9c): undefined reference to `
leveldb::NewBloomFilterPolicy(int)'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x2021): undefined reference to `
leveldb::WriteBatch::~WriteBatch()'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x211d): undefined reference to `
leveldb::Status::ToString() const'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x35c3): undefined reference to `
leveldb::WriteBatch::Delete(leveldb::Slice const&)'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x6488): undefined reference to `
leveldb::WriteBatch::~WriteBatch()'
./build\txdb-leveldb.o:txdb-leveldb.cpp:(.text+0x64b8): undefined reference to `
leveldb::WriteBatch::~WriteBatch()'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./build\tx
db-leveldb.o: bad reloc address 0x2 in section `.text$_ZN5boost16exception_detai
l10clone_baseD1Ev[__ZN5boost16exception_detail10clone_baseD1Ev]'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link
 failed: Invalid operation
collect2.exe: error: ld returned 1 exit status

user18314

Posted 2014-06-21T00:54:52.780

Reputation: 21

Are you linking to LevelDB?David Schwartz 2014-06-21T05:41:12.607

@DavidSchwartz I believe the bitcoin makefile will automatically link the leveldb library. I had once a similar issue, that costed a lot of time to resolve. I will post it as answer.Jori 2014-06-22T16:59:24.693

Answers

1

Check if your libleveldb.a compiled all necessary files correctly. Could you run the following commands please and post the output back?

ar tv libmemenv.a and ar tv libleveldb.a. If the output is something similar to

rw-rw-rw- 0/0 432255 Apr 15 16:56 2014 memenv.o
rw-rw-rw- 0/0  21322 Apr 15 16:56 2014 port_win.o

then the problem could be that your Windows find.exe is overruling your MSYS file.exe. They both work very differently and are not interchangeable. The makefile of LevelDB uses the Unix style find.exe. You can fix this by explicitly putting your MSYS find.exe directory before the Windows find.exe directory (which should be something like C:\Window\System32\find.exe).

This was a very hard problem to track down and you can see my progress (and that of Ron, who kindly helped me a lot, thanks Ron!) on the 'official' building Bitcoin thread on bitcointalk.org. Starting at page 28 and continuing down until you don't see my name anymore (I'm called Jori there too, it's my real name).

Jori

Posted 2014-06-21T00:54:52.780

Reputation: 1 522

0

that mean leveldb not compiled properly, on cygwin I use

make -f makefile.unix clean
TARGET_OS="Linux"; make -f makefile.unix

with mingw TARGET_OS maybe Linux or NATIVE_WINDOWS also try change permission leveldb/build_detect_platform to make it as executable

ewwink

Posted 2014-06-21T00:54:52.780

Reputation: 101