View previous topic :: View next topic |
Author |
Message |
yakovmotog
Joined: 18 Jul 2016 Posts: 13
|
Posted: Mon Jul 25, 2016 1:23 am Post subject: Errors building for Win7 64 |
|
|
I tried to build on Win 7 64 bit for Win 64 bit using Visual Studio 2015 and msvc/upnpc-static.vcproj
At first I got error due to missing file miniupnpcstrings.h. Then I created it from the another post as
..
#ifndef __MINIUPNPCSTRINGS_H__
#define __MINIUPNPCSTRINGS_H__
#define OS_STRING "Windows/7.0.0000"
#define MINIUPNPC_VERSION_STRING "1.4"
#endif
and compilation succeded, but then I got an error due to miniupnpc.lib was missing (see below).
Severity Code Description Project File Line Suppression State
Error LNK1104 cannot open file 'Debug\miniupnpc.lib' upnpc-static ...miniupnpc-2.0\msvc\LINK 1
So I tried to build miniupnpc.lib using minGW-64 and Makefile.mingw . I install latest version minGW 6.1 x86_64. Added env. path C:\mingw\bin and C:\Program Files\mingw-w64\x86_64-6.1.0-win32-seh-rt_v5-rev0\mingw64\bin
but it failed:
upnpc-2.0>mingw32make.bat
cc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_STATICLIB -c -o wingenminiupnpcstrings.o wingenminiupnpcstrings.c
process_begin: CreateProcess(NULL, cc -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501 -DMINIUPNP_STATICLIB -c -o wingenminiupnpc
strings.o wingenminiupnpcstrings.c, ...) failed.
make (e=2): The system cannot find the file specified.
Makefile.mingw:56: recipe for target 'wingenminiupnpcstrings.o' failed
mingw32-make: *** [wingenminiupnpcstrings.o] Error 2
Since I could not build library I copied miniupnpc.lib,.dll from upnpc-exe-win32-20100513.zip you posted (Thanks!) to ..miniupnpc-2.0\msvc\Debug
Then VS2015 built failed with error
Severity Code Description Project File Line Suppression State
Warning LNK4075 ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification upnpc-static ..miniupnpc-2.0\msvc\upnpc.obj 1
Severity Code Description Project File Line Suppression State
Error LNK2026 module unsafe for SAFESEH image. upnpc-static ..miniupnpc-2.0\msvc\miniupnpc.lib(dotfs00017.o) 1 and bunch of similar errors
Did I copied files to wrong folder (DEBUG)?
Any suggestions?
Should there be Visual Studio project to build miniupnpc.dll/lib, why is minGW needed?
Thanks |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1593
|
Posted: Fri Jul 29, 2016 7:32 pm Post subject: |
|
|
I've never tried to use VS 2015 of win64 so I cannot tell what's wrong, i guess the project files need to be updated.
about MinGW, look at the error : I think "cc" is not the command to run the C Complier on your setup. set the CC var in Makefile.mingw to your C complier _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1593
|
Posted: Fri Jul 29, 2016 7:33 pm Post subject: Re: Errors building for Win7 64 |
|
|
yakovmotog wrote: | Should there be Visual Studio project to build miniupnpc.dll/lib, why is minGW needed?
|
you're welcome to add Visual studio project file to build whatever lib. _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
ironsniper1
Joined: 24 Oct 2018 Posts: 4 Location: everywhere
|
Posted: Wed Oct 24, 2018 3:39 pm Post subject: |
|
|
hey everyone i am having the same issue as the op trying to compile miniupnpc on windows 7 32 bit i am using version 2.1 and i get the same mingw error when i run the bat file, i checked to make sure that gcc was set as my c compiler and it is so i do not know what else is going on, does anyone have any advice i can use? |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1593
|
Posted: Thu Oct 25, 2018 10:12 am Post subject: |
|
|
ironsniper1 wrote: | hey everyone i am having the same issue as the op trying to compile miniupnpc on windows 7 32 bit i am using version 2.1 and i get the same mingw error when i run the bat file, i checked to make sure that gcc was set as my c compiler and it is so i do not know what else is going on, does anyone have any advice i can use? |
cc or gcc ?
you need to add CC=gcc to Makefile.mingw32 if cc is not the compiler
(or set CC=gcc in the .bat file) _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
ironsniper1
Joined: 24 Oct 2018 Posts: 4 Location: everywhere
|
Posted: Thu Oct 25, 2018 3:08 pm Post subject: |
|
|
that i do not know whatever gets installed with mingw32/msys
EDIT for some reason in the mingw make file it showed CC ?= gcc and i removed the ? and it started working but now i got a new error
Code: | gcc -o upnpc-shared dll/upnpc.o miniupnpc.lib -lws2_32 -liphlpapi
g++ testminixml.c minixml.o igd_desc_parse.o -lws2_32 -liphlpapi -o testmin
ixml
C:\Users\compile\AppData\Local\Temp\ccMkD0lL.o:testminixml.c:(.text+0x120): unde
fined reference to `IGDstartelt(void*, char const*, int)'
C:\Users\compile\AppData\Local\Temp\ccMkD0lL.o:testminixml.c:(.text+0x12a): unde
fined reference to `IGDendelt(void*, char const*, int)'
C:\Users\compile\AppData\Local\Temp\ccMkD0lL.o:testminixml.c:(.text+0x134): unde
fined reference to `IGDdata(void*, char const*, int)'
C:\Users\compile\AppData\Local\Temp\ccMkD0lL.o:testminixml.c:(.text+0x142): unde
fined reference to `parsexml(xmlparser*)'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bi
n/ld.exe: C:\Users\compile\AppData\Local\Temp\ccMkD0lL.o: bad reloc address 0x20
in section `.eh_frame'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bi
n/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
<builtin>: recipe for target 'testminixml' failed
mingw32-make: *** [testminixml] Error 1 |
EDIT 2 using msys cmd line i did make -f Makefile.mingw and it seemed to compile correctly, however when i try to compile the project that needs miniupnpc it cant find the file miniwget.h even know the file is in the folder |
|
Back to top |
|
|
ironsniper1
Joined: 24 Oct 2018 Posts: 4 Location: everywhere
|
Posted: Sun Oct 28, 2018 4:37 am Post subject: |
|
|
okay i got 2.1 compiled and when i try to link to it i get the following errors
Code: | ./build\net.o:net.cpp:(.text+0x67e7): undefined reference to `_imp__upnpDiscover'
./build\net.o:net.cpp:(.text+0x681e): undefined reference to `_imp__UPNP_GetValidIGD'
./build\net.o:net.cpp:(.text+0x6844): undefined reference to `_imp__freeUPNPDevlist'
./build\net.o:net.cpp:(.text+0x68f5): undefined reference to `_imp__UPNP_GetExternalIPAddress'
./build\net.o:net.cpp:(.text+0x6a3d): undefined reference to `_imp__UPNP_AddPortMapping'
./build\net.o:net.cpp:(.text+0x6a58): undefined reference to `_imp__strupnperror'
./build\net.o:net.cpp:(.text+0x6b63): undefined reference to `_imp__strupnperror'
./build\net.o:net.cpp:(.text+0x6be0): undefined reference to `_imp__UPNP_DeletePortMapping'
./build\net.o:net.cpp:(.text+0x6bff): undefined reference to `_imp__freeUPNPDevlist'
./build\net.o:net.cpp:(.text+0x6c0e): undefined reference to `_imp__FreeUPNPUrls'
./build\net.o:net.cpp:(.text+0x6c4c): undefined reference to `_imp__FreeUPNPUrls'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: ./build\net.o: bad reloc address 0x20 in section `.text.unlikely'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status |
|
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1593
|
Posted: Tue Oct 30, 2018 7:35 pm Post subject: |
|
|
ironsniper1 wrote: | okay i got 2.1 compiled and when i try to link to it i get the following errors
Code: | ./build\net.o:net.cpp:(.text+0x67e7): undefined reference to `_imp__upnpDiscover'
./build\net.o:net.cpp:(.text+0x681e): undefined reference to `_imp__UPNP_GetValidIGD'
./build\net.o:net.cpp:(.text+0x6844): undefined reference to `_imp__freeUPNPDevlist'
./build\net.o:net.cpp:(.text+0x68f5): undefined reference to `_imp__UPNP_GetExternalIPAddress'
./build\net.o:net.cpp:(.text+0x6a3d): undefined reference to `_imp__UPNP_AddPortMapping'
./build\net.o:net.cpp:(.text+0x6a58): undefined reference to `_imp__strupnperror'
./build\net.o:net.cpp:(.text+0x6b63): undefined reference to `_imp__strupnperror'
./build\net.o:net.cpp:(.text+0x6be0): undefined reference to `_imp__UPNP_DeletePortMapping'
./build\net.o:net.cpp:(.text+0x6bff): undefined reference to `_imp__freeUPNPDevlist'
./build\net.o:net.cpp:(.text+0x6c0e): undefined reference to `_imp__FreeUPNPUrls'
./build\net.o:net.cpp:(.text+0x6c4c): undefined reference to `_imp__FreeUPNPUrls'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: ./build\net.o: bad reloc address 0x20 in section `.text.unlikely'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status |
|
you need to define properly MINIUPNP_STATICLIB if linking with the static library and not the DLL _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
ironsniper1
Joined: 24 Oct 2018 Posts: 4 Location: everywhere
|
Posted: Tue Oct 30, 2018 7:42 pm Post subject: |
|
|
miniupnp wrote: | ironsniper1 wrote: | okay i got 2.1 compiled and when i try to link to it i get the following errors
Code: | ./build\net.o:net.cpp:(.text+0x67e7): undefined reference to `_imp__upnpDiscover'
./build\net.o:net.cpp:(.text+0x681e): undefined reference to `_imp__UPNP_GetValidIGD'
./build\net.o:net.cpp:(.text+0x6844): undefined reference to `_imp__freeUPNPDevlist'
./build\net.o:net.cpp:(.text+0x68f5): undefined reference to `_imp__UPNP_GetExternalIPAddress'
./build\net.o:net.cpp:(.text+0x6a3d): undefined reference to `_imp__UPNP_AddPortMapping'
./build\net.o:net.cpp:(.text+0x6a58): undefined reference to `_imp__strupnperror'
./build\net.o:net.cpp:(.text+0x6b63): undefined reference to `_imp__strupnperror'
./build\net.o:net.cpp:(.text+0x6be0): undefined reference to `_imp__UPNP_DeletePortMapping'
./build\net.o:net.cpp:(.text+0x6bff): undefined reference to `_imp__freeUPNPDevlist'
./build\net.o:net.cpp:(.text+0x6c0e): undefined reference to `_imp__FreeUPNPUrls'
./build\net.o:net.cpp:(.text+0x6c4c): undefined reference to `_imp__FreeUPNPUrls'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: ./build\net.o: bad reloc address 0x20 in section `.text.unlikely'
C:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status |
|
you need to define properly MINIUPNP_STATICLIB if linking with the static library and not the DLL |
i did that however it was not working until someone told me to add this to miniupnpc_declspec.h
Code: | #if 0 && defined(_WIN32) && !defined(MINIUPNP_STATICLIB) |
and now it works |
|
Back to top |
|
|
|