Hi,
thanks for the howto.
I'm trying to compile amule-cvs (20071110) as universal binary but I have some problems.
In particular it's dynamically linked to the MacPorts libraries libpng, libgd and the dependent libraries: jpeg,freetype,fontconfig,expat,... and even zlib and libiconv (MacPorts doesn't use system libraries).
But let me start from beginning:
My system:
OSX 10.4.10 PPC
XCode 2.4.1
last MacPorts, ports installed:
bzip2 @1.0.4_1+universal (active)
cryptlib @3.1_2 (active)
dd_rescue @1.10_0 (active)
expat @2.0.1_0+universal (active)
fontconfig @2.4.2_1+macosx+universal (active)
freetype @2.3.5_0+universal (active)
gd2 @2.0.35_0+no_x11+universal (active)
gettext @0.17_0+universal (active)
gnupg @1.4.7_0+idea (active)
jpeg @6b_2+universal (active)
libiconv @1.11_6+darwin_8+universal (active)
libpcap @0.9.5_1+universal (active)
libpng @1.2.22_0+darwin_8+universal (active)
links @2.1pre28_0+ssl+universal (active)
ncurses @5.6_0+darwin_8+universal (active)
ncursesw @5.6_0+darwin_8+universal (active)
openssl @0.9.8g_0+darwin_8+universal (active)
pcre @7.4_0+universal (active)
pwgen @2.06_1+universal (active)
readline @5.2.007_0+universal (active)
secpwgen @1.3_0 (active)
wget @1.10.2_0+darwin_8+universal (active)
zlib @1.2.3_1+universal (active)
Regarding automake & flex:
At some point amule cvs did not compile with the versions that were included in OS X/Xcode, so I had to install more recent ones. It's good to know that that is no longer the case but I'm a little conflicted now if I should leave them in to be on the safe side or if I should remove them.
Now it works with system automake and flex,
but amule configure tell me:
checking for extended flex capabilities... no
configure: Your flex version doesn't support --header-file flag. This is not critical, but an upgrade is recommended
Regarding libgd:
I think libgd is only required for the generation of the stats graphs in amuleweb. Unfortunately, libgd is neither included with MacPorts nor with Fink and I figured putting in instructions for compiling it by hand would be outside the scope of the how-to considering how little relevance libgd has within amule. If you find a good way to include a little note on this please go ahead and put it in.
Now MacPorts have libgd (gd2).
To compile wxMac I used:
CFLAGS="-O2" \
CXXFLAGS="-O2" \
CPPFLAGS="-I/opt/local/include" \
LDFLAGS="-L/opt/local/lib" \
time ../configure \
--disable-shared \
--enable-unicode \
--with-opengl \
--enable-optimise \
--enable-universal_binary \
&& read \
&& time make -j2 || exit 1
Some info:
Configured wxWidgets 2.8.6 for `powerpc-apple-darwin8.10.0'
Which GUI toolkit should wxWidgets use? mac
Should wxWidgets be compiled into single library? no
Should wxWidgets be compiled in debug mode? no
Should wxWidgets be linked as a shared library? no
Should wxWidgets be compiled in Unicode mode? yes
What level of wxWidgets compatibility should be enabled?
wxWidgets 2.4 no
wxWidgets 2.6 yes
Which libraries should wxWidgets use?
jpeg sys
png sys
regex builtin
tiff builtin
zlib sys
odbc no
expat sys
libmspack no
sdl no
To compile aMule:
CFLAGS="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2" \
CXXFLAGS="-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2" \
CPPFLAGS="-I/opt/local/include" \
LDFLAGS="-L/opt/local/lib" \
time ./configure \
--disable-debug \
--enable-optimize \
--enable-amulecmd \
--enable-webserver \
--enable-cas \
--enable-wxcas \
--enable-alc \
--enable-alcc \
--enable-amule-daemon \
--enable-amule-gui \
--with-wxdir=../wxMac-2.8.6/build \
--disable-dependency-tracking \
&& read \
&& time make -j2 \
&& ./src/utils/scripts/mac_packager || exit 1
Some info:
Configured aMule CVS for 'powerpc-apple-darwin8.10.0'.
aMule enabled options:
**** aMule Core ****
Prefix where aMule should be installed? /usr/local
Should aMule be compiled with i18n support? yes
Should aMule be compiled in debug mode? no
Should aMule be compiled with profiling? no
Should aMule be compiled with optimizations? yes
Should aMule be compiled with UPnP support? yes
Should aMule be compiled with IP2country support? yes
Should aMule monolithic application be built? yes
Should aMule daemon version be built? yes
Should aMule remote gui be built? (EXPERIMENTAL) yes
Crypto++ library/headers style? embedded
**** aMule TextClient ****
Should aMule Command Line Client be built? yes
**** aMule WebServer ****
Should aMule WebServer be built? yes
**** aMule ED2K Links Handler ****
Should aMule ED2K Links Handler be built? yes
**** aMuleLinkCreator ****
Should aMuleLinkCreator GUI version (alc) be built? yes
Should aMuleLinkCreator for console (alcc) be built? yes
**** aMule Statistics ****
Should C aMule Statistics (CAS) be built? yes
Should aMule GUI Statistics (wxCas) be built? yes
**** General Libraries and Tools ****
Should ccache support be enabled? no
Libraries aMule will use to build:
wxWidgets 2.8.6 (mac,static)
crypto++ embedded
libpng 1.2.22
libgd 2.0.35
zlib 1.2.3
I found 2 binary that aren't universal:
super:~/mulo/amule-cvs gtoso$ find . |xargs file|grep -v "Mach-O fat "|grep -v "(for architecture "|grep Mach-O
./aMule.app/Contents/MacOS/ed2kHelperScript.app/Contents/MacOS/applet: Mach-O executable ppc
./src/libs/ec/cpp/mkFileSum: Mach-O executable ppc
super:~/mulo/amule-cvs gtoso$ find /Applications/aMule-2.1.3-Mac_UniversalBinary_TigerOnly/ |xargs file|grep -v "Mach-O fat "|grep -v "(for architecture "|grep Mach-O
/Applications/aMule-2.1.3-Mac_UniversalBinary_TigerOnly//aMule.app/Contents/MacOS/ed2kHelperScript.app/Contents/MacOS/applet: Mach-O executable ppc
super:~/mulo/amule-cvs gtoso$
The first one is in the sources and it's present in official aMule,
the second one is compiled without CFLAGS, but I don't think that it's important:
Making all in cpp
gcc ../../../../src/utils/mkFileSum.c -o mkFileSum
Generating ECVersion.h... created.
make all-am
Mac_packager script copy only amule, amulecmd, amuleweb and ed2k in MacOS,
I think that amuled, cas and alcc should be copied in MacOS and amulegui, wxcas and alc should have their app bundles.
It's right?
But the real problem is that binaries are dynamically linked to the MacPorts libraries:
super:~/mulo/amule-cvs gtoso$ otool -L src/amule
src/amule:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
/System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 9.0.0)
/opt/local/lib/libpng12.0.dylib (compatibility version 23.0.0, current version 23.0.0)
/opt/local/lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/opt/local/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
super:~/mulo/amule-cvs gtoso$ otool -L src/amulecmd
src/amulecmd:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0)
/System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 9.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/opt/local/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/opt/local/lib/libreadline.5.2.dylib (compatibility version 5.0.0, current version 5.2.0)
/opt/local/lib/libncurses.5.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
super:~/mulo/amule-cvs gtoso$ otool -L src/utils/cas/cas
src/utils/cas/cas:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 18.0.0)
/usr/X11R6/lib/libXpm.4.dylib (compatibility version 4.11.0, current version 4.11.0)
/usr/X11R6/lib/libX11.6.dylib (compatibility version 6.2.0, current version 6.2.0)
/opt/local/lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
/opt/local/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.16.0)
/opt/local/lib/libpng12.0.dylib (compatibility version 23.0.0, current version 23.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/opt/local/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/opt/local/lib/libgd.2.dylib (compatibility version 3.0.0, current version 3.0.0)
super:~/mulo/amule-cvs gtoso$ otool -L /opt/local/lib/libpng12.0.dylib
/opt/local/lib/libpng12.0.dylib:
/opt/local/lib/libpng12.0.dylib (compatibility version 23.0.0, current version 23.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3)
super:~/mulo/amule-cvs gtoso$
Ok I think it's possible to link amule to system libz and libiconv, but it must use at least libpng and libgd from MacPorts that are linked to other MacPorts libraries.
Is it possible to link statically to libpng and libgd as for wxMac?
I found 2 possible ways, but first I would like advice, given the time needed to recompile (3h 55m aMule, 3h 33m wxMac: real time on my PB G3 400):
1) Copy the required MacPorts libraries to Frameworks dir as mac_packager try to do for wxMac (in my case it's useless: wxMac is statically linked)
2) Try the --enable-static configure option
Another thing:
/usr/X11R6/lib comes with X11 or X11SDK package?
If so it may not exist,
I have just recompiled gd2 without X (no_x11 port variant),
could --without-x configure parameter prevent cas to link X11 libraries?
Goodbye and thanks,
Gianluca.