glib-2.0.1 on Mac OS 10.1



Hi,

  I have just compiled glib-2.0.1 on Mac OS 10.1.4 (build 5Q125), and I
thought you might be interested in the following comments.

First, by default on Mac OS 10.1, the linker flag -twolevel_namespace is
assumed. Libtool (at least the version you are using, and until 2 months
ago; I haven't tested the latest libtool release) uses the flag 
"-undefined suppress", which is only allowed in flat namespace binaries.
The solution is to either specify "-undefined error" in LDFLAGS and make 
sure it is also passed correctly when calling the linker from libtool,
and ensuring that there are no undefined symbols when linking; or
specifying "-flat_namespace -undefined suppress" in libtool's 
allow_undefined_flag.

Secondly, it is recommended to use the "-no-cpp-precomp" compiler
switch, which turns off Apple's preprocessor and uses the gcc default
one instead. The Apple precompiler chokes on everything non-Apple, it
seems (indicated by a lot of "cpp-precomp: warning: errors during smart
preprocessing, retrying in basic mode" messages), so better not use it 
in the first place.

And lastly, which was the only "real" problem, there is a problem with
libtool. I do not know what exactly happens, but some convenience
libraries end up _twice_ on the commandline, resulting in linker errors.
The dirty hack I used was to patch libtool so that the duplicate
entries are removed (see attachment) -- the real solution would be to 
investigate what happens. :) Since I just needed glib up and running, 
I will leave this as an exercise to the interested reader.

I think that the Fink people (fink.sf.net) have glib-1.2 in their
distribution, which means that they probably found a clean solution to
the libtool problem mentioned above. I do not know if you are in contact
with them, or if you are interested in supporting Mac OS X at all. If
you want, I can take a look at how they solved it and report back to you
-- but I do not want to spend that time and then find out that you don't
consider Darwin / OS X to be of any interest anyway.

Well, I just thought you might be interested in getting some feedback.
Thanks for the great work you keep doing!

Best regards,
#!/kyrah

-- 
Karin Kosina (vka kyrah)
http://kyrah.net

--- libtool	Tue Apr 30 23:24:28 2002
+++ libtool.mod	Tue Apr 30 23:27:59 2002
@@ -3090,6 +3090,13 @@
 	if test -n "$convenience"; then
 	  if test -n "$whole_archive_flag_spec"; then
 	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+#   hack to remove redundant convenience libraries on darwin platform
+#   (<kyrah gnu org>, original problem solution by <larsa gnu org>)
+            case $host in
+            *-*-darwin*)
+              deplibs=`echo " $deplibs" | sed -e 's/[0-9A-Za-z_.][0-9A-Za-z_\/. -]*\.al//g'`
+              ;;
+            esac
 	  else
 	    gentop="$output_objdir/${outputname}x"
 	    $show "${rm}r $gentop"

Attachment: pgp57g5cJofaY.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]