This is an archive of the discontinued LLVM Phabricator instance.

[lldb][modules] Disable Clang Modules in source/Host directory on macOS
ClosedPublic

Authored by teemperor on May 8 2020, 8:23 AM.

Details

Summary

The arpa/inet.h header in macOS is providing an incorrect htonl
function with enabled local submodule visibility while building LLDB. This
caused several networking tests to fail as the IP addresses are now flipped
in LLDB.

This patch disables building with modules when local submodule visibility is
active and the current system is macOS for the source/Host directory (which
is the *only directory that includes arpa/inet.h).

  • debugserver also includes arpa/inet.h but there we already disabled

modules.

Diff Detail

Event Timeline

teemperor created this revision.May 8 2020, 8:23 AM
aprantl accepted this revision.May 8 2020, 8:38 AM

The workaround LGTM! I wonder if we could do better about detecting when it should be applied.

lldb/source/Host/CMakeLists.txt
7

I know this would speculative, but would it be possible to detect the SDK version here? This way it forces us to regularly check whether the workaround is still necessary.

If you know the sysroot (=SDK path), you can inspect $SYSROOT/SDKSettings.json (perhaps via an inline python script and extract the version key), or perhaps even more straightforward you could invoke plutil on $SYSROOT/SDKSettings.plist to extract the version.

This revision is now accepted and ready to land.May 8 2020, 8:38 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2020, 9:38 AM