jclehner / bcm2-utils

Utilities for Broadcom-based cable modems
GNU General Public License v3.0
147 stars 25 forks source link

Can't compile on Windows (MSYS2/Mingw-w64) #9

Closed PatrykMis closed 5 years ago

PatrykMis commented 5 years ago

I'm having the same problem mentioned in Issue 7, so tried to compile master branch using MSYS2 - http://www.msys2.org/ Tried also 32-bit but same errors, just slightly different function names.

make g++ -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -std=c++14 -Wnon-virtual-dtor io.cc -o io.o g++ -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -std=c++14 -Wnon-virtual-dtor rwx.cc -o rwx.o g++ -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -std=c++14 -Wnon-virtual-dtor interface.cc -o interface.o g++ -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -std=c++14 -Wnon-virtual-dtor ps.cc -o ps.o g++ -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -std=c++14 -Wnon-virtual-dtor -c -o bcm2dump.o bcm2dump.cc g++ -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -std=c++14 -Wnon-virtual-dtor util.cc -o util.o cc -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" progress.c -o progress.o cc -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" mipsasm.c -o mipsasm.o g++ -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -std=c++14 -Wnon-virtual-dtor profile.cc -o profile.o cc -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -c -o profiledef.o profiledef.c g++ -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.2-31-gb6ce13c\" -std=c++14 -Wnon-virtual-dtor io.o rwx.o interface.o ps.o bcm2dump.o util.o progress.o mipsasm.o profile.o profiledef.o -o bcm2dump io.o:D:\bcm2-utils/io.cc:84: undefined reference to __imp_ioctlsocket' io.o:D:\bcm2-utils/io.cc:96: undefined reference toimp_ioctlsocket' io.o: In function recv_dontwait': D:\bcm2-utils/io.cc:108: undefined reference toimp_recv' io.o: In function send_nosignal': D:\bcm2-utils/io.cc:116: undefined reference toimp_send' io.o: In function connect_nonblock': D:\bcm2-utils/io.cc:163: undefined reference toimp_connect' io.o: In function set_port': D:\bcm2-utils/io.cc:170: undefined reference toimp_htons' D:\bcm2-utils/io.cc:172: undefined reference to __imp_htons' io.o: In functionaddr_to_string': D:\bcm2-utils/io.cc:182: undefined reference to `imp_inet_ntop' D:\bcm2-utils/io.cc:184: undefined reference to __imp_inet_ntop' io.o: In functionpending': D:\bcm2-utils/io.cc:320: undefined reference to __imp_select' D:\bcm2-utils/io.cc:327: undefined reference toimp_WSAGetLastError' io.o:D:\bcm2-utils/io.cc:534: undefined reference to __imp_getaddrinfo' io.o:D:\bcm2-utils/io.cc:547: undefined reference toimp_WSAGetLastError' io.o:D:\bcm2-utils/io.cc:557: undefined reference to __imp_socket' io.o:D:\bcm2-utils/io.cc:568: undefined reference toimp_WSAGetLastError' io.o:D:\bcm2-utils/io.cc:576: undefined reference to __imp_WSAGetLastError' io.o:D:\bcm2-utils/io.cc:582: undefined reference toimp_freeaddrinfo' io.o: In function read': D:\bcm2-utils/io.cc:612: undefined reference toimp_recv' rwx.o: In function unsigned int bcm2dump::ntoh<unsigned int>(unsigned int const&)': D:\bcm2-utils/util.h:219: undefined reference to__imp_ntohl' rwx.o: In function unsigned int bcm2dump::hton<unsigned int>(unsigned int const&)': D:\bcm2-utils/util.h:219: undefined reference toimp_htonl' ps.o: In function unsigned short bcm2dump::ntoh<unsigned short>(unsigned short const&)': D:\bcm2-utils/util.h:217: undefined reference toimp_ntohs' bcm2dump.o: In function do_main(int, char**)': D:\bcm2-utils/bcm2dump.cc:401: undefined reference toimp_WSAStartup' D:\bcm2-utils/bcm2dump.cc:402: undefined reference to __imp_WSAGetLastError' mipsasm.o: In functionmipsasm_resolve_labels': D:\bcm2-utils/mipsasm.c:46: undefined reference to __imp_ntohl' D:\bcm2-utils/mipsasm.c:73: undefined reference to__imp_ntohl' D:\bcm2-utils/mipsasm.c:116: undefined reference to `__imp_htonl' collect2.exe: error: ld returned 1 exit status mingw32-make: *** [Makefile:51: bcm2dump] Error 1

Tried to install win32api, tried to include wsock32 and ws2_32, same errors. Clean-installed environment - the same.

jclehner commented 5 years ago

To compile bcm2-utils on Windows, a project file for Dev-Cpp is included. I've put fixing MSYS2 builds onto my todo list, but for now, please try the latest binaries (version 0.9.3).

jclehner commented 5 years ago

Fixed in aaf276f. Closing this.

PatrykMis commented 5 years ago

dev-cpp project works, MSYS2 building also, great work, thanks for quick fix.

Compiling with few warnings but I'm guessing it's not very important: g++ -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.3-4-ga2ea5fc\" -std=c++14 -Wnon-virtual-dtor -c -o bcm2cfg.o bcm2cfg.cc bcm2cfg.cc: In function 'int {anonymous}::do_info(int, char**, bcm2dump::sp&)': bcm2cfg.cc:309:13: warning: unknown conversion type character 'z' in format [-Wformat=] logger::i("%-6s %-12s %5zu b\n", version.c_str(), g->name().c_str(), g->bytes()); ^~~~~~~ bcm2cfg.cc:309:13: warning: too many arguments for format [-Wformat-extra-args] g++ -c -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.3-4-ga2ea5fc\" -std=c++14 -Wnon-virtual-dtor nonvoldef.cc -o nonvoldef.o nonvoldef.cc: In member function 'virtual std::__cxx11::string bcm2cfg::{anonymous}::nv_timestamp::to_string(unsigned int, bool) const': nonvoldef.cc:56:34: warning: unknown conversion type character 'F' in format [-Wformat=] strftime(buf, sizeof(buf) - 1, "%F %R", localtime(&time)); ^~~ nonvoldef.cc:56:34: warning: unknown conversion type character 'R' in format [-Wformat=] g++ -Wall -Wno-sign-compare -g -DVERSION=\"v0.9.3-4-ga2ea5fc\" -std=c++14 -Wnon-virtual-dtor -c -o psextract.o psextract.cc psextract.cc: In function 'void {anonymous}::extract_ps(std::istream&, const bcm2dump::ps_header&)': psextract.cc:110:12: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'long long unsigned int' [-Wformat=] logger::i("0x%07lx ", streamoff(in.tellg()) - sizeof(ps_header::raw)); ^~~ ~~~~~~~~~~ psextract.cc: In function 'void {anonymous}::extract_image(std::istream&)': psextract.cc:141:13: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'std::streamoff' {aka 'long long int'} [-Wformat=] logger::i("0x%07lx ", beg & 0xffffffff); ^~~ ~~~~