Bitcoin Forum
April 26, 2024, 02:17:54 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Help Compiling Litecoin for Windows  (Read 9646 times)
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 05, 2013, 03:00:23 AM
 #1

Ok, I followed the directions for compiling outlined in this thread which apparently work with the newer versions of bitcoin which are different than the older version which Litecoin is forked from:

https://bitcointalk.org/index.php?topic=149479.0

I edited the dependency directors in the makefile.mingw which now saids:

Code:
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.

USE_UPNP:=0

INCLUDEPATHS= \
 -I"C:\deps\boost_1_53_0" \
 -I"C:\deps\db-4.8.30.NC\build_unix" \
 -I"C:\deps\openssl-1.0.1e\include"

LIBPATHS= \
 -L"C:\deps\boost_1_53_0\stage\lib" \
 -L"C:\deps\db-4.8.30.NC\build_unix" \
 -L"C:\deps\openssl-1.0.1e"

LIBS= \
 -l boost_system-mgw46-mt-sd-1_53 \
 -l boost_filesystem-mgw46-mt-sd-1_53 \
 -l boost_program_options-mgw46-mt-sd-1_53 \
 -l boost_thread-mgw46-mt-sd-1_53 \
 -l db_cxx \
 -l ssl \
 -l crypto

DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6
DEBUGFLAGS=-g
CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)

TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)

ifdef USE_UPNP
 INCLUDEPATHS += -I"C:\miniupnpc-1.6-mgw"
 LIBPATHS += -L"C:\miniupnpc-1.6-mgw"
 LIBS += -l miniupnpc -l iphlpapi
 DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif

LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi

# TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are
HEADERS = $(wildcard *.h)

OBJS= \
    obj/version.o \
    obj/checkpoints.o \
    obj/netbase.o \
    obj/addrman.o \
    obj/crypter.o \
    obj/key.o \
    obj/db.o \
    obj/init.o \
    obj/irc.o \
    obj/keystore.o \
    obj/main.o \
    obj/net.o \
    obj/protocol.o \
    obj/bitcoinrpc.o \
    obj/rpcdump.o \
    obj/rpcnet.o \
    obj/rpcrawtransaction.o \
    obj/script.o \
    obj/scrypt.o \
    obj/sync.o \
    obj/util.o \
    obj/wallet.o \
    obj/walletdb.o \
    obj/noui.o


all: litecoind.exe

obj/scrypt.o: scrypt.c
gcc -c $(CFLAGS) -o $@ $^

obj/%.o: %.cpp $(HEADERS)
g++ -c $(CFLAGS) -o $@ $<

litecoind.exe: $(OBJS:obj/%=obj/%)
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))

obj-test/%.o: test/%.cpp $(HEADERS)
g++ -c $(TESTDEFS) $(CFLAGS) -o $@ $<

test_litecoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework $(LIBS)

clean:
-del /Q litecoind test_litecoin
-del /Q obj\*
-del /Q obj-test\*
-del /Q build.h


Compiled it and got this:


1714141074
Hero Member
*
Offline Offline

Posts: 1714141074

View Profile Personal Message (Offline)

Ignore
1714141074
Reply with quote  #2

1714141074
Report to moderator
1714141074
Hero Member
*
Offline Offline

Posts: 1714141074

View Profile Personal Message (Offline)

Ignore
1714141074
Reply with quote  #2

1714141074
Report to moderator
1714141074
Hero Member
*
Offline Offline

Posts: 1714141074

View Profile Personal Message (Offline)

Ignore
1714141074
Reply with quote  #2

1714141074
Report to moderator
Be very wary of relying on JavaScript for security on crypto sites. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Mylon
Full Member
***
Offline Offline

Activity: 140
Merit: 100

Mining FTW


View Profile
May 05, 2013, 08:02:26 AM
 #2

Looks like your issue in this is from the tutorial you used:
2.2 Berkeley DB: http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
We'll use version 4.8 to preserve binary wallet compatibility.
From a MinGW shell unpack the source archive, configure, edit line 113 of db.h then make:
Code:
cd /c/deps/
tar xvfz db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
../dist/configure --disable-replication --enable-mingw --enable-cxx

after configuring make sure to edit your build_unix/db.h by replacing line 113:
Code:
typedef pthread_t db_threadid_t;
with
Code:
typedef u_int32_t db_threadid_t;
Thanks to Icy, see: https://bitcointalk.org/index.php?topic=45507.0
Not sure how you would be able to fix it though... all of my self compiles up to date, always had 50% tutorial, and 50% errors which needed googling to resolve. (was just looking at dependency issues myself)

"All Your Base Are Belong To Us" by CATS
wiggi
Sr. Member
****
Offline Offline

Activity: 403
Merit: 251


View Profile
May 05, 2013, 11:55:05 AM
 #3

A quick fix for the "pthread_t has a previous declaration as..." error: use the old qtgui_deps_1.zip
for database and only the newest boost and openssl versions, i.e. in the  .pro file:

Code:
# Dependency library locations can be customized with:
#    BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
#    BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively
BOOST_LIB_SUFFIX=-mgw46-mt-sd-1_53
BOOST_INCLUDE_PATH=C:\deps\boost_1_53_0
BOOST_LIB_PATH=C:\deps\boost_1_53_0\stage\lib
OPENSSL_INCLUDE_PATH=c:/deps/openssl-1.0.1e/include
OPENSSL_LIB_PATH=c:/deps/openssl-1.0.1e

To get it to compile, I also commented out the  "# regenerate src/build.h"
section, and changed

Code:
#    windows:BOOST_LIB_SUFFIX = -mgw44-mt-1_43
    windows:BOOST_LIB_SUFFIX = -mgw46-mt-1_53

and

Code:
#windows:LIBS += -lole32 -luuid -lgdi32
windows:LIBS += -lole32 -loleaut32 -luuid -lwsock32 -lgdi32 -lm

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 05, 2013, 02:15:55 PM
 #4

A quick fix for the "pthread_t has a previous declaration as..." error: use the old qtgui_deps_1.zip
for database and only the newest boost and openssl versions, i.e. in the  .pro file:

Code:
# Dependency library locations can be customized with:
#    BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
#    BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively
BOOST_LIB_SUFFIX=-mgw46-mt-sd-1_53
BOOST_INCLUDE_PATH=C:\deps\boost_1_53_0
BOOST_LIB_PATH=C:\deps\boost_1_53_0\stage\lib
OPENSSL_INCLUDE_PATH=c:/deps/openssl-1.0.1e/include
OPENSSL_LIB_PATH=c:/deps/openssl-1.0.1e

To get it to compile, I also commented out the  "# regenerate src/build.h"
section, and changed

Code:
#    windows:BOOST_LIB_SUFFIX = -mgw44-mt-1_43
    windows:BOOST_LIB_SUFFIX = -mgw46-mt-1_53


that
and

Code:
#windows:LIBS += -lole32 -luuid -lgdi32
windows:LIBS += -lole32 -loleaut32 -luuid -lwsock32 -lgdi32 -lm



thanks, giving it a shot

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 05, 2013, 02:22:06 PM
 #5

A quick fix for the "pthread_t has a previous declaration as..." error: use the old qtgui_deps_1.zip
for database and only the newest boost and openssl versions, i.e. in the  .pro file:

Code:
# Dependency library locations can be customized with:
#    BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
#    BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively
BOOST_LIB_SUFFIX=-mgw46-mt-sd-1_53
BOOST_INCLUDE_PATH=C:\deps\boost_1_53_0
BOOST_LIB_PATH=C:\deps\boost_1_53_0\stage\lib
OPENSSL_INCLUDE_PATH=c:/deps/openssl-1.0.1e/include
OPENSSL_LIB_PATH=c:/deps/openssl-1.0.1e

To get it to compile, I also commented out the  "# regenerate src/build.h"
section, and changed

Code:
#    windows:BOOST_LIB_SUFFIX = -mgw44-mt-1_43
    windows:BOOST_LIB_SUFFIX = -mgw46-mt-1_53



and

Code:
#windows:LIBS += -lole32 -luuid -lgdi32
windows:LIBS += -lole32 -loleaut32 -luuid -lwsock32 -lgdi32 -lm



still have the same error Sad

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 05, 2013, 02:33:23 PM
 #6

A quick fix for the "pthread_t has a previous declaration as..." error: use the old qtgui_deps_1.zip
for database


where do I find the old qtguit_deps_1.zip

and where do I unpack it to?

wiggi
Sr. Member
****
Offline Offline

Activity: 403
Merit: 251


View Profile
May 05, 2013, 05:16:40 PM
 #7

where do I find the old qtguit_deps_1.zip

and where do I unpack it to?

qtgui_deps_1.zip: Old link is dead, no mirror,
uploaded what I think is the original: http://www1.datafilehost.com/d/8561ef9a
I don't have the .sig file. Md5 checksum of uploaded file is a3840184ea3bedb8eedb755265ca6e42.

To unpack, copy \lib and \include folder over C:\MinGW\lib and C:\MinGW\include, respectively.

If QtSDK is installed, there is also C:\QtSDK\mingw\lib and C:\QtSDK\mingw\include
but these are normally not used. (?)

Not sure about litecoin-master, or the daemon/makefile.mingw, but the 0.6.3c (the official release) Qt-client is fine.
(compile from Qt4.8.4 command prompt started as admin, not from Qt-Creator)

Also, only DLLs from C:\MinGW\bin and C:\Qt\4.8.4\bin work.
(other versions of the same DLLs crash the executable)
wiggi
Sr. Member
****
Offline Offline

Activity: 403
Merit: 251


View Profile
May 05, 2013, 07:19:16 PM
Last edit: May 14, 2013, 03:38:55 PM by wiggi
 #8

Found the cause of this error: it's a naming collision, pthread_t in the Ltc source is something different
than pthread_t in Berkeley DB. (and pthread_t doesn't appear in Btc0.8.1)

EDIT: Solution: rename all occurrences of pthread_t between "#ifdef WIN32" and "#else" in Ltc0.6.3 to pthreadfoo_t
Now it compiles with the new Berkeley DB deps. (but is still compatible to the old ones)

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 05, 2013, 09:14:06 PM
 #9

sweet thanks, much appreciated, so now to hunt down and change everything, lol

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 06, 2013, 11:35:18 PM
 #10


Found the cause of this error: it's a naming collision, pthread_t in the Ltc source is something different
than pthread_t in Berkeley DB. (and pthread_t doesn't appear in Btc0.8.1)

Solution: rename all occurrences of pthread_t in Ltc0.6.3 to pthreadfoo_t
Now it compiles with the new Berkeley DB deps. (but is still compatible to the old ones)



do you know which files pthread_t is mentioned I'm going through the files and doing a find & replace and not finding any instances so far.

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 07, 2013, 11:47:09 AM
 #11

Bump for answers

JohnDorien
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
May 07, 2013, 11:51:35 AM
 #12

add -D__NO_SYSTEM_INCLUDES to the crypto def parameters in the makefile, that made it work for me as it seemed to be a collision of bdb and sys definitions.

Maybe if you have a look at my compiling problem, too? https://bitcointalk.org/index.php?topic=196652.0
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 07, 2013, 02:50:03 PM
 #13

add -D__NO_SYSTEM_INCLUDES to the crypto def parameters in the makefile, that made it work for me as it seemed to be a collision of bdb and sys definitions.

Maybe if you have a look at my compiling problem, too? https://bitcointalk.org/index.php?topic=196652.0

thanks, I'll try that when I get back home from work today

wiggi
Sr. Member
****
Offline Offline

Activity: 403
Merit: 251


View Profile
May 07, 2013, 02:59:23 PM
 #14


do you know which files pthread_t is mentioned I'm going through the files and doing a find & replace and not finding any instances so far.
in Util.h
https://github.com/litecoin-project/litecoin/blob/0.6.3/src/util.h

and only the first 4 "pthread_t" out of 8 (i.e. between "#ifdef WIN32" and  "#else",
it's better to leave the Linux part alone)


But -D__NO_SYSTEM_INCLUDES would be the clean solution.
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 07, 2013, 03:06:59 PM
 #15

thanks, will do, you guys are the best!

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 07, 2013, 11:28:59 PM
 #16

New Problem, this one I think I know how to fix but thought I'd still post it cause I'm sure someone reading this thread in the future will have the same problem and will need the solution so if you know the solution please respond.



the contents of my makefile

Quote
# Copyright (c) 2009-2010 Satoshi Nakamoto
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt or http://www.opensource.org/licenses/mit-license.php.

USE_UPNP:=0

INCLUDEPATHS= \
 -I"C:\deps\boost_1_53_0" \
 -I"C:\deps\db-4.8.30.NC\build_unix" \
 -I"C:\deps\openssl-1.0.1e\include"

LIBPATHS= \
 -L"C:\deps\boost_1_53_0\stage\lib" \
 -L"C:\deps\db-4.8.30.NC\build_unix" \
 -L"C:\deps\openssl-1.0.1e"

LIBS= \
 -l boost_system-mgw46-mt-sd-1_53 \
 -l boost_filesystem-mgw46-mt-sd-1_53 \
 -l boost_program_options-mgw46-mt-sd-1_53 \
 -l boost_thread-mgw46-mt-sd-1_53 \
 -l db_cxx \
 -l ssl \
 -l crypto

DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6 -D__NO_SYSTEM_INCLUDES
DEBUGFLAGS=-g
CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)

TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)

ifdef USE_UPNP
 INCLUDEPATHS += -I"C:\miniupnpc-1.6-mgw"
 LIBPATHS += -L"C:\miniupnpc-1.6-mgw"
 LIBS += -l miniupnpc -l iphlpapi
 DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
endif

LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock

-l shlwapi

# TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are
HEADERS = $(wildcard *.h)

OBJS= \
    obj/version.o \
    obj/checkpoints.o \
    obj/netbase.o \
    obj/addrman.o \
    obj/crypter.o \
    obj/key.o \
    obj/db.o \
    obj/init.o \
    obj/irc.o \
    obj/keystore.o \
    obj/main.o \
    obj/net.o \
    obj/protocol.o \
    obj/bitcoinrpc.o \
    obj/rpcdump.o \
    obj/rpcnet.o \
    obj/rpcrawtransaction.o \
    obj/script.o \
    obj/scrypt.o \
    obj/sync.o \
    obj/util.o \
    obj/wallet.o \
    obj/walletdb.o \
    obj/noui.o


all: litecoind.exe

obj/scrypt.o: scrypt.c
   gcc -c $(CFLAGS) -o $@ $^

obj/%.o: %.cpp $(HEADERS)
   g++ -c $(CFLAGS) -o $@ $<

litecoind.exe: $(OBJS:obj/%=obj/%)
   g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)

TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))

obj-test/%.o: test/%.cpp $(HEADERS)
   g++ -c $(TESTDEFS) $(CFLAGS) -o $@ $<

test_litecoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
   g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework $(LIBS)

clean:
   -del /Q litecoind test_litecoin
   -del /Q obj\*
   -del /Q obj-test\*
   -del /Q build.h

AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 08, 2013, 11:23:19 AM
 #17

Bump for answers

JohnDorien
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
May 08, 2013, 11:26:04 AM
 #18

compile with USE_UPNP= at the end of compiling statement
AlexMerced (OP)
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
May 08, 2013, 11:56:48 AM
 #19

compile with USE_UPNP= at the end of compiling statement

will give that a shot when I get home today so basically your saying I should type into the command line the following

Quote
mingw32-make -f makefile.mingw USE_PNP=

JohnDorien
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


View Profile
May 08, 2013, 12:00:53 PM
 #20

compile with USE_UPNP= at the end of compiling statement

will give that a shot when I get home today so basically your saying I should type into the command line the following

Quote
mingw32-make -f makefile.mingw USE_PNP=

correct
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!