Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

libobjcxx

21 views
Skip to first unread message

Kal Conley

unread,
Oct 4, 2012, 5:49:33 PM10/4/12
to discuss...@gnu.org
Hi Folks,
I am having linking issues trying to compile an objective-c++ source
file that uses exceptions. In particular, I get the following link error:

(.data.__objc_eh_typeinfo_NSException[__objc_eh_typeinfo_NSException]+0x0):
undefined reference to `vtable for gnustep::libobjc::__objc_class_type_info'

I think I need to link to libobjcxx in addition to libobjc but I am not
sure how I can get GNUstep build system to build it automatically. I am
on debian and I am using the following commands to build GNUstep from
source:

#----------------------------
PREFIX=/opt/local/GNUstep
mkdir -p "${PREFIX}"

export CC=clang
export CXX=clang++

cd gnustep

cd core/make
./configure --enable-debug-by-default --with-layout=gnustep
--prefix="${PREFIX}"
make && sudo -E make install
. "${PREFIX}/System/Library/Makefiles/GNUstep.sh"

cd ../../dev-libs/libobjc2
make debug=no && sudo -E make strip=yes install

cd ../../core/make
./configure --enable-debug-by-default --with-layout=gnustep
--prefix="${PREFIX}"
make && sudo -E make install

. "${PREFIX}/System/Library/Makefiles/GNUstep.sh"

cd ../base
./configure --with-ffi-include=/usr/include/`gcc -dumpmachine`
--prefix="${PREFIX}"
make -j 3 && sudo -E make install
#----------------------------

This automatically builds libobjc.so in addition to libgnustep-base.so
in /opt/local/GNUstep/Local/Library/Libraries/.

I would like to have libobjcxx.so build and installed there too. What is
the easiest way I can achieve this? Or am I way off base?

Thanks!
Kal

David Chisnall

unread,
Oct 4, 2012, 5:58:33 PM10/4/12
to Kal Conley, discuss...@gnu.org
On 4 Oct 2012, at 22:49, Kal Conley wrote:

> I think I need to link to libobjcxx in addition to libobjc but I am not
> sure how I can get GNUstep build system to build it automatically

You can't. Please use the Makefile instead. If you are on a GNU platform, you will have to do make -f Makefile. On any other platform, just make will work.

David

-- Sent from my Difference Engine


Kal Conley

unread,
Oct 5, 2012, 2:33:50 AM10/5/12
to discuss...@gnu.org
Am 10/4/12 11:58 PM, schrieb David Chisnall:
Manually using dev-libs/libobjc2/Makefile seems less than ideal. I would
like to have libobjcxx put in GNUstep/Local/Library/Libraries/ like
libobjc is. If I install with the 'Makefile' it wants to use
${PREFIX}/lib and ${PREFIX}/include so then I will have two copies of
the headers laying around. I could modify it, but if I am going to do
that, why not just modify the main GNUstep build system to include it in
the build?

Is there any reason why it is not built automatically? Can we make an
option to build it/not build it with the rest of GNUstep? I would
contribute patches, but I am not that familiar with the build system. I
was having trouble following the make target dependencies for libobjc.

Kal

David Chisnall

unread,
Oct 5, 2012, 3:20:45 AM10/5/12
to Kal Conley, discuss...@gnu.org
On 5 Oct 2012, at 07:33, Kal Conley wrote:

> Manually using dev-libs/libobjc2/Makefile seems less than ideal. I would
> like to have libobjcxx put in GNUstep/Local/Library/Libraries/ like
> libobjc is. If I install with the 'Makefile' it wants to use
> ${PREFIX}/lib and ${PREFIX}/include so then I will have two copies of
> the headers laying around. I could modify it, but if I am going to do
> that, why not just modify the main GNUstep build system to include it in
> the build?

The GNUmakefile is unsupported and is provided by Richard as a convenience for GNUstep developers.

If you want to install libobjc into your GNUstep paths then you can set the correct variables. I haven't looked at the GNUmakefile for a long time, but I was under the impression that this is what it did - pick up your library and header paths and then pass these to a sub invocation of Make.

> Is there any reason why it is not built automatically? Can we make an
> option to build it/not build it with the rest of GNUstep? I would
> contribute patches, but I am not that familiar with the build system. I
> was having trouble following the make target dependencies for libobjc.

GNUstep Make is very good when you want to do things that it anticipated, but very hard to modify. The linkage requirements of libobjcxx are very difficult to express because they conflict with its assumptions. The Makefile is a simple, portable build system that should work on any

David

-- Sent from my IBM 1620


Kal Conley

unread,
Oct 5, 2012, 5:56:20 AM10/5/12
to discuss...@gnu.org
Am 10/5/12 9:20 AM, schrieb David Chisnall:
> On 5 Oct 2012, at 07:33, Kal Conley wrote:
>
>> Manually using dev-libs/libobjc2/Makefile seems less than ideal. I would
>> like to have libobjcxx put in GNUstep/Local/Library/Libraries/ like
>> libobjc is. If I install with the 'Makefile' it wants to use
>> ${PREFIX}/lib and ${PREFIX}/include so then I will have two copies of
>> the headers laying around. I could modify it, but if I am going to do
>> that, why not just modify the main GNUstep build system to include it in
>> the build?
> The GNUmakefile is unsupported and is provided by Richard as a convenience for GNUstep developers.

OK.

>
>
> If you want to install libobjc into your GNUstep paths then you can set the correct variables. I haven't looked at the GNUmakefile for a long time, but I was under the impression that this is what it did - pick up your library and header paths and then pass these to a sub invocation of Make.

I have no strong preference either way. But I would like them to be
installed once. In light of the fact that the 'GNUmakefile' isn't really
supported, I am more than willing to just use David's supported
'Makefile' for everything.

Currently I am running core/make/configure twice. To make sure I
understand this correctly... The first time is just to get

${PREFIX}/System/Library/Makefiles/GNUstep.sh

generated so that I can use GNUmakefile to build libobjc2. Once that is
built running it again detects the in-tree libobjc2 libraries and uses them?

If I move to using 'Makefile' instead of GNUmakefile to build it then do
I only need to run core/make/configure once after I build libobjc2 and
pass the path of the library to configure?

David Chisnall

unread,
Oct 5, 2012, 6:12:23 AM10/5/12
to Kal Conley, discuss...@gnu.org
On 5 Oct 2012, at 10:56, Kal Conley wrote:

> If I move to using 'Makefile' instead of GNUmakefile to build it then do
> I only need to run core/make/configure once after I build libobjc2 and
> pass the path of the library to configure?

Yes. Part of the reason for the Makefile is to solve the circular dependency problem. GNUstep Make depends on a working libobjc, so using it to install libobjc doesn't work.

On a modern platform for Objective-C development, you may not even have GCC installed, so the bootstrapping process on, for example, FreeBSD, was to install GCC and its libobjc, then install GNUstep Make, then uninstall GCC and its libobjc, then install GNUstep libobjc, then reconfigure and reinstall GNUstep Make, then proceed with the rest of the GNUstep install. Now, you just install libobjc first, then install the rest.

David

-- Sent from my Cray X1


Richard Frith-Macdonald

unread,
Oct 5, 2012, 6:53:21 AM10/5/12
to David Chisnall, discuss...@gnu.org
Of course, this is no reason to support the Makefile rather than the GNUmakefile ... since the GNUmakefile does exactly the same thing (it does not depend upon gnustep-make).

Technically, the GNUmakefile can, and does, work in both environments (with or without gnustep-make), and could in principle use pretty much the same build rules (gnustep-make is a superset of make and can use all the same build rules) simply differentiating between two different install rules for gnustep and non-gnustep installs.



Kal Conley

unread,
Oct 5, 2012, 11:50:03 AM10/5/12
to discuss...@gnu.org
Am 10/5/12 12:12 PM, schrieb David Chisnall:
> On 5 Oct 2012, at 10:56, Kal Conley wrote:
>
>> If I move to using 'Makefile' instead of GNUmakefile to build it then do
>> I only need to run core/make/configure once after I build libobjc2 and
>> pass the path of the library to configure?
> Yes. Part of the reason for the Makefile is to solve the circular dependency problem. GNUstep Make depends on a working libobjc, so using it to install libobjc doesn't work.
>
> On a modern platform for Objective-C development, you may not even have GCC installed, so the bootstrapping process on, for example, FreeBSD, was to install GCC and its libobjc, then install GNUstep Make, then uninstall GCC and its libobjc, then install GNUstep libobjc, then reconfigure and reinstall GNUstep Make, then proceed with the rest of the GNUstep install. Now, you just install libobjc first, then install the rest.
>
> David
>
> -- Sent from my Cray X1
>

OK. Thanks David.

I changed my install script to build libobjc manually and have GNUstep
find it. When I try to configure core/base I get:

configure:13162: checking whether objc really works
configure:13192: clang -o conftest -g -O2 -I/opt/local/include
-I/opt/local/GNUstep/System/Library/Headers
-I/opt/local/GNUstep/Local/Library/Headers
-I/opt/local/GNUstep/Local/Library/Headers -fgnu-runtime -x
objective-c -L/opt/local/GNUstep/System/Library/Libraries
-L/opt/local/GNUstep/Local/Library/Libraries
-L/opt/local/GNUstep/Local/Library/Libraries conftest.c -lrt -ldl
-lpthread -rdynamic -pthread -shared-libgcc -fexceptions -fgnu-runtime
-L/root/GNUstep/Library/Libraries
-L/opt/local/GNUstep/Local/Library/Libraries
-L/opt/local/GNUstep/System/Library/Libraries -lobjc -lm >&5
clang: warning: argument unused during compilation: '-shared-libgcc'
/usr/local/lib/libobjc.so: undefined reference to `dispatch_async_f'
/usr/local/lib/libobjc.so: undefined reference to `dispatch_queue_create'
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

It appears it is not trying to link to libdispatch. If I export
LDFLAGS="-ldispatch" before configure then the build works.

The old way I was doing things (letting GNUstep build libobjc) this
wasn't an issue. Why would this be the case?

Kal


David Chisnall

unread,
Oct 5, 2012, 4:01:49 PM10/5/12
to Kal Conley, discuss...@gnu.org
On 5 Oct 2012, at 16:50, Kal Conley wrote:

> It appears it is not trying to link to libdispatch. If I export
> LDFLAGS="-ldispatch" before configure then the build works.
>
> The old way I was doing things (letting GNUstep build libobjc) this
> wasn't an issue. Why would this be the case?

Not sure. libobjc2 will attempt to use libdispatch if it's installed, but doesn't explicitly link to it. It shouldn't actually be using it, because it's now only actually using it in garbage-collected mode, which is (to say the least) a minority use case.

David

-- Sent from my IBM 1620


0 new messages