我正在尝试从源代码(http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.tar.gz)编译 miniupnpc 并且遇到了一些错误。我已经安装了 MinGW 并将其添加到路径中。然后我提取源代码并运行 mingw32make.bat,但我不知道出了什么问题。下面是命令的输出
C:\Users\dev\tools\mingw\msys\1.0\home\Aidan\miniupnpc-1.8>>mingw32make.bat
mkdir dll
echo init > init
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o upnpc.o upnpc.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -c -o dll/upnpc.o upnpc.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o wingenminiupnpcstrings.o wingenminiupnpcstrings.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/wingenminiupnpcstrings.o wingenminiupnpcstrings.c
gcc wingenminiupnpcstrings.o -lws2_32 -liphlpapi -o wingenminiupnpcstrings
wingenminiupnpcstrings miniupnpcstrings.h.in miniupnpcstrings.h
Windows 6.1 Build 7601 Service Pack 1
MiniUPnPc version 1.8
15 lines written to miniupnpcstrings.h.
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o miniwget.o miniwget.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/miniwget.o miniwget.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o minixml.o minixml.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/minixml.o minixml.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o igd_desc_parse.o igd_desc_parse.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/igd_desc_parse.o igd_desc_parse.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o minisoap.o minisoap.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/minisoap.o minisoap.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o miniupnpc.o miniupnpc.c
miniupnpc.c: In function 'upnpDiscover':
miniupnpc.c:422:9: warning: variable 'dwRetVal' set but not used [-Wunused-but-set-variable]
DWORD dwRetVal = 0;
^
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/miniupnpc.o miniupnpc.c
miniupnpc.c: In function 'upnpDiscover':
miniupnpc.c:422:9: warning: variable 'dwRetVal' set but not used [-Wunused-but-set-variable]
DWORD dwRetVal = 0;
^
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o upnpreplyparse.o upnpreplyparse.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/upnpreplyparse.o upnpreplyparse.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o upnpcommands.o upnpcommands.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/upnpcommands.o upnpcommands.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o upnperrors.o upnperrors.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/upnperrors.o upnperrors.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o connecthostport.o connecthostport.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/connecthostport.o connecthostport.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o portlistingparse.o portlistingparse.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/portlistingparse.o portlistingparse.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DSTATICLIB -c -o receivedata.o receivedata.c
gcc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_EXPORTS -c -o dll/receivedata.o receivedata.c
ar cr libminiupnpc.a miniwget.o minixml.o igd_desc_parse.o minisoap.o miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o connecthostport.o portlistingparse
.o receivedata.o
gcc -enable-stdcall-fixup -o upnpc-static upnpc.o libminiupnpc.a -lws2_32 -liphlpapi
c:/users/dev/tools/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: warning: cannot find entry symbol nable-stdcall-fixup; defaulting to
0000000000401000
dllwrap -k --driver-name gcc \
--def miniupnpc.def \
--output-def miniupnpc.dll.def \
--implib miniupnpc.lib -o miniupnpc.dll \
dll/miniwget.o dll/minixml.o dll/igd_desc_parse.o dll/minisoap.o dll/miniupnpc.o dll/upnpreplyparse.o dll/upnpcommands.o dll/upnperrors.o dll/connecthostport.o d
ll/portlistingparse.o dll/receivedata.o -lws2_32 -liphlpapi
dlltool: Syntax error in def file miniupnpc.def:5
dlltool: Syntax error in def file miniupnpc.def:5
echo miniupnpc.lib generated with miniupnpc.dll
miniupnpc.lib generated with miniupnpc.dll
gcc -enable-stdcall-fixup -o upnpc-shared dll/upnpc.o miniupnpc.lib -lws2_32 -liphlpapi
c:/users/dev/tools/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: warning: cannot find entry symbol nable-stdcall-fixup; defaulting to
0000000000401000
dll/upnpc.o:upnpc.c:(.text+0x31): undefined reference to `_imp__UPNP_GetConnectionTypeInfo'
dll/upnpc.o:upnpc.c:(.text+0x8f): undefined reference to `_imp__UPNP_GetStatusInfo'
dll/upnpc.o:upnpc.c:(.text+0x157): undefined reference to `_imp__UPNP_GetLinkLayerMaxBitRates'
dll/upnpc.o:upnpc.c:(.text+0x289): undefined reference to `_imp__UPNP_GetExternalIPAddress'
dll/upnpc.o:upnpc.c:(.text+0x3cd): undefined reference to `_imp__UPNP_GetExternalIPAddress'
dll/upnpc.o:upnpc.c:(.text+0x43b): undefined reference to `_imp__UPNP_AddPortMapping'
dll/upnpc.o:upnpc.c:(.text+0x44e): undefined reference to `_imp__strupnperror'
dll/upnpc.o:upnpc.c:(.text+0x4c2): undefined reference to `_imp__UPNP_GetSpecificPortMappingEntry'
dll/upnpc.o:upnpc.c:(.text+0x4d1): undefined reference to `_imp__strupnperror'
c:/users/dev/tools/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: dll/upnpc.o: bad reloc address 0x23 in section `.text.startup'
c:/users/dev/tools/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
Makefile.mingw:64: recipe for target 'upnpc-shared' failed
mingw32-make: *** [upnpc-shared] Error 1