After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 72859 - Build requires changes for Mac OS X (With workaround)
Build requires changes for Mac OS X (With workaround)
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
1.3.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 80435
 
 
Reported: 2002-02-27 16:46 UTC by Ryan Wilhm
Modified: 2011-02-18 15:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fixes build on mac os x (377 bytes, patch)
2002-04-22 01:39 UTC, jacob berkman
none Details | Review

Description Ryan Wilhm 2002-02-27 16:46:45 UTC
There are some issues when building on Mac OS X. The build requires some 
massaging in order to work, but does manage to compile and pass all of the 
regression tests provided by the 'make check' target. Here's everything 
that I needed to do to get Glib-1.3.15 to build. (I have been using the 
same process since 1.3.12...)

Build Prereqs:
I installed the Fink distribution of GNU tools. This fixes some library 
and tool dependencies that would otherwise require building a lot of 
stuff. (libtool, gettext, libiconv, etc... I don't remember all of the 
dependencies that this fixes.)

Manual build process:

NOTE: When I refer to anything in the "/sw" path, I'm pointing to my Fink 
distribution. Also, anytime I refer to "${glib_src}", I'm just referring 
to the path where I extracted the glib source files. (Ie, where I'm 
building.)

1. Set environment variables
I set CC to point to the compiler Apple provides, as well as aliasing 
libtool to the gnu compilation provided by Fink. Also, I set up CPPFLAGS 
and LDFLAGS to point to the proper includes. IMPORTANT: In CPPFLAGS, I 
also add "-no-cpp-precomp", which I've been told is required. It'd be cool 
to have the configure process automatically add this when targeting the 
Mac OS X platform so the user doesn't have to deal with this in the shell 
environment. Here's what I set:

    setenv CC /usr/bin/cc
    setenv CPPFLAGS "-no-cpp-precomp -I/sw/include"
    setenv LDFLAGS "-L/sw/lib"
    alias libtool /sw/bin/glibtool
    alias libtoolize /sw/bin/glibtoolize


2. Fix config.guess, configure.in
This currently can't guess the Mac OS X platform. I just copied the 
config.guess from the mono project, which can pick this up. For a true 
bugfix, I'd just fix the one currently in the project for OS X to avoid 
any dependency ills. ALSO, I'd fix configure.in to deal with OS X 
properly. I'm assuming that most of the problems that I manually fix in my 
process can be automatically done during the configuration and makefile 
generation process.


3. Fix "${glibc_src}/glibc/gdir.c"
This refers to a struct that isn't known by default with the includes 
supplied. All I did was add the following to the top of the source file:

#ifdef __APPLE__
#include <stdint.h>
#endif

The macro __APPLE__ is defined globally in Mac OS X, so anytime I do OS X 
specific fixes I just look for this. (Maybe there's a more appropriate 
way? It works for me...)


4. Run "./configure"
Of course, you can add any additional flags here, like "--prefix". This 
should work now that we've performed the steps above. Now, we fix the 
files autogenerated by this process...


5. Fix the autogenerated "libtool" script
In "${glib_src}", a file called "libtool" should have been generated. Open 
this up. This requires two fixes that will cause problems during linking. 
(These deal with undefined and multiply linked symbols respectively. There 
may be a better way to deal with these, but this seems to work so far.)

 - Look for the string "-undefined suppress". Wipe this so the variable is 
an empty string.
 - Search for the string "-all_load". Wipe this text from the string.


6. Fix the autogenerated "${glib_src}/tests/Makefile" make file
Two things need to be uncommented:

 - "#libadd_libgmodule=#$(libgmodule)" should become:
   "libadd_libgmodule=$(libgmodule)"
 - "#libadd_libglib=#$(libglib)" should become:
   "libadd_libglib=$(libglib)"


7. Now do "make"
This should run for a while, then crash because it can't find the proper 
location of the glib libraries after they are built. Type:
    'setenv DYLD_LIBRARY_PATH ${glib_src}/glib/.libs'


8. Type "make" again
This will run until the build process is finished.


9. Run the regression tests
This is a two step process:

 - First, we need to set the library path to look at the gmodule and 
gthread libs. Type:
    'setenv DYLD_LIBRARY_PATH ${glib_src}/glib/.libs:\
        ${glib_src}/gmodule/.libs:\
        ${glib_src}/gthread/.libs'
 - Type 'make check'. This should compile and execute the regression 
tests. You should see something like "All 29 tests passed" at the end of 
it all.

10. Type "make install"

That's it.

Like I mention, I think that all of this can be accomidated during the 
configuration process so the user doesn't have to interact as much during 
the build.

Thanks,
Ryan
Comment 1 Owen Taylor 2002-02-27 17:16:58 UTC
Thanks much for the detailed report.

Enough of this is libtool problems that I'm not going to 
try and look at the remainder for 2.0.0. The config.guess
issue should have been fixed by:

Tue Feb 26 21:44:01 2002  Owen Taylor  <otaylor@redhat.com>

	* config.status config.guess: Remove these files
	from CVS so we more-or-less current versions from
	automake --add-missing. (Reported by Finlay Dobbie,
	#60342)
Comment 2 jacob berkman 2002-04-22 01:37:08 UTC
'man opendir' on linux suggests including sys/types.h, and this patch
fixes the gdir.c on os x for me.
Comment 3 jacob berkman 2002-04-22 01:39:15 UTC
Created attachment 7845 [details] [review]
fixes build on mac os x
Comment 4 jacob berkman 2002-05-20 22:52:55 UTC
gdir.c fixed in both branches.  pretty sure it builds with no patches
for me on os x, closing.

2002-05-20  jacob berkman  <jacob@ximian.com>

	* glib/gdir.c: include sys/types.h before dirent to fix build on
	darwin (fixes #72859)