View previous topic :: View next topic |
Author |
Message |
pie
Joined: 14 Jan 2009 Posts: 2
|
Posted: Wed Jan 14, 2009 4:27 pm Post subject: compiling under osx 10.4 |
|
|
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 |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Wed Jan 14, 2009 5:00 pm Post subject: |
|
|
apparently the OS X toolchain has trouble making shared libraries.
Try "make upnpc-static" _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Wed Jan 14, 2009 5:10 pm Post subject: |
|
|
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 |
|
|
pie
Joined: 14 Jan 2009 Posts: 2
|
Posted: Sat Jan 17, 2009 6:57 pm Post subject: |
|
|
perfect!!!
thank you very much!
pie |
|
Back to top |
|
|
jweyrich
Joined: 18 Jul 2009 Posts: 6 Location: Brazil
|
Posted: Sat Jul 18, 2009 9:01 pm Post subject: |
|
|
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 |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
|
Back to top |
|
|
jweyrich
Joined: 18 Jul 2009 Posts: 6 Location: Brazil
|
Posted: Tue Jul 21, 2009 9:36 am Post subject: |
|
|
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 |
|
|
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1589
|
Posted: Tue Jul 21, 2009 11:04 am Post subject: |
|
|
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 |
|
|
|