MacPorts vs. Apple compiler issues, Handle

Joshua Root jmr at macports.org
Wed Mar 13 18:40:54 UTC 2024


On 13/3/2024 20:52, Riccardo Mottola wrote:
> I found a minor patch by Firefox to solve this namespace collision. So 
> for whatever reason Apple's did differently, it now compiles on all 
> compilers.
> 
> However clang9 generates a crashing executable. I tried on both 10.11 
> and 10.13.
> 
> - Apple clang: works fine
> - MacPorts clang 7: compiles & works
> - MacPorts clang 9 : compiles but fails
> 
> anybody has seen this behaviour in other software, perhaps smaller and 
> easier to test than ArcticFox?

Yes, any number of programs have had bugs that only became apparent when 
building with a newer compiler. But that's a very broad category, so 
without knowing the nature of the crash you're seeing, it's impossible 
to say what else might have had a similar problem.

Bugs in clang are not unknown, but far more common is programs relying 
on certain behaviour for operations that have undefined behaviour 
according to the language standard. Or sometimes the layout of memory 
just shifts slightly, causing a previously benign buffer overflow to do 
damage. Sometimes a newer compiler will also default to a newer version 
of the language, so if that's the cause of the differing behaviour, you 
can use -std to change it back.

Otherwise, you have to do the hard work of debugging: Look at the crash 
report to see where and how the code is crashing, pay attention to 
compiler warnings, and systematically eliminate possibilities of what 
could be going wrong. Building with clang's sanitizers may be helpful, 
particularly -fsanitize=address and -fsanitize=undefined, though in a 
code base this size I wouldn't be surprised if they also detected 
hundreds of other potential issues.

- Josh


More information about the macports-users mailing list