inexcitus
inexcitus

Reputation: 2649

Missing system headers (/usr/include) on macOS Catalina

I just installed the macOS Catalina 10.15 GM. Unfortunately none of my app frameworks compile. The system header files were not found. On macOS Mojave there was a workaround, but it no longer works, the file won't be dowloaded (the workaround is explained here)

When typing xcrun --show-sdk-path, /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk is printed on the Terminal. This folder also contains all the required headers. How can I tell Xcode to use those files?

This is how my module.modulemap looks like:

module PrivateNetwork [system]
{
    header "/usr/include/sys/socketvar.h"
    header "/usr/include/net/if_dl.h"
    header "/usr/include/net/if_types.h"
    header "/usr/include/net/if.h"
    header "/usr/include/netinet/in.h"
    header "/usr/include/netinet/tcp.h"

    header "/usr/include/netinet/tcp_var.h"
    header "/usr/include/netinet/tcpip.h"
    header "/usr/include/netinet/tcp_fsm.h"
    header "/usr/include/netinet/ip.h"
    header "/usr/include/netinet/ip6.h"

    export *
}

Error: Header '/usr/include/sys/socketvar.h' not found

Upvotes: 8

Views: 6512

Answers (2)

marceloow
marceloow

Reputation: 127

You could set the CPATH to the header directory.

export CPATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"

Upvotes: 7

inexcitus
inexcitus

Reputation: 2649

To solve this problem, I simply added the full path to the modulemap. If there is a better approach, please let me know, but at least now the file compiles (I also had to reorder the entries):

module PrivateNetwork [system]
{
    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/socketvar.h"

    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/ip.h"
    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/ip6.h"

    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcp_fsm.h"
    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcp_var.h"
    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netinet/tcpip.h"

    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/net/if_types.h"
    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/net/if.h"
    header "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/net/if_dl.h"

    export *
}

Upvotes: 0

Related Questions