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 

compiling under osx 10.4

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



Joined: 14 Jan 2009
Posts: 2

PostPosted: Wed Jan 14, 2009 4:27 pm    Post subject: compiling under osx 10.4 Reply with quote

Hi,
I get this error when trying to build under mac osx 10.4.11

Code:
pb:~/build/retroshare-package-v0.4.10udp/src/miniupnpc-1.2 pie$ make
gcc -shared -Wl,-soname,libminiupnpc.so.3 -o libminiupnpc.so miniwget.o minixml.o igd_desc_parse.o minisoap.o miniupnpc.o upnpreplyparse.o upnpcommands.o minissdpc.o upnperrors.o
powerpc-apple-darwin8-gcc-4.0.1: unrecognized option '-shared'
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: unknown flag: -soname
collect2: ld returned 1 exit status
make: *** [libminiupnpc.so] Error 1


What am I doing wrong?

Code:
gcc -v
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)


Code:
ld -v

Apple Computer, Inc. version cctools-622.9~2


Thanks in advance!
pie
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Wed Jan 14, 2009 5:00 pm    Post subject: Reply with quote

apparently the OS X toolchain has trouble making shared libraries.
Try "make upnpc-static"
_________________
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: Wed Jan 14, 2009 5:10 pm    Post subject: Reply with quote

On Mac OS X, -shared is replaced by -dynamiclib
and -soname by -install_name
I know little about Apple compiler and linker.
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
pie



Joined: 14 Jan 2009
Posts: 2

PostPosted: Sat Jan 17, 2009 6:57 pm    Post subject: Reply with quote

perfect!!! Very Happy

thank you very much!
pie
Back to top
View user's profile Send private message
jweyrich



Joined: 18 Jul 2009
Posts: 6
Location: Brazil

PostPosted: Sat Jul 18, 2009 9:01 pm    Post subject: Reply with quote

Here goes my Makefile patch (for miniupnpc-20090713.tar.gz)

Code:

--- Makefile.orig   2009-07-13 05:49:38.000000000 -0300
+++ Makefile   2009-07-18 19:13:17.000000000 -0300
@@ -8,6 +8,7 @@
 # $ INSTALLPREFIX=/usr/local make install
 # or
 # make install (will go to /usr/bin, /usr/lib, etc...)
+OS = $(shell uname)
 CC ?= gcc
 #AR = gar
 #CFLAGS = -fPIC -O -Wall -g -DDEBUG
@@ -35,8 +36,14 @@
 HEADERS = miniupnpc.h miniwget.h upnpcommands.h igd_desc_parse.h \
           upnpreplyparse.h upnperrors.h declspec.h
 LIBRARY = libminiupnpc.a
-SHAREDLIBRARY = libminiupnpc.so
-SONAME = $(SHAREDLIBRARY).$(APIVERSION)
+ifeq ($(OS), Darwin)
+   SHAREDLIBRARY = libminiupnpc.dylib
+   SONAME = $(basename $(SHAREDLIBRARY)).$(APIVERSION).dylib
+else
+   SHAREDLIBRARY = libminiupnpc.so
+   SONAME = $(SHAREDLIBRARY).$(APIVERSION)
+endif
+
 EXECUTABLES = upnpc-static upnpc-shared \
               testminixml minixmlvalid testupnpreplyparse \
            testigddescparse
@@ -91,7 +98,11 @@
    $(AR) crs $@ $?
 
 $(SHAREDLIBRARY):   $(LIBOBJS)
-   $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
+ifeq ($(OS), Darwin)
+   $(CC) -dynamiclib -Wl,-install_name,$(SONAME) -o $@ $^
+else
+    $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
+endif
 
 upnpc-static:   upnpc.o $(LIBRARY)
    $(CC) -o $@ $^
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Mon Jul 20, 2009 8:56 am    Post subject: Reply with quote

thank you very much
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
jweyrich



Joined: 18 Jul 2009
Posts: 6
Location: Brazil

PostPosted: Tue Jul 21, 2009 9:36 am    Post subject: Reply with quote

I managed to compile and package the current version of miniupnpc as a MacOSX framework, so developers can embed it on the .app's. I know this version is NOT a major release, but it's mainly to check people interest.

This version is universal, so it will run on both PPC and x86.

http://jweyrich.googlecode.com/files/miniupnpc-20090713-universal-apple-darwin.tar.gz

I'd suggest mainstream developers to review if I didn't break any LICENSE, COPYRIGHT, and so on. Please, let me know if something is wrong.

Also, depending on community requests, when I get some free hours, I will do the same for libnatpmp, miniupnpd, etc.

Regards,
Jardel
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Tue Jul 21, 2009 11:04 am    Post subject: Reply with quote

it's very difficult to break the BSD licence...
Just dont forget to cite the author in your documentations and to distribute the Licence file within your package. (people usually rename it LICENCE.miniupnpc so it's easier when you include several piece of code)
_________________
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 -> 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.