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 

Cross-compile on Ubuntu 14.04

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



Joined: 05 Feb 2015
Posts: 8

PostPosted: Tue Mar 03, 2015 3:07 pm    Post subject: Cross-compile on Ubuntu 14.04 Reply with quote

Hello,

How can i cross compile libnatpmp for windows(libnatpmp.dll) under Ubuntu 14.04.
I have installed mingw32 and mingw-w64 packages.

Actually i made unsuccessful attempt:)

I made minor changes in Makefile
OS = $(shell uname -s) -> OS = WINDOWS
but i got error:

# make all
i686-w64-mingw32-gcc -shared -Wl,-soname, -o natpmp.dll natpmp.o getgateway.o -lws2_32 -lIphlpapi -Wl,--no-undefined -Wl,--enable-runtime-pseudo-reloc --Wl,kill-at
i686-w64-mingw32-gcc: error: unrecognized command line option ‘--Wl,kill-at’
make: *** [natpmp.dll] Error 1


After that i remove --Wl,kill-at and change flag -lIphlpapi to -liphlpapi
EXTRA_LD = -lws2_32 -liphlpapi -Wl,--no-undefined -Wl,--enable-runtime-pseudo-reloc

but still getting errors from linker

#make all
i686-w64-mingw32-gcc -shared -Wl,-soname, -o natpmp.dll natpmp.o getgateway.o -lws2_32 -liphlpapi -Wl,--no-undefined -Wl,--enable-runtime-pseudo-reloc
natpmp.o:natpmp.cSad.text+0x199): undefined reference to `natpmp_gettimeofday'
natpmp.o:natpmp.cSad.text+0x1f7): undefined reference to `natpmp_gettimeofday'
natpmp.o:natpmp.cSad.text+0x489): undefined reference to `_imp__readnatpmpresponse'
natpmp.o:natpmp.cSad.text+0x4ad): undefined reference to `natpmp_gettimeofday'
/usr/bin/i686-w64-mingw32-ld: natpmp.o: bad reloc address 0x0 in section `.rdata'
collect2: error: ld returned 1 exit status
make: *** [natpmp.dll] Error 1


Any suggestions?
Thanks
Back to top
View user's profile Send private message
jikard0



Joined: 05 Feb 2015
Posts: 8

PostPosted: Tue Mar 03, 2015 3:17 pm    Post subject: latest source from github Reply with quote

I forgot to mentioned that i get latest source from github/master branch

regards
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1592

PostPosted: Tue Mar 03, 2015 10:32 pm    Post subject: Reply with quote

Code:
--- Makefile    2014-12-13 11:20:11.000000000 +0100
+++ Makefile.mingw32    2015-03-03 23:33:58.000000000 +0100
@@ -4,7 +4,8 @@
 # (c) 2007-2013 Thomas Bernard
 # http://miniupnp.free.fr/libnatpmp.html
 
-OS = $(shell uname -s)
+#OS = $(shell uname -s)
+OS = WIN
 CC ?= gcc
 INSTALL = install -p
 ARCH = $(shell uname -m | sed -e s/i.86/i686/)
@@ -46,7 +47,8 @@
   SHAREDLIB = natpmp.dll
   JNISHAREDLIB = jninatpmp.dll
   CC = i686-w64-mingw32-gcc
-  EXTRA_LD = -lws2_32 -lIphlpapi -Wl,--no-undefined -Wl,--enable-runtime-pseudo-reloc --Wl,kill-at
+  EXTRA_LD = -lws2_32 -liphlpapi -Wl,--no-undefined -Wl,--enable-runtime-pseudo-reloc
+  LIBOBJS += wingettimeofday.o
 else
   SHAREDLIB = libnatpmp.so
   JNISHAREDLIB = libjninatpmp.so

_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> libnatpmp 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.