Skip to content

Undefined reference with gnustep-2.2 but not with gnustep-1.9 or gcc #357

@mcarans

Description

@mcarans

I have tried building Oolite using the supported Clang gnustep-2.2. I get just one linker error. This error does not occur when building Oolite with Clang gnustep 1.9 or gcc.

I have made a cut down example that demonstrates the issue: https://github.com/mcarans/objc_abi2.2_issue. That example builds with Clang gnustep-1.9, so the undefined reference only happens with gnustep-2.2.

The error I get (which occurs on both MinGW64 and Kubuntu) is:

/usr/bin/ld: ./obj/HelloWorld.obj/OOCache.m.o: in function `_i_OOCache_DebugGraphViz_generateGraphVizBodyWithRootNamed_':
/home/mcarans/Code/OoliteRelated/objc_abi2.2_issue/OOCache.m:1098:(.text+0xcdf): undefined reference to `__objc_ivar_offset_OOCache.cache.^{OOCacheImpl=^{OOCacheNode}^{OOCacheNode}^{OOCacheNode}I}'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It may have something to do with these C structs that are used from Objective-C:

struct OOCacheImpl
{
	// Splay tree root
	OOCacheNode				*root;
	
	// Ends of age list
	OOCacheNode				*oldest, *youngest;
	
	unsigned				count;
	NSString				*name;
};


struct OOCacheNode
{
	// Payload
	id<OOCacheComparable>	key;
	id						value;
	
	// Splay tree
	OOCacheNode				*leftChild, *rightChild;
	
	// Age list
	OOCacheNode				*younger, *older;
};

My guess is that this is a change in the way C structs are handled in different ABIs within libobjc2, so I closed the issue I had made in libs-base and opened here instead, but if it isn't related to libobjc2, then please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions