paging the macports devs about NSObject between Lion and Mountain Lion

Gagan Sidhu broly at mac.com
Tue Jun 11 14:35:16 UTC 2024


hi lads/ladettes,

as an update, i was independently provided a solution by by jonathan alland aka mr wowfunhappy and a man mononymously known as ‘krackers, and mr phil dennis jordan (whom i call God because of his macintosh knowledge).

both suggested the linker was the problem, and indeed it was. changing -fuse-ld=lld to -fuse-ld=ld64 fixed the issue.

thank you everyone!

Thanks,
Gagan

> On Jun 10, 2024, at 10:21 AM, Ken Cunningham <ken.cunningham.webuse at gmail.com> wrote:
> 
> Well -- I can take your word for it, and be of no help ...  or you can show us the exact link line, with -Wl,-lobjc added to it, and the failure.
> 
> 
> 
> Ken
> 
> 
>> On Jun 10, 2024, at 9:19 AM, Gagan Sidhu <broly at mac.com> wrote:
>> 
>> the output is no different with the -lobjc, which is why i said with or without lobjc
>> 
>> it’s the exact same as below.
>> 
>> Thanks,
>> Gagan
>> 
>>> On Jun 10, 2024, at 10:17 AM, Ken Cunningham <ken.cunningham.webuse at gmail.com <mailto:ken.cunningham.webuse at gmail.com>> wrote:
>>> 
>>> Yes but I still don't see -lobjc on your link line...
>>> 
>>> K
>>> 
>>> 
>>> 
>>>> On Jun 10, 2024, at 9:15 AM, Gagan Sidhu via macports-dev <macports-dev at lists.macports.org <mailto:macports-dev at lists.macports.org>> wrote:
>>>> 
>>>> oh does the list parse out indented comments? if so my apologies!
>>>> 
>>>> the original error is this:
>>>> 
>>>> GagansMacPro:updater Gagan$ /opt/local/bin/ccache /opt/local/bin/clang++ -isysroot /Users/Gagan/.mozbuild/MacOSX14.4.sdk -objc -mmacosx-version-min=10.7 -stdlib=libc++ -o ../../../../dist/bin/org.mozilla.updater -fstack-protector-strong -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fPIC -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -gdwarf-4 -fno-omit-frame-pointer -funwind-tables -Wl,@/Users/Gagan/Downloads/mozilla-unified/obj-x86_64-apple-darwin18.7.0/toolkit/mozapps/update/updater/org_mozilla_updater.list    -fuse-ld=lld -fstack-protector-strong -Wl,-rpath, at executable_path/../Frameworks/UpdateSettings.framework -sectcreate __TEXT __info_plist /Users/Gagan/Downloads/mozilla-unified/obj-x86_64-apple-darwin18.7.0/dist/bin/Info.plist -sectcreate __TEXT __launchd_plist /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/Launchd.plist  ../../../../build/pure_virtual/libpure_virtual.a -Wl,-rpath, at executable_path ../../../../dist/bin/UpdateSettings -framework Security -framework Cocoa -framework SystemConfiguration
>>>> 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
>>>> 
>>>> 
>>>> with or without -lobjc
>>>> 
>>>> Thanks,
>>>> Gagan
>>>> 
>>>>> On Jun 10, 2024, at 10:14 AM, Ken Cunningham <ken.cunningham.webuse at gmail.com <mailto:ken.cunningham.webuse at gmail.com>> wrote:
>>>>> 
>>>>> I can't see lobjc on the link line.
>>>>> 
>>>>> Could you show us a failed link with it there?
>>>>> 
>>>>> Thx
>>>>> 
>>>>> 
>>>>> 
>>>>>> On Jun 10, 2024, at 8:51 AM, Gagan Sidhu via macports-dev <macports-dev at lists.macports.org <mailto:macports-dev at lists.macports.org>> wrote:
>>>>>> 
>>>>>> 
>>>>>>> GagansMacPro:updater Gagan$ /opt/local/bin/ccache /opt/local/bin/clang++ -isysroot /Users/Gagan/.mozbuild/MacOSX14.4.sdk -mmacosx-version-min=10.7 -stdlib=libc++ -o ../../../../dist/bin/org.mozilla.updater -fstack-protector-strong -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fPIC -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -gdwarf-4 -fno-omit-frame-pointer -funwind-tables -Wl,@/Users/Gagan/Downloads/mozilla-unified/obj-x86_64-apple-darwin18.7.0/toolkit/mozapps/update/updater/org_mozilla_updater.list    -fuse-ld=lld -fstack-protector-strong -Wl,-rpath, at executable_path/../Frameworks/UpdateSettings.framework -sectcreate __TEXT __info_plist /Users/Gagan/Downloads/mozilla-unified/obj-x86_64-apple-darwin18.7.0/dist/bin/Info.plist -sectcreate __TEXT __launchd_plist /Users/Gagan/Downloads/mozilla-unified/toolkit/mozapps/update/updater/Launchd.plist  ../../../../build/pure_virtual/libpure_virtual.a -Wl,-rpath, at executable_path ../../../../dist/bin/UpdateSettings -framework Security -framework Cocoa -framework SystemConfiguration
>>>>>> 
>>>>>> with or without -lobjc still produces the same undefined symbol error.
>>>>>> 
>>>>>> sorry for the duplicate message ken. forgot to send it ot the mailer.
>>>>>> 
>>>>>>> 
>>>>>>>> On Jun 10, 2024, at 9:45 AM, Ken Cunningham <ken.cunningham.webuse at gmail.com <mailto:ken.cunningham.webuse at gmail.com>> wrote:
>>>>>>>> 
>>>>>>>> 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 at lists.macports.org <mailto:macports-dev at 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 <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
>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20240611/2a4583a9/attachment.htm>


More information about the macports-dev mailing list