Ivan Vučica wrote:
Has anyone recently installed GNUstep on OS X?
Apparently, the compile process on MacPorts is quite broken, at
least on Snow Leopard. Broken dependency on GCC 4.2 has been
removed, but now Apple's compiler is used, for which libobjc-gnu
does not exist on my system (that is, nothing has installed it).
And according to the log, that's what compile process is
attempting to do.
Installing a macports GCC, and attempting to force its use
(manually!):
sudo port install gnustep configure.compiler=macports-gcc-4.4
doesn't make things much better. "configure" now passes, and
compiler is "able to compile Objective-C", but log reveals that
Apple's GCC is used once more (despite "configure" having run with
macports-gcc-4.4 as active compiler).
Does anyone have any simple, easy to follow, instructions on how
to compile GNUstep on OS X? Is someone on this list tracking
MacPorts Portfile's usability?
I have GNUstep running on OS X (Tiger and Leopard, though not Snow
Leopard at present, using both Apple's gcc and gcc from MacPorts)
for quite some time. Before Tiger I was using macports, but since
the port got broken and was no longer maintained around that time,
I set up my system from scratch then. Initially, I used gnustep-
startup to get things working, but I haven't looked at it for a
long time. So chances are that you may be able to set up your
system with the help of gnustep-startup (probably with a few
iterations to get all dependencies in place) but then maybe not.
The following tries to summarize the steps to get GNUstep working
on OS X from scratch (as far as I remember them).
Note that I'm using the traditional GNUstep layout with everything
installed in /usr/GNUstep. I haven't used the fhs layout, which is
the default layout nowadays, and I'm not sure whether I would
recommend using it in on OS X.
The steps below may or may not work for you. If they do, maybe
someone could use them to update the MacPorts port?
1) First install all dependencies as required by the GNUstep port
in MacPorts
For some ports you must be careful with the configuration so that
they don't link (directly or indirectly) with Apple's
CoreFoundation framework, which brings in Apple's libobjc.
The ports you have to watch out for include (at least) aspell,
fontconfig, and cairo. You *must* install the +nonls variant of
aspell and you must install the +macosx variants of fontconfig and
cairo.
2) Decide whether you want to use Apple's C compiler or the
MacPorts compiler
For Apple's C compiler continue at step 3), for the MacPorts
compiler continue at step 7)
3) Configure and install gnustep-make
I'm using the latest source from svn at http://svn.gna.org/svn/
gnustep/tools/make/trunk
./configure CFLAGS=-fno-constant-cfstrings \
--with-library-combo=gnu-gnu-gnu \
--with-config-file=/usr/GNUstep/GNUstep.conf \
--enable-absolute-install-paths
sudo make install
Notes:
(1) --with-library-combo=gnu-gnu-gnu is mandatory, since apple-
apple-apple is the default on OS X
(2) --with-config-file=... is optional. I like to have the config
file in the same place as the rest of the installation, the default
is to install in /etc/GNUstep. If that's okay for you omit this flag.
(3) --enable-absolute-install-paths is present so that you can run
GNUstep applications and tools without sourcing /usr/GNUstep/System/
Library/Makefiles/GNUstep.sh or /usr/GNUstep/System/Library/
Makefiles/GNUstep.csh despite you a GNUstep file system layout. You
may loose the ability to move applications and libraries around,
though.
4) At this point, source /usr/GNUstep/Makefiles/GNUstep.sh or /usr/
GNUstep/Makefiles/GNUstep.csh:
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh (on
bash/ksh)
source /usr/GNUstep/System/Library/Makefiles/GNUstep.csh (on
tcsh)
5) Configure and install the GNU Objective-C runtime system (not
the GNUstep Objective C runtime system; up to now I haven't been
able to build it on OS X -- but then I didn't try very hard)
Again, I'm using the version from svn at http://svn.gna.org/svn/
gnustep/libs/libobjc/trunk
sudo make install
This should install the headers in /usr/GNUstep/System/Library/
Headers/objc and libobjc in /usr/GNUstep/System/Library/Libraries.
6) Repeat step 3)
Yes, invoke configure again here. This is important so that GNUstep-
make picks up that we now have the right Objective C library
available.
After that continue at step 9)
7) After you have installed the MacPorts compiler install gnustep-make
(cf. step 3) for the source)
./configure CC=gcc-mp-4.3
--with-library-combo=gnu-gnu-gnu \
--with-config-file=/usr/GNUstep/GNUstep.conf \
--enable-absolute-install-paths
sudo make install
Note:
(1) See step 3) for the options supplied to configure
(2) CC=gcc-mp-4.3 sets the compiler being used. As you can see
I'm (still) using Gnu C 4.3. Replace it by whatever you have
installed.
8) At this point, source /usr/GNUstep/Makefiles/GNUstep.sh or /usr/
GNUstep/Makefiles/GNUstep.csh:
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh (on
bash/ksh)
source /usr/GNUstep/System/Library/Makefiles/GNUstep.csh (on
tcsh)
9) Make sure you have libffi installed. On my system, I see that I
have installed libffi @gcc4.2.2_0. Don't know what is the current
version in MacPorts, but I think it should work.
Also make sure that you really have sourced GNUstep.sh/GNUstep.csh
(e.g., try echo $GNUSTEP_MAKEFILES, it should echo /usr/GNUstep/
System/Library/Makefiles).
10) Configure and install gnustep-base.
Not very surprisingly I'm using the version from svn at http://
svn.gna.org/svn/gnustep/libs/base/trunk
If you are using the Apple compiler
./configure CFLAGS=-fno-constant-cfstrings \
CPPFLAGS=-I/opt/local/include \
LDFLAGS=-L/opt/local/lib \
--disable-tls
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
If you are using the MacPorts compiler
./configure CC=gcc-mp-4.3 \
CPPFLAGS=-I/opt/local/include \
LDFLAGS=-L/opt/local/lib \
--disable-tls
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
Notes:
(1) The arguments CFLAGS=-fno-constant-cfstrings and CC=gcc-mp-4.3
(or whatever MacPorts compiler is used) may be redundant (but they
do not hurt either)
(2) CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib are
necessary to find the libraries installed by MacPorts
(3) I use --disable-tls because I was unable to get it working
when I set up my system and I do not need it at present. It may be
possible to omit this flag with a more recent version from MacPorts.
(4) The complex sudo command is there to get the environment right
for the root shell. Actually, if you have configured gnustep-make
with --enable-absolute-install-paths, it should be possible to
simply use sudo make install, but I've got used to the more complex
command and didn't try that. (Since I build gnustep quite
frequently, it is in my shell's history anyway.)
11) Configure and install gnustep-gui
source is of course http://svn.gna.org/svn/gnustep/libs/gui/trunk
If you are using the Apple compiler
./configure CFLAGS=-fno-constant-cfstrings \
CPPFLAGS=-I/opt/local/include \
LDFLAGS=-L/opt/local/lib \
--disable-cups --disable-sound
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
If you are using the MacPorts compiler
./configure CC=gcc-mp-4.3 \
CPPFLAGS=-I/opt/local/include \
LDFLAGS=-L/opt/local/lib \
--disable-cups --disable-sound
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
Notes:
(1) For the compiler flags see step 10)
(2) --disable-cups and --disable-sound are mandatory; at least I
was unable to install versions of these libraries from MacPorts
that do not link with Apple's CoreFoundation framework.
12) Configure and install gnustep-back
source from http://svn.gna.org/svn/gnustep/libs/back/trunk
All three backend variants (art, cairo, xlib) are working for me.
If you are using cairo, which is the default now, be sure to
install the +macosx variant of cairo, which doesn't link against
any Apple specific libraries. If you want to use the art backend,
install the libart_lgpl port. Beware that in this case you most
probably want to install additional fonts. I wouldn't recommend
using the xlib backend.
If you are using the Apple compiler
./configure CFLAGS=-fno-constant-cfstrings \
CPPFLAGS=-I/opt/local/include \
LDFLAGS=-L/opt/local/lib \
--disable-glx
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
If you are using the MacPorts compiler
./configure CC=gcc-mp-4.3 \
CPPFLAGS=-I/opt/local/include \
LDFLAGS=-L/opt/local/lib \
--disable-glx
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
Notes:
(1) For the compiler flags see step 10)
(2) --disable-glx seems to be necessary. At least when I last
tried to omit it, OpenGL was linking with Apple's libraries and
bringing in Apple's CoreFoundation and Objective C runtime.
(3) If you want a different backend, add --enable-graphics=art or
--enable-graphics=xlib to the configure options.
13) Congratulations for getting this far.
Now you have a GNUstep installation on your system, but it is not
clear whether this is a *working* installation. First try starting
the GNUstep daemons. (If you are running under tcsh you have to
execute rehash first).
gdnc
gpbs
If you don't get a crash report from OS X at this point, you were
already quite successful. If you get a crash report (most likely
from gpbs), have a look at the libraries linked with the executable
(listed in the Binary Images section of the crash report file). If
this includes libobjc.A.dylib (probably at the bottom), one of your
dependencies was linked with Apple's libraries and the tough case
is finding out which one. My experience is that this is a very
tedious process, using otool -L to list the dependent libraries of
each dynamic library that is linked with gnustep-gui and gnustep-
base. Once, you've found that dependency, you need to find out a
way to rebuild that dependency without linking to Apple's libraries.
14) If you've got this far try installing a first GNUstep application.
I recommend using Ink for that purpose, as it is simple to install
and a useful application by itself. It is not as complete as
Apple's TextEdit, of course, but at least sufficiently capable to
write simple texts like this one (I have to confess that I should
have written this text with Ink but did type it right away into Mail).
Source is in http://svn.gna.org/svn/gnustep/tests/examples/trunk/
gui/Ink
Installation (as root) can be achieved with
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
If you prefer installing Ink in your private application directory
instead use
make GNUSTEP_INSTALLATION_DIRECTORY=USER install
Now run Ink by typing
Ink
(eventually after executing rehash first, if you are using tcsh).
If you didn't get a crash report during the last step, Ink's menu
and an empty document window should appear.
15) Congratulations if you got here. You have successfully managed
to install GNUstep on OS X.
From here on you should be able to install additional GNUstep
applications in the same way as Ink.
Beware of some special cases though. The initial installation of
some programs doesn't work out of the box, because the linker
requires dependent frameworks to be installed in the (GNUstep)
system directories. AFAIR, the problematic cases include
SystemPreferences and ProjectCenter. To get SystemPreferences
compiled and installed, first run
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
from the PreferencePanes directory, then again from the main
directory. Similarly, to get ProjectCenter compiled and installed,
first run
sudo sh -c ". $GNUSTEP_MAKEFILES/GNUstep.sh; make install"
from the Framework directory and then from the main directory.
Similar issues may exist for other applications, but I don't
remember those.
Hope this helps
Wolfgang
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnustep