It's easier to help if we can see the link line you're using, but in short you 
need to make sure that lobjc is in the link libs, sometimes by explicitly 
adding it:

LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"

K

> On Jun 10, 2024, at 8:08 AM, Gagan Sidhu via macports-dev 
> <macports-dev@lists.macports.org> wrote:
> 
> hi team,
> 
> first of all, i just built the clang-18 properly and wow am i amazed. here i 
> was asking about wasm and stuff, i should have been a little more thorough, 
> my bad.
>       -really this thing is a work of art. great yob
> 
> now to my question, which i also posted to 
> stackexchange(https://stackoverflow.com/questions/78602533/using-nsobject-with-modern-os-x-sdk-14-4-and-10-7-macosx-deployment-target)
> 
> briefly: the NSObject class moved from the runtime to Foundation from Lion to 
> Mountain Lion.
> 
> so there is a little bit of a “hole” in trying to compile for a 10.7 target 
> using an SDK that is >=10.8:
> 
>> ld64.lld: error: undefined symbol: OBJC_CLASS_$_NSObject
>>>>> referenced by 
>>>>> /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/launchchild_osx.mm
>>>>>              launchchild_osx.o:(symbol 
>>>>> OBJC_CLASS_$_ElevatedUpdateServer+0x8)
>>>>> referenced by 
>>>>> /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/progressui_osx.mm
>>>>>              progressui_osx.o:(symbol OBJC_CLASS_$_UpdaterUI+0x8)
>> 
>> ld64.lld: error: undefined symbol: OBJC_METACLASS_$_NSObject
>>>>> referenced by 
>>>>> /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/launchchild_osx.mm
>>>>>              launchchild_osx.o:(symbol 
>>>>> OBJC_METACLASS_$_ElevatedUpdateServer+0x8)
>>>>> referenced by 
>>>>> /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/launchchild_osx.mm
>>>>>              launchchild_osx.o:(symbol 
>>>>> OBJC_METACLASS_$_ElevatedUpdateServer+0x0)
>>>>> referenced by 
>>>>> /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/progressui_osx.mm
>>>>>              progressui_osx.o:(symbol OBJC_METACLASS_$_UpdaterUI+0x8)
>>>>> referenced 1 more times
>> clang++: error: linker command failed with exit code 1 (use -v to see 
>> invocation)
> 
> 
> usually it will say something like this because, as is obvious to this 
> educated and sharp crowd, the >=10.8 objc runtime will not have NSObject like 
> 10.7, and thus there is no framework we can link for a 10.7 target to get 
> NSObject.
> 
> have any of you vets dealt this issew? is there a simple way? i haven’t 
> thought too hard about trying to use an OSObject but i’m open to alternatives.
> 
> maybe duplicating the class and renaming any usage with a macro? i was hoping 
> for sokmething cleaner tho.
> 
> Thanks,
> Gagan
> 

Reply via email to