Libc functions undefined when linking

Ben Jones fake at fake.fake
Tue Jan 4 19:10:25 UTC 2022


On Tuesday, 4 January 2022 at 18:45:37 UTC, Ben Jones wrote:
> On Tuesday, 4 January 2022 at 18:37:25 UTC, Adam D Ruppe wrote:
>> On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote:
>>> clang -c -o source/assignment1.o source/assignment1.c
>>
>> you might have better luck just telling clang to link it too
>>
>> like
>>
>> clang source/assignment1.o -lphobos2 build/*.o # etc
>>
>> since there's a bunch of default search paths and libs etc the 
>> compiler pass to the linker.
>>
>> otherwise if you do need to use the linker directly worth 
>> remembering the order of args matter too. you need to put the 
>> more derived dependencies first followed by more general ones 
>> at the end
>
> Using clang seems to work better.  It sounds like Apple 
> basically hides system libraries since Big Sur, and I guess 
> their clang knows the magic flags to pass to find them.
>
> Thanks!

All good, except now simpledisplay is segfaulting on 
XDisplayConnection.get again (you helped me before by specifying 
a DISPLAY environment variable, but that's not working now, with 
either :0 or the longer value set by xquartz when opening an 
xterm).  I'm not sure how it can segfault since there are null 
checks in that method... maybe I should just head to the linux 
lab and stop fighting Apple.




More information about the Digitalmars-d-learn mailing list