litecoin: Unable to run on Alpine

Can you reliably reproduce the issue?

If so, please list the steps to reproduce below:

  1. Compile the source code on Alpine (musl).
  2. Run with litecoind -regtest -printtoconsole -debug.

Expected behaviour

The wallet loads successfully.

Actual behaviour

A segmentation fault occurs at scrypt_1024_1_1_256_sp.

2017-12-13 14:11:07  wallet                 9265ms
2017-12-13 14:11:07 setKeyPool.size() = 100
2017-12-13 14:11:07 mapWallet.size() = 0
2017-12-13 14:11:07 mapAddressBook.size() = 1
[New LWP 224]

Thread 11 "bitcoin-loadblk" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 224]
scrypt_1024_1_1_256 (input=input@entry=0x55555698b6f0 "\001",
    output=output@entry=0x7ffff3081bc0 "") at crypto/scrypt.cpp:328
328	    scrypt_1024_1_1_256_sp(input, output, scratchpad);
(gdb) bt
#0  scrypt_1024_1_1_256 (input=input@entry=0x55555698b6f0 "\001",
    output=output@entry=0x7ffff3081bc0 "") at crypto/scrypt.cpp:328
#1  0x0000555555885573 in CBlockHeader::GetPoWHash (this=this@entry=0x55555698b6f0)
    at primitives/block.cpp:22
#2  0x00005555556fe9e6 in ReadBlockFromDisk (block=..., pos=..., consensusParams=...)
    at validation.cpp:1150
#3  0x00005555556fec62 in ReadBlockFromDisk (block=..., pindex=0x555556961620, consensusParams=...)
    at validation.cpp:1158
#4  0x0000555555705fe5 in ConnectTip (connectTrace=..., pblock=..., pindexNew=<optimized out>,
    chainparams=..., state=...) at validation.cpp:2257
#5  ActivateBestChainStep (connectTrace=..., fInvalidFound=<synthetic pointer>: <optimized out>,
    pblock=..., pindexMostWork=0x555556961620, chainparams=..., state=...) at validation.cpp:2406
#6  ActivateBestChain (state=..., chainparams=..., pblock=...) at validation.cpp:2510
#7  0x00005555555a4260 in ThreadImport (vImportFiles=...) at init.cpp:666
#8  0x00005555555bff54 in boost::_bi::list1<boost::_bi::value<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > >::operator()<void (*)(std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> >), boost::_bi::list0> (f=<optimized out>,
    a=<synthetic pointer>..., this=<optimized out>) at /usr/include/boost/bind/bind.hpp:259
#9  boost::_bi::bind_t<void, void (*)(std::vector<boost::filesystem::path, std::allocator<boost::fil---Type <return> to continue, or q <return> to quit---r
esystem::path> >), boost::_bi::list1<boost::_bi::value<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > > >::operator() (this=<optimized out>)
    at /usr/include/boost/bind/bind.hpp:1294
#10 boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> >), boost::_bi::list1<boost::_bi::value<std::vector<boost::filesystem::path, std::allocator<boost::filesystem::path> > > > > >::run (this=<optimized out>)
    at /usr/include/boost/thread/detail/thread.hpp:116
#11 0x00007ffff74bee26 in ?? () from /usr/lib/libboost_thread-mt.so.1.62.0
#12 0x00007ffff7dc3feb in ?? () from /lib/ld-musl-x86_64.so.1
#13 0x0000000000000000 in ?? ()

What version of litecoin-core are you using?

0.14.2 but the same problem is present on 0.13.x and 0.10.x.

Machine specs:

  • OS: Alpine Linux v3.7

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

For anyone interested, we now maintain our own docker image at litecoinproject/litecoin-core, and you can find our alpine Dockerfile here: https://github.com/litecoin-project/docker-litecoin-core/blob/master/0.21/alpine/Dockerfile

add sed command before compile in Dockerfile

RUN sed -i '/char\ scratchpad\[SCRYPT_SCRATCHPAD_SIZE\];/a\memset(scratchpad, 0, sizeof(scratchpad));' src/crypto/scrypt.cpp
RUN sed -i 's/char\ scratchpad\[SCRYPT_SCRATCHPAD_SIZE\];/static &/g' src/crypto/scrypt.cpp