discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Link error building a .m tool with clang on Linux


From: Wolfgang Lux
Subject: Re: Link error building a .m tool with clang on Linux
Date: Fri, 5 Jan 2018 09:55:16 +0100

Hi David,

> I recently picked up the latest libobjc2 and gnustep-base libraries, while 
> working on a clang build of some ObjC and ObjC++ programs on Ubuntu Linux.  
> The latest codebases solved a number of other problems I was having, but a 
> symbol is now missing in a shared library that some sub-programs use, causing 
> those programs not to link.  Here is a representative example:
> 
> /home/dlobron/build/clangport/akamai/llvm/llvm-5.0.0.install/bin/clang  
> -rdynamic     -m64  -rdynamic  -pthread  -fexceptions 
> -fobjc-runtime=gnustep-1.8 -fblocks -o obj/list2tree \
>               ./obj/list2tree.obj/list2tree.m.o \
>                 
> -L/home/dlobron/build/clangport/akamai/AkamaiKit/Tools/../../common/lib 
> -L../AkamaiKit.framework/Versions/Current/.    
> -L/home/dlobron/GNUstep/Library/Libraries 
> -L/home/dlobron/build/clangport/akamai/common/GNUstep/Local/Library/Libraries 
> -L/home/dlobron/build/clangport/akamai/common/GNUstep/System/Library/Libraries
>    -lAkamaiKit -lXMLKit -lopenssl   -lgnustep-base   -lpthread -lobjc 
> -fobjc-nonfragile-abi   -lm
> ../AkamaiKit.framework/Versions/Current/./libAkamaiKit.so: undefined 
> reference to `vtable for gnustep::libobjc::__objc_class_type_info'
> clang-6.0: error: linker command failed with exit code 1 (use -v to see 
> invocation)
> 
> Here, libAkamaiKit.so is a shared library.  Upon examination, the symbol in 
> question is indeed present and not defined:
> 
> U vtable for gnustep::libobjc::__objc_class_type_info

note that the missing reference is for a vtable, a virtual method table for a 
C++ class. It looks like the code in libAkamaiKit.so is compiled with 
(Objective-)C++ and you should use clang++ for linking rather than clang to 
have linker provide this vtable object.
Or maybe gnustep::libobjc::objc_class wasn't intended to be compiled as a C++ 
class?

Wolfgang


reply via email to

[Prev in Thread] Current Thread [Next in Thread]