Can't compile gnustep port

Here is the error:

Code:
host# pwd
/usr/ports/devel/gnustep
host# make 
===>   gnustep-1.19.3 depends on file: /usr/local/lib/gcc42/libobjc.so - found
===>   gnustep-1.19.3 depends on file: /usr/local/GNUstep/System/
Library/Libraries/libgnustep-base.so - not found
===>    Verifying install for /usr/local/GNUstep/System/Library/Libraries/
libgnustep-base.so in /usr/ports/lang/gnustep-base
===>  gnustep-base-1.19.3_5 needs an objective C compiler.
*** Error code 1

Stop in /usr/ports/lang/gnustep-base.
*** Error code 1

Stop in /usr/ports/devel/gnustep.

I have clang installed:

Code:
host# clang -v
FreeBSD clang version 3.0 (branches/release_30 142614) 20111021
Target: x86_64-unknown-freebsd9.0
Thread model: posix

Any hint what should I do?
 
Yes, but still since gnustep is in ports and as any port it should be able to compile. Maybe using clang?

(Well first I tried to compile Objective C code, with some support for Foundation and APPkit on FreeBSD but I've noticed Cocotron is not in FreeBSD's ports, so I thought to try gnustep instead.)
 
Clang does have ObjC compiler and for a runtime one can use lang/libobjc2. The trick is to make GNUstep cooperate, e.g.
Code:
Index: Mk/bsd.gnustep.mk
===================================================================
RCS file: /a/.csup/ports/Mk/bsd.gnustep.mk,v
retrieving revision 1.67
diff -u -p -r1.67 bsd.gnustep.mk
--- Mk/bsd.gnustep.mk	6 Nov 2011 07:40:58 -0000	1.67
+++ Mk/bsd.gnustep.mk	1 Dec 2011 00:02:42 -0000
@@ -189,6 +189,9 @@ PLIST_SUB+=	MAJORVERSION=${PORTVERSION:C
 PLIST_SUB+=	LIBVERSION=${DEFAULT_LIBVERSION}
 PLIST_SUB+=	MAJORLIBVERSION=${DEFAULT_LIBVERSION:C/([0-9]).*/\1/1}
 
+.if ${CC:T:Mclang}
+LIB_DEPENDS+=	objc:${PORTSDIR}/lang/libobjc2
+.else
 .if !defined(GNUSTEP_WITH_GCC34) && !defined(GNUSTEP_WITH_GCC42) && !defined(GNUSTEP_WITH_BASE_GCC)
 .if !exists(${DESTDIR}/usr/lib/libobjc.so)
 GNUSTEP_WITH_GCC42=yes
@@ -213,6 +216,7 @@ RUN_DEPENDS+=	${TARGLIB}/libobjc.so:${PO
 .else
 GNUSTEP_WITH_BASE_GCC=	yes
 .endif
+.endif # clang
 
 # ---------------------------------------------------------------------------
 # using base
Index: lang/libobjc2/Makefile
===================================================================
RCS file: /a/.csup/ports/lang/libobjc2/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- lang/libobjc2/Makefile	29 Oct 2011 20:41:06 -0000	1.7
+++ lang/libobjc2/Makefile	1 Dec 2011 00:27:17 -0000
@@ -13,11 +13,8 @@ MASTER_SITES=	http://download.gna.org/gn
 MAINTAINER=	dinoex@FreeBSD.org
 COMMENT=	Replacement Objective-C runtime supporting Obj-C 2 features
 
-BUILD_DEPENDS=	${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
-
 USE_BZIP2=	yes
 USE_LDCONFIG=	yes
-MAKE_ENV+=	LD=${LOCALBASE}/bin/ld
 MAKE_ENV+=	SHLIB_VERSION="${SHLIB_VERSION}"
 PLIST_SUB=	SHLIB=${SHLIB_VERSION}
 
@@ -42,6 +39,13 @@ CPPFLAGS+=	-DGNUSTEP
 
 .include <bsd.port.pre.mk>
 
+.if ${CC:T:Mclang}
+MAKE_ARGS+=	LD='${CC}'
+LDFLAGS+=	-L. ${PTHREAD_LIBS}
+.else
+BUILD_DEPENDS+=	${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
+MAKE_ENV+=	LD=${LOCALBASE}/bin/ld
+
 .if ${OSVERSION} >= 900000
 V:=	42
 _GCC_BUILD_DEPENDS:=	gcc${V}
@@ -54,6 +58,7 @@ LDFLAGS+=	-L${LOCALBASE}/lib/${_GCC_BUIL
 BUILD_DEPENDS+=	${_GCC_PORT_DEPENDS}:${PORTSDIR}/lang/${_GCC_BUILD_DEPENDS}
 RUN_DEPENDS+=	${_GCC_PORT_DEPENDS}:${PORTSDIR}/lang/${_GCC_BUILD_DEPENDS}
 .endif
+.endif # !clang
 
 .if (${ARCH} == i386) || (${ARCH} == i486)
 CFLAGS+=	-march=i586
Index: lang/libobjc2/files/patch-Makefile
===================================================================
RCS file: /a/.csup/ports/lang/libobjc2/files/patch-Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 patch-Makefile
--- lang/libobjc2/files/patch-Makefile	29 Oct 2011 20:40:15 -0000	1.5
+++ lang/libobjc2/files/patch-Makefile	1 Dec 2011 00:22:31 -0000
@@ -35,7 +35,7 @@
  libobjc.a: $(OBJECTS)
  	@echo Linking static Objective-C runtime library...
 -	@ld -r -s -o $@ $(OBJECTS)
-+	$(LD) $(LDFLAGS) -r -s -o $@ $(OBJECTS)
++	$(AR) $(ARFLAGS) $@ $(OBJECTS)
  
  .cc.o:
  	@echo Compiling `basename $<`...
 
dinoex@ Your solution worked. Thanks!

I've installed it on:

Code:
uname -a
FreeBSD desktop 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Wed Jan  4 15:21:54 EET 2012     
me@desktop:/usr/obj/usr/src/sys/GENERIC  amd64
 
still no luck

Please enlighten me. I have tried making with the specified options in make.conf, but still no luck. gnustep-base fails compiler validation tests several times on the configure build step, the first one being:

Code:
configure:2377: cc -c -O2 -pipe -I/usr/local/include/libxml2/libxml -DHAVE_DLADDR=1 -I/usr/local/include 
-DOBJC2RUNTIME=1 -fno-strict-aliasing -I/usr/local/GNUstep/System/Library/Headers -I/usr/local/GNUstep/
Local/Library/Headers conftest.c >&5
conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me'
configure:2383: $? = 1
configure: failed program was:
| #ifndef __cplusplus
|   choke me
| #endif

So the very basic tests agains clang seem to fail. Clang has been installed from ports along with llvm3.0.
 
Typed wrong thing here, still same result. I installed clang, llvm, gmake, binutils, gnustep-make all from ports. Made the /etc/make.conf file and still the same thing. Am I missing something?
 
Sorry to necro this post, but I'm having the same problem. dinoex@'s solution didn't seem to work. Did anyone manage to get it working?
 
You could also use gcc from ports. GNUstep works both with Clang and GCC, but you need obj-c support with gcc. On FreeBSD 9, the system clang is a bit old and I had problems with it, so I isntalled another compiler from ports anyway and both gcc 4.6 and clang do work.
 
Back
Top