Bitcoin Forum
November 20, 2017, 12:54:30 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] Errors compiling BFGMiner under Windows (MinGW 4.8.1)  (Read 4639 times)
ner0
Newbie
*
Offline Offline

Activity: 7


View Profile
November 22, 2013, 03:58:26 PM
 #1

Hello,

I'm having a hard time compiling bfgminer under Windows x86 and x64 environments with MinGW 4.8.1.
There are a few things that are now a bit outdated in bfgminer git's windows build instructions. But anyway, here's what is going on:

1. mingw-get-inst-xxxxxxxx.exe is no longer maintained, although you can still get a copy from different places on the net.
The new version is mingw-get-setup.exe, which I personally find worst than the previous installer, minor detail anyway, I still went ahead and installed exactly as instructed, through mingw-get-inst-20120426.exe.

2. From there on, I followed every step of the instructions without a hitch... until bfgminer compilation itself.

3. Next step:
Code:
CFLAGS="-O2 -msse2" ./configure
outputs these errors as a result:
Quote
checking for pthread_cancel... no
checking for pthread_create... no
configure: error: Could not find pthread library - please install libpthread
 Sad

4. Now, getting pthread installed in MinGW... (not mentioned in the current build instructions)
Code:
mingw-get install pthreads
OK, this does the trick and the configuration is now able to proceed.

5. Now onto making...
Code:
make
...returns several errors related to missing header files.
In the 10+ times I tried compiling this program, under several builds of Windows, both x86 and x64, I have had this happen every time and not once is it mentioned in the build instructions, maybe something changed in the code since then, I don't know. Example:
Quote
miner.h:31:22: fatal error: blkmaker.h: No such file or directory
 #include <blkmaker.h>
Huh
blkmaker.h is located under bfgminer\libblkmaker, this is getting weirder by the second.

6. At this point I start adding libraries to the make command:
Code:
make CFLAGS="-Ilibblkmaker"
Despite that, it still gives me the finger a few steps bellow:
Quote
 CCLD   bfgminer.exe
bfgminer-miner.o:miner.c:(.text+0x1755d): undefined reference to `llround'
bfgminer-fpgautils.o:fpgautils.c:(.text+0x2ab8): undefined reference to `lowl_usb_attach_kernel_driver'
bfgminer-fpgautils.o:fpgautils.c:(.text+0x2bc4): undefined reference to `lowl_usb_attach_kernel_driver'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: bfgminer-fpgautils.o: bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [bfgminer.exe] Error 1
make[2]: Leaving directory `/home/Administrator/bfgminer'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Administrator/bfgminer'
make: *** [all] Error 2

7. The build instructions mentioned libusb as optional, but it seems is now mandatory.
After installing libusb, I get another missing header file:
Quote
lowl-vcom.c:53:22: fatal error: usbioctl.h: No such file or directory
 #include <usbioctl.h>

8. The only places in my MinGW installation where usbioctl.h is present are:
  • C:\MinGW\include\ddk
  • C:\MinGW\mingw32\include\ddk
Since usbioctl.h in both of those folders is identical, I tried including one of their destinations in CFLAGS:
Code:
make CFLAGS="-Ilibblkmaker -IC:/MinGW/include/ddk"
...which unfortunately breaks on me once again:
Quote
 CC     bfgminer-lowl-usb.o
In file included from util.h:47:0,
                 from logging.h:33,
                 from miner.h:42,
                 from deviceapi.h:10,
                 from fpgautils.h:13,
                 from lowl-usb.c:20:
c:\mingw\include\ws2tcpip.h:38:2: error: #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
 #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
  ^
In file included from util.h:47:0,
                 from logging.h:33,
                 from miner.h:42,
                 from deviceapi.h:10,
                 from fpgautils.h:13,
                 from lowl-usb.c:20:
c:\mingw\include\ws2tcpip.h:147:8: error: redefinition of 'struct ip_mreq'
 struct ip_mreq {
        ^
In file included from c:\mingw\include\windows.h:93:0,
                 from C:/MinGW/include/libusb-1.0/libusb.h:62,
                 from lowl-usb.c:18:
c:\mingw\include\winsock.h:315:8: note: originally defined here
 struct ip_mreq {
        ^
In file included from util.h:47:0,
                 from logging.h:33,
                 from miner.h:42,
                 from deviceapi.h:10,
                 from fpgautils.h:13,
                 from lowl-usb.c:20:
c:\mingw\include\ws2tcpip.h:390:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'freeaddrinfo'
 void WSAAPI freeaddrinfo (struct addrinfo*);
             ^
c:\mingw\include\ws2tcpip.h:391:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getaddrinfo'
 int WSAAPI getaddrinfo (const char*,const char*,const struct addrinfo*,
            ^
c:\mingw\include\ws2tcpip.h:393:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'getnameinfo'
 int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD,
            ^
make[2]: *** [bfgminer-lowl-usb.o] Error 1
make[2]: Leaving directory `/home/Administrator/bfgminer'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Administrator/bfgminer'
make: *** [all] Error 2


I'm at loss here...
I followed the steps in the build instruction flawlessly and even got pthread libraries installed but I can't seem to compile it.

If anyone has any ideas about why this won't compile, I'm all ears!
Thanks.
1511139270
Hero Member
*
Offline Offline

Posts: 1511139270

View Profile Personal Message (Offline)

Ignore
1511139270
Reply with quote  #2

1511139270
Report to moderator
1511139270
Hero Member
*
Offline Offline

Posts: 1511139270

View Profile Personal Message (Offline)

Ignore
1511139270
Reply with quote  #2

1511139270
Report to moderator
1511139270
Hero Member
*
Offline Offline

Posts: 1511139270

View Profile Personal Message (Offline)

Ignore
1511139270
Reply with quote  #2

1511139270
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1511139270
Hero Member
*
Offline Offline

Posts: 1511139270

View Profile Personal Message (Offline)

Ignore
1511139270
Reply with quote  #2

1511139270
Report to moderator
1511139270
Hero Member
*
Offline Offline

Posts: 1511139270

View Profile Personal Message (Offline)

Ignore
1511139270
Reply with quote  #2

1511139270
Report to moderator
1511139270
Hero Member
*
Offline Offline

Posts: 1511139270

View Profile Personal Message (Offline)

Ignore
1511139270
Reply with quote  #2

1511139270
Report to moderator
ner0
Newbie
*
Offline Offline

Activity: 7


View Profile
November 25, 2013, 03:09:38 PM
 #2

New fixes by Luke-Jr fixed this problem somehow.
Thanks Luke!  Wink
tracercho
Newbie
*
Offline Offline

Activity: 12


View Profile
June 09, 2016, 09:28:07 PM
 #3

How he fixed it ?   Shocked
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!