miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Errors building for Win7 64

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Compilation/Installation
View previous topic :: View next topic  
Author Message
yakovmotog



Joined: 18 Jul 2016
Posts: 13

PostPosted: Mon Jul 25, 2016 1:23 am    Post subject: Errors building for Win7 64 Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Fri Jul 29, 2016 7:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Fri Jul 29, 2016 7:33 pm    Post subject: Re: Errors building for Win7 64 Reply with quote

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
View user's profile Send private message Visit poster's website
ironsniper1



Joined: 24 Oct 2018
Posts: 4
Location: everywhere

PostPosted: Wed Oct 24, 2018 3:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Thu Oct 25, 2018 10:12 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ironsniper1



Joined: 24 Oct 2018
Posts: 4
Location: everywhere

PostPosted: Thu Oct 25, 2018 3:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
ironsniper1



Joined: 24 Oct 2018
Posts: 4
Location: everywhere

PostPosted: Sun Oct 28, 2018 4:37 am    Post subject: Reply with quote

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
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Oct 30, 2018 7:35 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ironsniper1



Joined: 24 Oct 2018
Posts: 4
Location: everywhere

PostPosted: Tue Oct 30, 2018 7:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Compilation/Installation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.